diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-07-22 09:46:45 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-07-22 09:46:45 +1000 |
| commit | 12f9211cd4a255226d151545e0532c8507af7361 (patch) | |
| tree | d85086cbdd39709dbf43455b4136f4f3ad3404da /pywal/export.py | |
| parent | 97de3110de378856e04ce17d41a8d75935b28767 (diff) | |
general: Remove comments that just repeat what the code does.
Diffstat (limited to 'pywal/export.py')
| -rw-r--r-- | pywal/export.py | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/pywal/export.py b/pywal/export.py index 06ad215..1dc72bf 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -9,37 +9,21 @@ from pywal import util def template(colors, input_file, output_dir): """Read template file, substitute markers and save the file elsewhere.""" - # Import the template. - with open(input_file) as file: - template_data = file.readlines() - - # Format the markers. + template_data = util.read_file_raw(input_file) template_data = "".join(template_data).format(**colors) - - # Get the template name. - template_file = os.path.basename(input_file) - - # Export the template. - output_file = output_dir / template_file - util.save_file(template_data, output_file) - - print(f"export: Exported {template_file}.") + template_name = os.path.basename(input_file) + util.save_file(template_data, output_dir / template_name) + print(f"export: Exported {template_name}.") def export_all_templates(colors, output_dir, template_dir=None): """Export all template files.""" - # Add the template dir to module path. template_dir = template_dir or \ os.path.join(os.path.dirname(__file__), "templates") - # Merge all colors (specials and normals) into one dict so we can access - # their values simpler. all_colors = {"wallpaper": colors["wallpaper"], **colors["special"], **colors["colors"]} - - # Turn all those colors into util.Color instances for accessing the - # .hex and .rgb formats all_colors = {k: util.Color(v) for k, v in all_colors.items()} # pylint: disable=W0106 |
