PIconnect.Search module#

Search the AF database for different objects.

class PIconnect.Search.AttributeSearchResult(search: AFAttributeSearch)#

Bases: SearchResult[AFAttribute, AFAttribute]

Container for attribute search results.

one() AFAttribute#

Return the only item in the search result.

Returns:

The only item in the search result.

Return type:

SearchResultType

Raises:

ValueError – If there are no results or more than one result.

to_list() AFAttributeList#

Return all items in the search result in a sequence.

property count: int#

Return the number of items in the search result.

property name: str#

Return the name of the search result.

class PIconnect.Search.ElementSearchResult(search: AFElementSearch)#

Bases: SearchResult[AFElement, AFElement]

Container for attribute search results.

one() AFElement#

Return the only item in the search result.

Returns:

The only item in the search result.

Return type:

SearchResultType

Raises:

ValueError – If there are no results or more than one result.

to_list() AFElementList#

Return all items in the search result in a sequence.

property count: int#

Return the number of items in the search result.

property name: str#

Return the name of the search result.

class PIconnect.Search.EventFrameSearchResult(search: AFEventFrameSearch)#

Bases: SearchResult[AFEventFrame, AFEventFrame]

Container for attribute search results.

one() AFEventFrame#

Return the only item in the search result.

Returns:

The only item in the search result.

Return type:

SearchResultType

Raises:

ValueError – If there are no results or more than one result.

to_list() AFEventFrameList#

Return all items in the search result in a sequence.

property count: int#

Return the number of items in the search result.

property name: str#

Return the name of the search result.

class PIconnect.Search.Search(database: AFDatabase)#

Bases: object

Search the AF database for different objects.

attributes(query: str, query_name: str = 'attribute_search') AttributeSearchResult#

Search for elements in the AF database.

elements(query: str, query_name: str = 'element_search') ElementSearchResult#

Search for elements in the AF database.

event_frames(query: str, query_name: str = 'event_frame_search') EventFrameSearchResult#

Search for event frames in the AF database.

class PIconnect.Search.SearchResult(search: AFSearch[AFSearchResultType])#

Bases: Generic[AFSearchResultType, SearchResultType], ABC

Container for search results.

one() SearchResultType#

Return the only item in the search result.

Returns:

The only item in the search result.

Return type:

SearchResultType

Raises:

ValueError – If there are no results or more than one result.

abstractmethod to_list() Sequence[SearchResultType]#

Return all items in the search result in a sequence.

property count: int#

Return the number of items in the search result.

property name: str#

Return the name of the search result.