Skip to content

Commit

Permalink
update dcicutils
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Mar 7, 2024
1 parent 945374f commit 4aa02d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions dcicutils/structured_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ def ref_lookup_notfound_count(self) -> int:
def ref_lookup_error_count(self) -> int:
return self.portal.ref_lookup_error_count if self.portal else -1

@property
def ref_exists_internal_count(self) -> int:
return self.portal.ref_exists_internal_count if self.portal else -1

@property
def ref_exists_cache_hit_count(self) -> int:
return self.portal.ref_exists_cache_hit_count if self.portal else -1
Expand Down Expand Up @@ -716,6 +720,7 @@ def __init__(self,
self._ref_lookup_found_count = 0
self._ref_lookup_notfound_count = 0
self._ref_lookup_error_count = 0
self._ref_exists_internal_count = 0
self._ref_exists_cache_hit_count = 0
self._ref_exists_cache_miss_count = 0

Expand Down Expand Up @@ -829,6 +834,7 @@ def _ref_exists_single(self, type_name: str, value: str, root: bool = False) ->
for item in items:
if (ivalue := next((item[iproperty] for iproperty in iproperties if iproperty in item), None)):
if isinstance(ivalue, list) and value in ivalue or ivalue == value:
self._ref_exists_internal_count += 1
return True, (ivalue if isinstance(ivalue, str) and is_uuid(ivalue) else None)
if (value := self.get_metadata(f"/{type_name}/{value}" if not root else f"/{value}")) is None:
return False, None
Expand Down Expand Up @@ -860,6 +866,10 @@ def ref_lookup_notfound_count(self) -> int:
def ref_lookup_error_count(self) -> int:
return self._ref_lookup_error_count

@property
def ref_exists_internal_count(self) -> int:
return self._ref_exists_internal_count

@property
def ref_exists_cache_hit_count(self) -> int:
return self._ref_exists_cache_hit_count
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.8.0.1b3" # TODO: To become 8.8.1
version = "8.8.0.1b4" # TODO: To become 8.8.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 4aa02d0

Please sign in to comment.