get_dependencies returns a set

This commit is contained in:
Doug Blank 2013-11-10 15:59:09 -05:00
parent 49b7c09cea
commit 7f2394337d

View File

@ -217,19 +217,19 @@ def get_dependencies(struct):
objects. objects.
""" """
if isinstance(struct, HandleClass): if isinstance(struct, HandleClass):
return [(struct.classname, str(struct))] return set([(struct.classname, str(struct))])
elif isinstance(struct, (tuple, list)): elif isinstance(struct, (tuple, list)):
retval = [] retval = set([])
for item in struct: for item in struct:
retval.extend(get_dependencies(item)) retval.update(get_dependencies(item))
return retval return retval
elif isinstance(struct, dict): elif isinstance(struct, dict):
retval = [] retval = set([])
for key in struct.keys(): for key in struct.keys():
retval.extend(get_dependencies(struct[key])) retval.update(get_dependencies(struct[key]))
return retval return retval
else: else:
return [] return set([])
class Struct(object): class Struct(object):
""" """