collection
Module to define the CelonisCollection.
This module defines the CelonisCollection used in PyCelonis to facilitate searching objects by their attributes.
Typical usage example
CelonisCollection ¶
Bases: typing.List[T]
Class to make lists searchable.
from_list
classmethod
¶
Convert list to Celonis Collection.
Parameters:
-
list_
(
typing.List) –List to convert.
Returns:
-
CelonisCollection–CelonisCollection from given list.
find_all ¶
Return all objects with matching search_attribute for given search_term.
Parameters:
-
search_term
(
typing.Any) –Term to search for within objects of collection.
-
search_attribute
(
str) –Attribute of objects to search, default 'name'.
Returns:
-
CelonisCollection[T]–CelonisCollection with matching objects.
find ¶
Return single object with matching search_attribute for given search_term.
Parameters:
-
search_term
(
typing.Any) –Term to search for within objects of collection.
-
search_attribute
(
str) –Attribute of objects to search, default 'name'.
-
default
(
typing.Optional[T]) –Default to return if no matching object found. If no default PyCelonisNotFoundError is raised if no object found.
Returns:
-
T–Object matching
search_termforsearch_attribute.
Raises:
-
PyCelonisNotFoundError–Raised if no object in collection matches
search_termforsearch_attributeand no default given. -
PyCelonisValueError–Raised if multiple objects in collection match
search_termforsearch_attribute.