Beispiel #1
0
 def uid(self, uidIndex=-1):
     """
     """
     # 'uidIndex' should be in 'self.desc.uid' but in the case of linked attribute
     # it will not be the case (so we cannot have an assert).
     if self.isOutput:
         # only dependent on the hash of its value without the cache folder
         return hashValue(self._invalidationValue)
     if self.isLink:
         return self.getLinkParam().uid(uidIndex)
     if isinstance(self._value, (list, tuple, set,)):
         # hash of sorted values hashed
         return hashValue([hashValue(v) for v in sorted(self._value)])
     return hashValue(self._value)
Beispiel #2
0
 def _computeUids(self):
     """ Compute node uids by combining associated attributes' uids. """
     for uidIndex, associatedAttributes in self.attributesPerUid.items():
         # uid is computed by hashing the sorted list of tuple (name, value) of all attributes impacting this uid
         uidAttributes = [(a.getName(), a.uid(uidIndex)) for a in associatedAttributes if a.enabled]
         uidAttributes.sort()
         self._uids[uidIndex] = hashValue(uidAttributes)
Beispiel #3
0
 def uid(self, uidIndex):
     if isinstance(self.value, ListModel):
         uids = []
         for value in self.value:
             if uidIndex in value.desc.uid:
                 uids.append(value.uid(uidIndex))
         return hashValue(uids)
     return super(ListAttribute, self).uid(uidIndex)
Beispiel #4
0
 def uid(self, uidIndex):
     uids = []
     for k, v in self._value.items():
         if v.enabled and uidIndex in v.desc.uid:
             uids.append(v.uid(uidIndex))
     return hashValue(uids)