class documentation

class TypedSearchAttributes(Collection[SearchAttributePair]): (source)

View In Hierarchy

Collection of typed search attributes.

This is represented as an immutable collection of SearchAttributePair. This can be created passing a sequence of pairs to the constructor.

Method __contains__ Check whether this search attribute contains the given key.
Method __getitem__ Get a single search attribute value by key or fail with KeyError.
Method __iter__ Get an iterator over search attribute key/value pairs.
Method __len__ Get the number of search attributes.
Method __post_init__ Post-init initialization.
Method get Get an attribute value for a key (or default). This is similar to dict.get.
Method updated Copy this collection, replacing attributes with matching key names or adding if key name not present.
Class Variable empty Class variable representing an empty set of attributes.
Class Variable search_attributes Underlying sequence of search attribute pairs. Do not mutate this, only create new TypedSearchAttribute instances.
def __contains__(self, key: object) -> bool: (source)

Check whether this search attribute contains the given key.

This uses key equality so the key must be the same name and type.

Get a single search attribute value by key or fail with KeyError.

Get an iterator over search attribute key/value pairs.

def __len__(self) -> int: (source)

Get the number of search attributes.

def __post_init__(self): (source)

Post-init initialization.

def updated(self, *search_attributes: SearchAttributePair) -> TypedSearchAttributes: (source)

Copy this collection, replacing attributes with matching key names or adding if key name not present.

Class variable representing an empty set of attributes.

Underlying sequence of search attribute pairs. Do not mutate this, only create new TypedSearchAttribute instances.

These are sorted by key name during construction. Duplicates cannot exist.