@@ -101,19 +101,28 @@ def __get_resources() -> dict:
101101@docval ({'name' : 'extensions' , 'type' : (str , TypeMap , list ),
102102 'doc' : 'a path to a namespace, a TypeMap, or a list consisting of paths to namespaces and TypeMaps' ,
103103 'default' : None },
104+ {
105+ 'name' : 'copy' , 'type' : bool ,
106+ 'doc' : 'Whether to return a deepcopy of the TypeMap. '
107+ 'If False, a direct reference may be returned (use with caution).' ,
108+ 'default' : True
109+ },
104110 returns = "TypeMap loaded for the given extension or NWB core namespace" , rtype = tuple ,
105111 is_method = False )
106112def get_type_map (** kwargs ):
107113 '''
108114 Get the TypeMap for the given extensions. If no extensions are provided,
109115 return the TypeMap for the core namespace
110116 '''
111- extensions = getargs ('extensions' , kwargs )
117+ extensions , copy_map = getargs ('extensions' , 'copy ' , kwargs )
112118 type_map = None
113119 if extensions is None :
114- type_map = deepcopy (__TYPE_MAP )
120+ if copy_map :
121+ type_map = deepcopy (__TYPE_MAP )
122+ else :
123+ type_map = __TYPE_MAP
115124 else :
116- warnings . warn ("The 'extensions' argument is deprecated and will be removed in HDMF 5.0" , DeprecationWarning )
125+ warn ("The 'extensions' argument is deprecated and will be removed in HDMF 5.0" , DeprecationWarning )
117126 if isinstance (extensions , TypeMap ):
118127 type_map = extensions
119128 else :
0 commit comments