From 195a33c0364bd81e31460be0af64bb2404bc437b Mon Sep 17 00:00:00 2001 From: David Michaels Date: Sun, 14 Jan 2024 18:45:25 -0500 Subject: [PATCH] Fix (I think) in structured_data.Portal.ref_exists. --- dcicutils/structured_data.py | 10 ++++++++++ pyproject.toml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dcicutils/structured_data.py b/dcicutils/structured_data.py index eba9b339a..586c8af11 100644 --- a/dcicutils/structured_data.py +++ b/dcicutils/structured_data.py @@ -602,12 +602,22 @@ def ref_exists(self, type_name: str, value: str) -> List[str]: resolved = [] if self._ref_exists_single(type_name, value): resolved.append(type_name) + # TODO: Added this return on 2024-01-14 (dmichaels). + # Why did I orginally check for multiple existing values? + # Why not just return right away if I find that the ref exists? + # Getting multiple values because, for example, we find + # both this /Sample/UW_CELL-CULTURE-SAMPLE_COLO-829BL_HI-C_1 + # and /CellSample/UW_CELL-CULTURE-SAMPLE_COLO-829BL_HI-C_1 + # Why does that matter at all? Same thing. + return resolved # Check for the given ref in all sub-types of the given type. if (schemas_super_type_map := self.get_schemas_super_type_map()): if (sub_type_names := schemas_super_type_map.get(type_name)): for sub_type_name in sub_type_names: if self._ref_exists_single(sub_type_name, value): resolved.append(type_name) + # TODO: Added this return on 2024-01-14 (dmichaels). See above TODO. + return resolved return resolved def _ref_exists_single(self, type_name: str, value: str) -> bool: diff --git a/pyproject.toml b/pyproject.toml index 976fb6ade..4e85d94b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.7.0.1b25" # TODO: To become 8.7.1 +version = "8.7.0.1b26" # TODO: To become 8.7.1 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"