Remap: Refactor scripts #177
@ -9,9 +9,9 @@ file_updated = False
|
|||||||
|
|
||||||
json_file_path = "" # File Path to read/write JSON File to
|
json_file_path = "" # File Path to read/write JSON File to
|
||||||
|
|
||||||
gold_file_map_json = Path(json_file_path)
|
file_map_json = Path(json_file_path)
|
||||||
gold_file_map_data = open(gold_file_map_json)
|
file_map_data = open(file_map_json)
|
||||||
gold_file_map_dict = json.load(gold_file_map_data)
|
file_map_dict = json.load(file_map_data)
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
@ -56,12 +56,12 @@ def generate_checksum(filepath: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def find_new_from_old(old_path):
|
def find_new_from_old(old_path):
|
||||||
for _, value in gold_file_map_dict.items():
|
for _, value in file_map_dict.items():
|
||||||
for old_json_path in value['old']:
|
for old_json_path in value['old']:
|
||||||
if old_json_path.endswith(old_path.split("/..")[-1]):
|
if old_json_path.endswith(old_path.split("/..")[-1]):
|
||||||
if value['new'] != old_json_path:
|
if value['new'] != old_json_path:
|
||||||
return value['new']
|
return value['new']
|
||||||
for _, value in gold_file_map_dict.items():
|
for _, value in file_map_dict.items():
|
||||||
for old_json_path in value['old']:
|
for old_json_path in value['old']:
|
||||||
if old_json_path.endswith(old_path.split("/")[-1]):
|
if old_json_path.endswith(old_path.split("/")[-1]):
|
||||||
if value['new'] != old_json_path:
|
if value['new'] != old_json_path:
|
||||||
|
Loading…
Reference in New Issue
Block a user