Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _sources(self):
anno = IAnnotations(self.context)
sources = anno.get(ANNO_SOURCES, None)
if sources is None:
sources = anno[ANNO_SOURCES] = PersistentList()
return sources
def _criteria(self):
""" Get criteria from annotations
"""
anno = IAnnotations(self.context)
criteria = anno.get(ANNO_CRITERIA, None)
if criteria is None:
anno[ANNO_CRITERIA] = PersistentList()
return anno[ANNO_CRITERIA]
def _update(self, values):
""" Update criteria
"""
anno = IAnnotations(self.context)
anno[ANNO_CRITERIA] = PersistentList(values)
self.criteria = anno[ANNO_CRITERIA]
#
def __init__(self):
self.repositories = PersistentList()
# hex archive id -> Archive
self.archives = OOBTree()
# client hostname -> Client
self.clients = OOBTree()
# job number -> Job
# note: this tree is the canonical source of job numbers.
self.jobs = NumberTree()
# job state (str) -> NumberTree
self.jobs_by_state = PersistentDefaultDict(factory=LOBTree)
self.schedules = PersistentList()
self.trigger_ids = OOBTree()
self.ext = PersistentDict()
def __init__(self, context):
self.context = context
annotations = IAnnotations(self.context)
self.__mapping = annotations.get(self.ANNO_KEY, None)
if self.__mapping is None:
self.__mapping = PersistentList()
annotations[self.ANNO_KEY] = self.__mapping
@adapter(PersistentList)
@implementer(IJsonCompatible)
def persistent_list_converter(value):
return list_converter(value)
def __init__(self):
self._toList = PersistentList()
self._ccList = PersistentList()
def __add__(self, other):
if isinstance(other, PSetList):
return PSetList(self.sets + other.sets)
elif isinstance(other, (PersistentList, list, tuple)):
return PSetList(self.sets + other)
elif isinstance(other, PSet):
new_sets = PersistentList(self.sets)
new_sets.append(other)
return PSetList(new_sets)
else:
raise TypeError
def __init__(self, abstract, track, responsible, propTracks, answers):
AbstractJudgement.__init__(self, abstract, track, responsible, answers)
self._proposedTracks = PersistentList( propTracks )
def _initStandardPersonalData(self):
self._data = PersistentMapping()
self._sortedKeys = PersistentList()
p = PersonalDataFormItem({'id':'title', 'name': _("Title"), 'input':'list', 'mandatory':False})
self._data[p.getId()] = p
self._sortedKeys.append(p.getId())
p = PersonalDataFormItem({'id':'firstName', 'name': _("First Name"), 'input':'text', 'mandatory':True})
self._data[p.getId()] = p
self._sortedKeys.append(p.getId())
p = PersonalDataFormItem({'id':'surname', 'name': _("Surname"), 'input':'text', 'mandatory':True})
self._data[p.getId()] = p
self._sortedKeys.append(p.getId())
p = PersonalDataFormItem({'id':'position', 'name': _("Position"), 'input':'text', 'mandatory':False})
self._data[p.getId()] = p
self._sortedKeys.append(p.getId())
p = PersonalDataFormItem({'id':'institution', 'name': _("Institution"), 'input':'text', 'mandatory':True})
self._data[p.getId()] = p
self._sortedKeys.append(p.getId())
p = PersonalDataFormItem({'id':'address', 'name': _("Address"), 'input':'text', 'mandatory':False})