Skip to content

Commit

Permalink
Minor changes to utility/troubleshooting/convenience scripts view-por…
Browse files Browse the repository at this point in the history
…tal-object and update-portal-object.
  • Loading branch information
dmichaels-harvard committed Aug 16, 2024
1 parent a842e23 commit ff794f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion dcicutils/scripts/update_portal_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ def post_or_patch_or_upsert(portal: Portal, file: str, schema_name: Optional[str
elif isinstance(data, list):
if debug:
_print(f"DEBUG: File ({file}) contains a list of objects of type: {schema_name}")
import pdb ; pdb.set_trace() # noqa
data = _impose_special_ordering(data, schema_name)
for index, item in enumerate(data):
update_function(portal, item, schema_name, file=file, index=index,
Expand Down
13 changes: 6 additions & 7 deletions dcicutils/scripts/view_portal_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,19 +347,18 @@ def get_metadata_for_individual_result_type(uuid: str) -> Optional[dict]: # noq
schema_data = response[schema_name]
file_name = f"{to_snake_case(schema_name)}.json"
file_path = os.path.join(output_directory, file_name)
message_verb = "Writing"
if os.path.exists(file_path):
message_verb = "Overwriting"
if os.path.isdir(file_path):
_print(f"WARNING: Output file already exists as a directory. SKIPPING: {file_path}")
continue
if force:
if verbose:
_print(f"Overwriting extant file (per --force option): {file_path}")
else:
if not force:
_print(f"Output file already exists: {file_path}")
if (not force) and not yes_or_no(f"Overwrite this file?"):
continue
if not yes_or_no(f"Overwrite this file?"):
continue
if verbose:
_print(f"Writing {schema_name} (object{'s' if len(schema_data) != 1 else ''}:"
_print(f"{message_verb} {schema_name} (object{'s' if len(schema_data) != 1 else ''}:"
f" {len(schema_data)}) file: {file_path}")
with io.open(file_path, "w") as f:
json.dump(schema_data, f, indent=4)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.14.0.1b5" # TODO: To become 8.14.1
version = "8.14.0.1b6" # TODO: To become 8.14.1
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
license = "MIT"
Expand Down

0 comments on commit ff794f1

Please sign in to comment.