24 from past.builtins
import basestring
30 from UserDict
import IterableUserDict
as UserDict
32 from collections
import UserDict
38 """DataId is used to pass scientifically meaningful key-value pairs. It may be tagged as applicable only
39 to repositories that are tagged with the same value"""
41 def __init__(self, initialdata=None, tag=None, **kwargs):
46 initialdata : dict or dataId
47 A dict of initial data for the DataId
48 tag : any type, or a container of any type
49 A value or container of values used to restrict the DataId to one or more repositories that
50 share that tag value. It will be stored in a set for comparison with the set of tags assigned to
53 key-value pairs to be used as part of the DataId's data.
55 UserDict.__init__(self, initialdata)
57 self.
tag = copy.deepcopy(initialdata.tag)
58 except AttributeError:
62 if isinstance(tag, basestring):
63 self.tag.update([tag])
68 self.tag.update([tag])
70 self.data.update(kwargs)
73 return "DataId(initialdata=%s, tag=%s)" % (self.data.__repr__(), self.
tag)