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 9c6a451 commit bdb0410
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/hdmf/build/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .builders import DatasetBuilder, GroupBuilder, LinkBuilder, Builder, BaseBuilder
from .classgenerator import ClassGenerator, CustomClassGenerator, MCIClassGenerator
from ..container import AbstractContainer, Container, Data
from ..common import get_type_map()
from ..term_set import TermSetConfigurator
from ..spec import DatasetSpec, GroupSpec, NamespaceCatalog
from ..spec.spec import BaseStorageSpec
Expand Down Expand Up @@ -735,7 +734,8 @@ def register_container_type(self, **kwargs):
self.__container_types.setdefault(namespace, dict())
self.__container_types[namespace][data_type] = container_cls
self.__data_types.setdefault(container_cls, (namespace, data_type))
container_cls.__type_map = get_type_map()
# from hdmf.common import get_type_map # circular import
# container_cls.type_map = get_type_map()
if not isinstance(container_cls, TypeSource):
setattr(container_cls, spec.type_key(), data_type)
setattr(container_cls, 'namespace', namespace)
Expand Down
5 changes: 1 addition & 4 deletions src/hdmf/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
global __TYPE_MAP

@docval({'name': 'config_path', 'type': str, 'doc': 'Path to the configuration file.'},
{'name': 'return_map', 'type': bool, 'doc': 'Bool to return type_map', 'default': False},
is_method=False)
def load_termset_config(**kwargs):
"""
Expand All @@ -30,9 +29,6 @@ def load_termset_config(**kwargs):
config_path, return_map = kwargs['config_path'], kwargs['return_map']
__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

if return_map: # This helps with testing
return __TYPE_MAP

def get_loaded_config():
"""
This method returns the entire config file.
Expand Down Expand Up @@ -78,6 +74,7 @@ def _dec(cls):
if container_cls is None:
return _dec
else:
container_cls.type_map = get_type_map()

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

View check run for this annotation

Codecov / codecov/patch

src/hdmf/common/__init__.py#L77

Added line #L77 was not covered by tests
_dec(container_cls)


Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ namespaces:
version: TBD
data_types:
VectorData:
data: '/Users/mavaylon/Research/NWB/hdmf2/hdmf/tests/unit/example_test_term_set.yaml'
data: 'tests/unit/example_test_term_set.yaml'
field2: '...'
type2:
field1: '...'
hdmf-experimental:
version: TBD
data_types:
type1:
field1: '/Users/mavaylon/Research/NWB/hdmf2/hdmf/tests/unit/example_test_term_set.yaml'
field1: 'tests/unit/example_test_term_set.yaml'
field2: '...'
7 changes: 4 additions & 3 deletions tests/unit/test_term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from hdmf import Container
from hdmf.term_set import TermSet, TermSetWrapper, TermSetConfigurator
from hdmf.testing import TestCase, remove_test_file
from hdmf.common import VectorIndex, VectorData, unload_termset_config, get_loaded_config, load_termset_config
from hdmf.common import (VectorIndex, VectorData, unload_termset_config, get_loaded_config, load_termset_config,
get_type_map)
from hdmf.utils import popargs


Expand Down Expand Up @@ -227,7 +228,7 @@ def tearDown(self):
unload_termset_config()

def test_get_loaded_config(self):
load_termset_config(config_path='tests/unit/hdmf_config.yaml', return_map=True)
load_termset_config(config_path='tests/unit/hdmf_config.yaml')
loaded_config = get_loaded_config()
config = {'namespaces': {'hdmf-common': {'version': '3.12.2',
'data_types': {'VectorData': {'description': 'example_test_term_set.yaml'},
Expand Down Expand Up @@ -292,7 +293,7 @@ def setUp(self):
if not REQUIREMENTS_INSTALLED:
self.skipTest("optional LinkML module is not installed")

self.tm = load_termset_config(config_path='tests/unit/hdmf_config.yaml', return_map=True)
self.tm = get_type_map()

def tearDown(self):
unload_termset_config()
Expand Down

0 comments on commit bdb0410

Please sign in to comment.