Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_path_exists(self):
inp = inputs.Sketchpad()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def test_path_exists(self):
inp = inputs.ImageUpload()
path = inputs.BASE_INPUT_INTERFACE_JS_PATH.format(inp.get_name())
self.assertTrue(os.path.exists(os.path.join(PACKAGE_NAME, path)))
def build_template(temp_dir, input_interface, output_interface):
"""
Create HTML file with supporting JS and CSS files in a given directory.
:param temp_dir: string with path to temp directory in which the html file should be built
"""
dir_util.copy_tree(STATIC_TEMPLATE_LIB, temp_dir)
dir_util.copy_tree(STATIC_PATH_LIB, os.path.join(temp_dir, STATIC_PATH_TEMP))
# Move association file to root of temporary directory.
copyfile(os.path.join(temp_dir, ASSOCIATION_PATH_IN_STATIC),
os.path.join(temp_dir, ASSOCIATION_PATH_IN_ROOT))
render_template_with_tags(
os.path.join(
temp_dir,
inputs.BASE_INPUT_INTERFACE_JS_PATH.format(input_interface.get_name()),
),
input_interface.get_js_context(),
)
render_template_with_tags(
os.path.join(
temp_dir,
outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(output_interface.get_name()),
),
output_interface.get_js_context(),
)
def build_template(temp_dir, input_interface, output_interface):
"""
Create HTML file with supporting JS and CSS files in a given directory.
:param temp_dir: string with path to temp directory in which the html file should be built
"""
dir_util.copy_tree(STATIC_TEMPLATE_LIB, temp_dir)
dir_util.copy_tree(STATIC_PATH_LIB, os.path.join(temp_dir, STATIC_PATH_TEMP))
# Move association file to root of temporary directory.
copyfile(os.path.join(temp_dir, ASSOCIATION_PATH_IN_STATIC),
os.path.join(temp_dir, ASSOCIATION_PATH_IN_ROOT))
render_template_with_tags(
os.path.join(
temp_dir,
inputs.BASE_INPUT_INTERFACE_JS_PATH.format(input_interface.get_name()),
),
input_interface.get_js_context(),
)
render_template_with_tags(
os.path.join(
temp_dir,
outputs.BASE_OUTPUT_INTERFACE_JS_PATH.format(output_interface.get_name()),
),
output_interface.get_js_context(),
)