From 0c08741ac6557a154fe4683f580ae9169415056a Mon Sep 17 00:00:00 2001 From: jtyoung84 <104453205+jtyoung84@users.noreply.github.com> Date: Sun, 8 Sep 2024 15:36:58 -0700 Subject: [PATCH] patches issue parsing posix paths --- src/aind_metadata_mapper/__init__.py | 2 +- src/aind_metadata_mapper/core.py | 2 +- src/aind_metadata_mapper/gather_metadata.py | 3 +++ src/aind_metadata_mapper/models.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/aind_metadata_mapper/__init__.py b/src/aind_metadata_mapper/__init__.py index 65c5643b..70c2d39c 100644 --- a/src/aind_metadata_mapper/__init__.py +++ b/src/aind_metadata_mapper/__init__.py @@ -1,3 +1,3 @@ """Init package""" -__version__ = "0.17.0" +__version__ = "0.17.1" diff --git a/src/aind_metadata_mapper/core.py b/src/aind_metadata_mapper/core.py index 29406d04..8a3cdbb9 100644 --- a/src/aind_metadata_mapper/core.py +++ b/src/aind_metadata_mapper/core.py @@ -136,7 +136,7 @@ def __call__(self) -> Dict[str, Any]: class BaseJobSettings(BaseSettings): """Parent class for generating settings from a config file.""" - user_settings_config_file: Optional[Path] = Field( + user_settings_config_file: Optional[Union[Path, str]] = Field( default=None, repr=False, description="Optionally pull settings from a local config file.", diff --git a/src/aind_metadata_mapper/gather_metadata.py b/src/aind_metadata_mapper/gather_metadata.py index 93064f56..15f11724 100644 --- a/src/aind_metadata_mapper/gather_metadata.py +++ b/src/aind_metadata_mapper/gather_metadata.py @@ -52,6 +52,9 @@ def __init__(self, settings: JobSettings): settings : JobSettings """ self.settings = settings + # convert metadata_str to Path object + if isinstance(self.settings.metadata_dir, str): + self.settings.metadata_dir = Path(self.settings.metadata_dir) def _does_file_exist_in_user_defined_dir(self, file_name: str) -> bool: """ diff --git a/src/aind_metadata_mapper/models.py b/src/aind_metadata_mapper/models.py index 47fe20ce..c5165c1d 100644 --- a/src/aind_metadata_mapper/models.py +++ b/src/aind_metadata_mapper/models.py @@ -116,7 +116,7 @@ class JobSettings(BaseJobSettings): processing_settings: Optional[ProcessingSettings] = None metadata_settings: Optional[MetadataSettings] = None directory_to_write_to: Path - metadata_dir: Optional[Path] = Field( + metadata_dir: Optional[Union[Path, str]] = Field( default=None, description="Optional path where user defined metadata files might be", )