From 2b3eaa0ce73af4c225d16e9be4eeba4e9723d9dc Mon Sep 17 00:00:00 2001 From: David Michaels Date: Thu, 22 Aug 2024 18:47:43 -0400 Subject: [PATCH] Modified structured_data hook interface slightly to check for and call the "finish" attribute/callable hook. --- CHANGELOG.rst | 2 ++ dcicutils/structured_data.py | 4 ++++ pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6664c0284..f3e8e651c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,8 @@ Change Log ====== * 2024-08-22 (dmichaels) +* Modified structured_data hook interface slightly to + check for and call the "finish" attribute/callable hook. * Added portal_utils.Portal.head method. diff --git a/dcicutils/structured_data.py b/dcicutils/structured_data.py index 8bb134432..74733061f 100644 --- a/dcicutils/structured_data.py +++ b/dcicutils/structured_data.py @@ -287,6 +287,10 @@ def _load_normal_file(self, file: str) -> None: self._load_json_file(file) elif file.endswith(".tar") or file.endswith(".zip"): self._load_packed_file(file) + if (self._validator_hook and + hasattr(self._validator_hook, "finish") and + callable(finish_validator_hook := getattr(self._validator_hook, "finish"))): # noqa + finish_validator_hook(self) def _load_packed_file(self, file: str) -> None: for file in unpack_files(file, suffixes=ACCEPTABLE_FILE_SUFFIXES): diff --git a/pyproject.toml b/pyproject.toml index d418e80e6..e9ceffc66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.14.2.1b2" # TODO: To become 8.14.3 +version = "8.14.2.1b3" # TODO: To become 8.14.3 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"