Skip to content

Commit

Permalink
Minor changes to utility/troubleshooting/convenience script view-port…
Browse files Browse the repository at this point in the history
…al-object.
  • Loading branch information
dmichaels-harvard committed Aug 18, 2024
1 parent bcf974a commit a7baf95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dcicutils/scripts/update_portal_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit a7baf95

Please sign in to comment.