Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform. Should be called from the constructor of any transforms that depend on other transforms.
(self, *children)
| 176 | parent._invalidate_internal(level=level, invalidating_node=self) |
| 177 | |
| 178 | def set_children(self, *children): |
| 179 | """ |
| 180 | Set the children of the transform, to let the invalidation |
| 181 | system know which transforms can invalidate this transform. |
| 182 | Should be called from the constructor of any transforms that |
| 183 | depend on other transforms. |
| 184 | """ |
| 185 | # Parents are stored as weak references, so that if the |
| 186 | # parents are destroyed, references from the children won't |
| 187 | # keep them alive. |
| 188 | id_self = id(self) |
| 189 | for child in children: |
| 190 | # Use weak references so this dictionary won't keep obsolete nodes |
| 191 | # alive; the callback deletes the dictionary entry. This is a |
| 192 | # performance improvement over using WeakValueDictionary. |
| 193 | ref = weakref.ref( |
| 194 | self, lambda _, pop=child._parents.pop, k=id_self: pop(k)) |
| 195 | child._parents[id_self] = ref |
| 196 | |
| 197 | def frozen(self): |
| 198 | """ |
no outgoing calls
no test coverage detected