Skip to content

Commit 514c7fb

Browse files
authored
Merge pull request hed-standard#743 from IanCa/develop
Allow dict as a parameter to DefinitionDict
2 parents 885234f + 02ad058 commit 514c7fb

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

hed/models/definition_dict.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def add_definitions(self, def_dicts, hed_schema=None):
3333
""" Add definitions from dict(s) to this dict.
3434
3535
Parameters:
36-
def_dicts (list or DefinitionDict): DefDict or list of DefDicts/strings whose definitions should be added.
36+
def_dicts (list or DefinitionDict or dict): DefinitionDict or list of DefinitionDicts/strings/dicts whose
37+
definitions should be added.
38+
Note dict form expects DefinitionEntries in the same form as a DefinitionDict
3739
hed_schema(HedSchema or None): Required if passing strings or lists of strings, unused otherwise.
3840
3941
:raises TypeError:
@@ -42,7 +44,7 @@ def add_definitions(self, def_dicts, hed_schema=None):
4244
if not isinstance(def_dicts, list):
4345
def_dicts = [def_dicts]
4446
for def_dict in def_dicts:
45-
if isinstance(def_dict, DefinitionDict):
47+
if isinstance(def_dict, (DefinitionDict, dict)):
4648
self._add_definitions_from_dict(def_dict)
4749
elif isinstance(def_dict, str) and hed_schema:
4850
self.check_for_definitions(HedString(def_dict, hed_schema))
@@ -64,7 +66,7 @@ def _add_definitions_from_dict(self, def_dict):
6466
""" Add the definitions found in the given definition dictionary to this mapper.
6567
6668
Parameters:
67-
def_dict (DefinitionDict): DefDict whose definitions should be added.
69+
def_dict (DefinitionDict or dict): DefDict whose definitions should be added.
6870
6971
"""
7072
for def_tag, def_value in def_dict.items():

0 commit comments

Comments
 (0)