Skip to content

Commit

Permalink
fix(): add compatibility with PY 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisFros committed May 7, 2021
1 parent da9aee7 commit 363c491
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions snapshottest/ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ def update_path(current_path, key_or_index, is_dict=False):
if is_dict:
if current_path == "":
return key_or_index
return f"{current_path}.{key_or_index}"
return "{}.{}".format(current_path,key_or_index)
else:
return f"{current_path}[{key_or_index}]"
return "{}[{}]".format(current_path,key_or_index)


def clear_ignore_keys(data, ignore_keys, current_path=""):
Expand Down Expand Up @@ -36,7 +36,7 @@ def clear_ignore_keys(data, ignore_keys, current_path=""):
def match_ignored_key(key_or_index, data, ignore_keys, temp_path):
for ignored in ignore_keys:
escaped = ignored.translate(str.maketrans({"[": r"\[", "]": r"\]"}))
if re.match(f"{escaped}$", temp_path):
if re.match("{}$".format(escaped), temp_path):
data[key_or_index] = None
return True
return False

0 comments on commit 363c491

Please sign in to comment.