utils
Module¶
- class tallypi.utils.SetProperty(default=None, copy_on_change=False)[source]¶
Bases:
pydispatch.properties.Property
Property with a
set
type value- Parameters
default (Optional) – If supplied, this will be the default value of the Property for all instances of the class. Otherwise
None
copy_on_change (bool, optional) – If
True
, the set will be copied when contents are modified. This can be useful for observing the original state of the set from within callbacks. The copied (original) state will be available from the keyword argument ‘old’. The default isFalse
(for performance and memory reasons).
Changes to the contents of the set are able to be observed through
ObservableSet
.
- class tallypi.utils.ObservableSet(initset=None, **kwargs)[source]¶
Bases:
set
,pydispatch.properties.Observable
A
set
subclass that tracks changes to its contents- discard(item)[source]¶
Remove an element from a set if it is a member.
If the element is not a member, do nothing.