From 46c8f9b61eb1c3950531f8a266629f9899c6f41d Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Tue, 19 Mar 2024 07:53:50 -0700 Subject: [PATCH] in progress --- src/hdmf/common/__init__.py | 8 ++++---- src/hdmf/container.py | 7 ++++--- src/hdmf/term_set.py | 1 + tests/unit/test_term_set.py | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/hdmf/common/__init__.py b/src/hdmf/common/__init__.py index cc4ba0e69..870c3f00c 100644 --- a/src/hdmf/common/__init__.py +++ b/src/hdmf/common/__init__.py @@ -26,7 +26,7 @@ def load_termset_config(**kwargs): """ This method will either load the default config or the config provided by the path. """ - config_path, return_map = kwargs['config_path'], kwargs['return_map'] + config_path = kwargs['config_path'] __TYPE_MAP.ts_config.load_termset_config(config_path) def get_loaded_config(): @@ -61,20 +61,20 @@ def register_class(**kwargs): def _dec(cls): _set_exp(cls) __TYPE_MAP.register_container_type(namespace, data_type, cls) - # cls.type_map = __TYPE_MAP + cls.type_map = __TYPE_MAP # cls.namespace = namespace return cls else: def _dec(cls): __TYPE_MAP.register_container_type(namespace, data_type, cls) - # cls.type_map = __TYPE_MAP + cls.type_map = __TYPE_MAP # cls.namespace = namespace return cls if container_cls is None: return _dec else: - container_cls.type_map = get_type_map() + # container_cls.type_map = get_type_map() _dec(container_cls) diff --git a/src/hdmf/container.py b/src/hdmf/container.py index e88bd417b..9887d3f34 100644 --- a/src/hdmf/container.py +++ b/src/hdmf/container.py @@ -150,9 +150,10 @@ def _field_config(self, arg_name, val): warn(msg) return val else: - # From the spec, get the corresponding constructor name - constr_name = obj_mapper.get_const_arg(spec) - termset_path = os.path.join(CUR_DIR, config_namespace['data_types'][object_name][constr_name]) + # From the spec, get the mapped attribute name + mapped_attr_name = obj_mapper.get_attribute(spec) + termset_path = os.path.join(CUR_DIR, + config_namespace['data_types'][object_name][mapped_attr_name]) termset = TermSet(term_schema_path=termset_path) val = TermSetWrapper(value=val, termset=termset) return val diff --git a/src/hdmf/term_set.py b/src/hdmf/term_set.py index db19f4045..d17c15e56 100644 --- a/src/hdmf/term_set.py +++ b/src/hdmf/term_set.py @@ -361,6 +361,7 @@ def load_termset_config(self,config_path): self.config['namespaces'][namespace] = termset_config['namespaces'][namespace] else: # check for any needed overrides within existing namespace configs for data_type in termset_config['namespaces'][namespace]['data_types']: + # NOTE: these two branches effectively do the same thing, but are split for clarity. if data_type in self.config['namespaces'][namespace]['data_types']: replace_config = termset_config['namespaces'][namespace]['data_types'][data_type] self.config['namespaces'][namespace]['data_types'][data_type] = replace_config diff --git a/tests/unit/test_term_set.py b/tests/unit/test_term_set.py index 8cc02a83b..d1634eb9b 100644 --- a/tests/unit/test_term_set.py +++ b/tests/unit/test_term_set.py @@ -292,7 +292,7 @@ class TestTermSetConfigVectorData(TestCase): def setUp(self): if not REQUIREMENTS_INSTALLED: self.skipTest("optional LinkML module is not installed") - + load_termset_config(config_path='tests/unit/hdmf_config.yaml') self.tm = get_type_map() def tearDown(self):