From b59a5c1e5df4ce8b81cf53b22fa50152ced8c881 Mon Sep 17 00:00:00 2001 From: David Michaels Date: Wed, 29 May 2024 12:08:34 -0400 Subject: [PATCH] fix in structured_data for json file --- dcicutils/structured_data.py | 14 ++++++++------ pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dcicutils/structured_data.py b/dcicutils/structured_data.py index 7e0034eae..dc12a80de 100644 --- a/dcicutils/structured_data.py +++ b/dcicutils/structured_data.py @@ -351,20 +351,22 @@ def get_counts() -> Tuple[int, int]: def _load_json_file(self, file: str) -> None: with open(file) as f: - item = json.load(f) + data = json.load(f) + import pdb ; pdb.set_trace() # noqa + pass if ((schema_name_inferred_from_file_name := Schema.type_name(file)) and (self._portal.get_schema(schema_name_inferred_from_file_name) is not None)): # noqa # If the JSON file name looks like a schema name then assume it # contains an object or an array of object of that schema type. if self._merge: - item = self._merge_with_existing_portal_object(item, schema_name_inferred_from_file_name) - self._add(Schema.type_name(file), item) - elif isinstance(item, dict): + data = self._merge_with_existing_portal_object(data, schema_name_inferred_from_file_name) + self._add(Schema.type_name(file), data) + elif isinstance(data, dict): # Otherwise if the JSON file name does not look like a schema name then # assume it a dictionary where each property is the name of a schema, and # which (each property) contains a list of object of that schema type. - for schema_name in item: - item = item[schema_name] + for schema_name in data: + item = data[schema_name] if self._merge: item = self._merge_with_existing_portal_object(item, schema_name) self._add(schema_name, item) diff --git a/pyproject.toml b/pyproject.toml index c670f51f0..deafb6dc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.8.6.1b12" +version = "8.8.6.1b13" description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"