summaryrefslogtreecommitdiff
path: root/pywal
diff options
context:
space:
mode:
authorLoic Coyle <loic.coyle@hotmail.fr>2020-05-04 20:26:07 +0200
committerLoic Coyle <loic.coyle@hotmail.fr>2020-05-04 20:26:07 +0200
commitcecc28cc5288fb80a178e456cf2e93d77f5dbd71 (patch)
tree4e06075ece0c628a33cf28c641b02ab9318ee852 /pywal
parent8e6f6d356c0a9f987827b7ab8c4c871a25789dd8 (diff)
add pylint disable, r-string, line length, change isinstance
Diffstat (limited to 'pywal')
-rw-r--r--pywal/export.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pywal/export.py b/pywal/export.py
index b9a95e8..928fbc3 100644
--- a/pywal/export.py
+++ b/pywal/export.py
@@ -12,6 +12,7 @@ from .settings import CACHE_DIR, CONF_DIR, MODULE_DIR
def template(colors, input_file, output_file=None):
"""Read template file, substitute markers and
save the file elsewhere."""
+ # pylint: disable-msg=too-many-locals
template_data = util.read_file_raw(input_file)
for i, l in enumerate(template_data):
for match in re.finditer(r"(?<=(?<!\{))(\{([^{}]+)\})(?=(?!\}))", l):
@@ -25,7 +26,7 @@ def template(colors, input_file, output_file=None):
# Color to be modified copied into new one
new_color = util.Color(colors[cname].hex_color)
# Execute each function to be done
- for func in filter(None, re.split("\)|\.", funcs)):
+ for func in filter(None, re.split(r"\)|\.", funcs)):
# Get function name and arguments
func = func.split("(")
fname = func[0]
@@ -52,12 +53,13 @@ def template(colors, input_file, output_file=None):
replace_str += '.' + fname
new_color = function
- if not isinstance(new_color, str):
+ if isinstance(new_color, util.Color):
new_color = new_color.strip
# If the color was changed, replace with a unique identifier.
if new_color is not colors[cname]:
new_color_clean = new_color.replace('[', '_').replace(']', '_')
- template_data[i] = l.replace(replace_str, "color" + new_color_clean)
+ template_data[i] = l.replace(replace_str,
+ "color" + new_color_clean)
colors["color" + new_color_clean] = new_color
try:
template_data = "".join(template_data).format(**colors)