From 0908d659c7fe10e9ef8ab048462ed20a495a1e35 Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Fri, 19 Jan 2024 08:05:36 -0800 Subject: [PATCH] clean up --- docs/gallery/general/plot_configurator.py | 1 - src/pynwb/__init__.py | 14 +++++++------- src/pynwb/core.py | 4 ++-- src/pynwb/termset_config.py | 12 ------------ 4 files changed, 9 insertions(+), 22 deletions(-) delete mode 100644 src/pynwb/termset_config.py diff --git a/docs/gallery/general/plot_configurator.py b/docs/gallery/general/plot_configurator.py index 87d574b4f..f1803487a 100644 --- a/docs/gallery/general/plot_configurator.py +++ b/docs/gallery/general/plot_configurator.py @@ -1,4 +1,3 @@ -from pynwb import nwb_config from datetime import datetime from uuid import uuid4 diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 40adef3f4..6ca0293a6 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -12,17 +12,17 @@ from hdmf.backends.hdf5 import HDF5IO as _HDF5IO from hdmf.build import BuildManager, TypeMap import hdmf.common +from hdmf.term_set import TermSetConfigurator CORE_NAMESPACE = 'core' from .spec import NWBDatasetSpec, NWBGroupSpec, NWBNamespace # noqa E402 from .validate import validate # noqa: F401, E402 -from .termset_config import NWBTermSetConfigurator CUR_DIR = os.path.dirname(os.path.realpath(__file__)) -path_to_config = os.path.join(CUR_DIR, 'config/nwb_config.yaml') -nwb_config = NWBTermSetConfigurator(path=path_to_config) +path_to_config = os.path.join(CUR_DIR, 'config/NWB_CONFIG.yaml') +NWB_CONFIG = TermSetConfigurator(path=path_to_config) @docval({'name': 'config_path', 'type': str, 'doc': 'Path to the configuartion file.', 'default': None}) @@ -37,16 +37,16 @@ def load_termset_config(config_path: str): - If the data_type is not present, then they will be loaded alongside the default curated configuration. """ if config_path is None: - nwb_config.unload_termset_config() - nwb_config.load_termset_config() + NWB_CONFIG.unload_termset_config() + NWB_CONFIG.load_termset_config() else: - nwb_config.load_termset_config(config_path) + NWB_CONFIG.load_termset_config(config_path) def unload_termset_config(): """ Remove validation. """ - return nwb_config.unload_termset_config() + return NWB_CONFIG.unload_termset_config() def __get_resources(): diff --git a/src/pynwb/core.py b/src/pynwb/core.py index a87dab2e6..8e658b1ba 100644 --- a/src/pynwb/core.py +++ b/src/pynwb/core.py @@ -47,8 +47,8 @@ def _error_on_new_warn_on_construct(self, error_msg: str): warn(error_msg) def get_config(self): - from . import nwb_config #update path - return nwb_config + from . import NWB_CONFIG #update path + return NWB_CONFIG def get_type_map(self): from . import get_type_map diff --git a/src/pynwb/termset_config.py b/src/pynwb/termset_config.py deleted file mode 100644 index 7ca0b497a..000000000 --- a/src/pynwb/termset_config.py +++ /dev/null @@ -1,12 +0,0 @@ -from hdmf.term_set import TermSetConfigurator as hdmf_TermSetConfigurator -from hdmf.utils import docval - - -class NWBTermSetConfigurator(hdmf_TermSetConfigurator): - """ - - """ - @docval({'name': 'path', 'type': str, 'doc': 'Path to the configuartion file.', - 'default': 'src/pynwb/config/nwb_config.yaml'}) - def __init__(self,**kwargs): - super().__init__(**kwargs)