NamedValueMutableSet¶
-
class
lsst.daf.butler.NamedValueMutableSet¶ Bases:
lsst.daf.butler.NamedValueAbstractSet,collections.abc.MutableSet,typing.GenericAn abstract base class that adds mutation interfaces to
NamedValueAbstractSet.Methods that can add new elements to the set are unchanged from their
MutableSetdefinitions, while those that only remove them can generally accept names or element instances.popcan be used in either itsMutableSetform (no arguments; an arbitrary element is returned) or itsMutableMappingform (one or two arguments for the name and optional default value, respectively). AMutableMapping-like__delitem__interface is also included, which takes only names (likeNamedValueAbstractSet.__getitem__).Attributes Summary
namesThe set of names associated with the keys, in the same order ( AbstractSet[str]).Methods Summary
add(value)Add an element. asMapping()Return a mapping view with names as keys. clear()This is slow (creates N new iterators!) but effective. discard(element, K])Remove an element from the set if it exists. get(key, K_co], default)Return the element with the given name, or defaultif no such element is present.isdisjoint(other)Return True if two sets have a null intersection. pop(*args)Remove and return an element from the set. remove(element, K])Remove an element from the set. Attributes Documentation
Methods Documentation
-
add(value)¶ Add an element.
-
asMapping() → Mapping[str, K_co]¶ Return a mapping view with names as keys.
Returns: - dict :
Mapping A dictionary-like view with
values() == self.
- dict :
-
clear()¶ This is slow (creates N new iterators!) but effective.
-
discard(element: Union[str, K]) → Any¶ Remove an element from the set if it exists.
Does nothing if no matching element is present.
Parameters:
-
get(key: Union[str, K_co], default: Optional[Any] = None) → Any¶ Return the element with the given name, or
defaultif no such element is present.
-
isdisjoint(other)¶ Return True if two sets have a null intersection.
-
pop(*args) → K¶ Remove and return an element from the set.
Parameters: - name :
str, optional Name of the element to remove and return. Must be passed positionally. If not provided, an arbitrary element is removed and returned.
Raises: - KeyError
Raised if
nameis provided butdefaultis not, and no matching element exists.
- name :
-