Skip to content

Commit

Permalink
in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Mar 19, 2024
1 parent be1752d commit 46c8f9b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/hdmf/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 30 in src/hdmf/common/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/common/__init__.py#L29-L30

Added lines #L29 - L30 were not covered by tests

def get_loaded_config():
Expand Down Expand Up @@ -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)


Expand Down
7 changes: 4 additions & 3 deletions src/hdmf/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ def _field_config(self, arg_name, val):
warn(msg)
return val

Check warning on line 151 in src/hdmf/container.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/container.py#L149-L151

Added lines #L149 - L151 were not covered by tests
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,

Check warning on line 155 in src/hdmf/container.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/container.py#L154-L155

Added lines #L154 - L155 were not covered by tests
config_namespace['data_types'][object_name][mapped_attr_name])
termset = TermSet(term_schema_path=termset_path)
val = TermSetWrapper(value=val, termset=termset)
return val

Check warning on line 159 in src/hdmf/container.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/container.py#L157-L159

Added lines #L157 - L159 were not covered by tests
Expand Down
1 change: 1 addition & 0 deletions src/hdmf/term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ def load_termset_config(self,config_path):
self.config['namespaces'][namespace] = termset_config['namespaces'][namespace]

Check warning on line 361 in src/hdmf/term_set.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/term_set.py#L361

Added line #L361 was not covered by tests
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

Check warning on line 367 in src/hdmf/term_set.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/term_set.py#L366-L367

Added lines #L366 - L367 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 46c8f9b

Please sign in to comment.