Skip to content

Commit 1e8bd8f

Browse files
committed
Remove unnecessary calls to deepcopy(get_type_map)
1 parent f9cd2a2 commit 1e8bd8f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/pynwb/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class NWBMixin(AbstractContainer):
3232

3333
__nwbfields__ = tuple()
3434

35+
__type_map = get_type_map() # static type map created at module import
36+
3537
@docval({'name': 'neurodata_type', 'type': str, 'doc': 'the data_type to search for', 'default': None})
3638
def get_ancestor(self, **kwargs):
3739
"""
@@ -61,7 +63,7 @@ def _error_on_new_pass_on_construct(self, error_msg: str):
6163
raise ValueError(error_msg)
6264

6365
def _get_type_map(self):
64-
return get_type_map()
66+
return self.__type_map
6567

6668
@property
6769
def data_type(self):

src/pynwb/legacy/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from hdmf.utils import docval, getargs
22
from .. import get_type_map, NWBContainer
3+
from copy import deepcopy
34
from .map import ObjectMapperLegacy as ObjectMapper
45

56

6-
__TYPE_MAP = get_type_map()
7+
__TYPE_MAP = deepcopy(get_type_map())
78

89
# Register new ObjectMapper with the new TypeMap:
910
__TYPE_MAP.register_map(NWBContainer, ObjectMapper)

0 commit comments

Comments
 (0)