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