exopy.utils.container_change module¶
Payload to use when notifying the system about a container change.
-
class
exopy.utils.container_change.
ContainerChange
[source]¶ Bases:
atom.atom.Atom
Payload to use when notifying the system about a container change.
-
obj
¶ Reference to object from which this event originate.
-
name
¶ Name of the modified container.
-
added
¶ List of added entries. Should not be manipulated directly by user code. Use the add_operation method to add operations.
-
moved
¶ List of moved entries with their old and new positions. Should not be manipulated directly by user code. Use the add_operation method to add operations.
-
removed
¶ List of removed entries. Should not be manipulated directly by user code. Use the add_operation method to add operations.
-
collapsed
¶ List of ContainerChange representing an ordered sequence of change.
-
add_operation
(typ, op_desc)[source]¶ Add an operation.
If two operations of different types they are represented by two ContainerChange added in the collapsed list. Using this method ensure that only one list is non empty. Consumer should always check the collapsed list first.
- Parameters
typ (
{'added', 'moved', removed'}
) – The type of operation to add to the change set.op_desc (
tuple
) –Tuple describing the operation it should be of the form:
’added’ : (index, obj)
’moved’ : (old_index, new_index, obj)
’removed’ : (index, obj)
-