From f6d92e3b5f116e648236db246fd559af27dbd00f Mon Sep 17 00:00:00 2001 From: David Michaels Date: Thu, 14 Mar 2024 07:43:35 -0400 Subject: [PATCH] minor structured_data fix --- dcicutils/structured_data.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dcicutils/structured_data.py b/dcicutils/structured_data.py index 9d0184216..b7c1572d3 100644 --- a/dcicutils/structured_data.py +++ b/dcicutils/structured_data.py @@ -307,7 +307,7 @@ def _load_reader(self, reader: RowReader, type_name: str) -> None: "refs_found": self.ref_total_found_count, "refs_not_found": self.ref_total_notfound_count, "refs_lookup": self.ref_lookup_count, - "refs_cache_hit": self.ref_lookup_cache_hit_count, + "refs_cache_hit": self.ref_exists_cache_hit_count, "refs_invalid": self.ref_invalid_identifying_property_count }) self._note_warning(reader.warnings, "reader") @@ -1027,8 +1027,9 @@ def _get_type_name_and_value_from_path(path: str) -> Tuple[Optional[str], Option def _ref_exists_from_cache(self, type_name: str, value: str) -> Optional[List[dict]]: if self._ref_cache is not None: - self._ref_exists_cache_hit_count += 1 - return self._ref_cache.get(f"/{type_name}/{value}", None) + if ref := self._ref_cache.get(f"/{type_name}/{value}", None): + self._ref_exists_cache_hit_count += 1 + return ref self._ref_exists_cache_miss_count += 1 return None