NamedValueSet¶
- 
class lsst.daf.butler.core.utils.NamedValueSet(elements: Iterable[T] = ())¶
- Bases: - collections.abc.MutableSet,- typing.Generic- A custom mutable set class that requires elements to have a - .nameattribute, which can then be used as keys in- dict-like lookup.- Names and elements can both be used with the - inand- deloperators,- remove, and- discard. Names (but not elements) can be used with- []-based element retrieval (not assignment) and the- getmethod.- popcan be used in either its- MutableSetform (no arguments; an arbitrary element is returned) or its- MutableMappingform (one or two arguments for the name and optional default value, respectively).- Parameters: - elements : iterable
- Iterable over elements to include in the set. 
 - Raises: - AttributeError
- Raised if one or more elements do not have a - .nameattribute.
 - Notes - Iteration order is guaranteed to be the same as insertion order (with the same general behavior as - dictordering). Like- dicts, sets with the same elements will compare as equal even if their iterator order is not the same.- Attributes Summary - names- The set of element names, in the same order ( - KeysView).- Methods Summary - add(element)- Add an element to the set. - asDict()- Return a mapping view with names as keys. - clear()- This is slow (creates N new iterators!) but effective. - copy()- discard(element, T])- Remove an element from the set if it exists. - freeze()- Disable all mutators, effectively transforming - selfinto an immutable set.- get(name[, 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. - issubset(other)- issuperset(other)- pop(*args)- Remove and return an element from the set. - remove(element, T])- Remove an element from the set. - Attributes Documentation - Methods Documentation - 
add(element: T)¶
- Add an element to the set. - Raises: - AttributeError
- Raised if the element does not have a - .nameattribute.
 
 - 
asDict() → Mapping[str, T]¶
- 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. 
 - 
copy() → lsst.daf.butler.core.utils.NamedValueSet[~T][T]¶
 - 
discard(element: Union[str, T])¶
- Remove an element from the set if it exists. - Does nothing if no matching element is present. - Parameters: 
 - 
freeze()¶
- Disable all mutators, effectively transforming - selfinto an immutable set.
 - 
get(name: str, default=None)¶
- 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. 
 - 
issubset(other)¶
 - 
issuperset(other)¶
 - 
pop(*args)¶
- Remove and return an element from the set. - Parameters: - Raises: - KeyError
- Raised if - nameis provided but- defaultis not, and no matching element exists.
 
 
- elements :