From a7baf95f5e7f45cf6ed0f168473492afcc40f395 Mon Sep 17 00:00:00 2001 From: David Michaels Date: Sat, 17 Aug 2024 23:34:32 -0400 Subject: [PATCH] Minor changes to utility/troubleshooting/convenience script view-portal-object. --- dcicutils/scripts/update_portal_object.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dcicutils/scripts/update_portal_object.py b/dcicutils/scripts/update_portal_object.py index e3ccd7479..8d11003d2 100644 --- a/dcicutils/scripts/update_portal_object.py +++ b/dcicutils/scripts/update_portal_object.py @@ -485,7 +485,7 @@ def decode_bytes(str_or_bytes: Union[str, bytes], *, encoding: str = "utf-8") -> with io.open(inserts_file, "r") as f: try: data = json.load(f) - except Exception as e: + except Exception: _print(f"Cannot load JSON data from file: {inserts_file}") return False if isinstance(data, list): @@ -509,7 +509,7 @@ def decode_bytes(str_or_bytes: Union[str, bytes], *, encoding: str = "utf-8") -> for schema_name in schema_names: if not isinstance(schema_data := data[schema_name], list): _print(f"Unexpected value for data type ({schema_name})" - f" in JSON data file: {inserts_file} ▶ ignoring") + f" in JSON data file: {inserts_file} ▶ ignoring") continue file_name = os.path.join(tmpdir, f"{to_snake_case(schema_name)}.json") with io.open(file_name, "w") as f: @@ -581,6 +581,7 @@ def _is_schema_name_list(portal: Portal, keys: list) -> bool: return True return False + def _prune_data_for_update(data: dict, noignore: bool = False, ignore: Optional[List[str]] = None) -> dict: ignore_these_properties = [] if noignore is True else _IGNORE_PROPERTIES_ON_UPDATE if isinstance(ignore, list):