Skip to content

Commit

Permalink
tuple change
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Sep 28, 2023
1 parent b783ace commit 5d67899
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hdmf/common/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from glob import glob
import os
import zipfile
from collections import namedtuple


class KeyTable(Table):
Expand Down Expand Up @@ -414,7 +415,9 @@ def _get_file_from_container(self, **kwargs):
def __check_termset_wrapper(self, **kwargs):
"""
Takes a list of objects and checks the fields for TermSetWrapper.
:return: [[object1, attribute_name1, wrapper1], [object2, attribute_name2, wrapper2], ...]
wrapped_obj = namedtuple('wrapped_obj', ['object', 'attribute', 'wrapper'])
:return: [wrapped_obj(object1, attribute_name1, wrapper1), ...]
"""
objects = kwargs['objects']

Expand All @@ -423,12 +426,13 @@ def __check_termset_wrapper(self, **kwargs):
for obj in objects:
# Get all the fields, parse out the methods and internal variables
obj_fields = [a for a in dir(obj) if not a.startswith('_') and not callable(getattr(obj, a))]

for attribute in obj_fields:
attr = getattr(obj, attribute)
if isinstance(attr, TermSetWrapper):
# Search objects that are wrapped
ret.append([obj, attribute, attr])
wrapped_obj = namedtuple('wrapped_obj', ['object', 'attribute', 'wrapper'])
ret.append(wrapped_obj(obj, attribute, attr))

return ret

@docval({'name': 'root_container', 'type': HERDManager,
Expand Down

0 comments on commit 5d67899

Please sign in to comment.