Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Settings.ContainerQuery.ContainerQuery Class Reference

Public Member Functions

None __init__ (self, "ContainerRegistry" registry, *ignore_case=False, **Any kwargs)
 
Optional[type] getContainerType (self)
 
Optional[List[Dict[str, Any]]] getResult (self)
 
bool isIdOnly (self)
 
None execute (self, Optional[List[Any]] candidates=None)
 
 __str__ (self)
 

Static Public Attributes

dict cache = {}
 
 OPTIONS_REGEX = re.compile("^\\[[a-zA-Z0-9-_\\+\\. ]+(\\|[a-zA-Z0-9-_\\+\\. ]+)*\\]$")
 

Protected Member Functions

 _matchDirect (self, Dict[str, Any] metadata, str property_name, str value)
 
 _matchRegExp (self, Dict[str, Any] metadata, str property_name, str value)
 
 _matchRegMultipleTokens (self, Dict[str, Any] metadata, str property_name, str value)
 
bool _matchString (self, Dict[str, Any] metadata, str property_name, str value)
 
 _matchType (self, Dict[str, Any] metadata, str property_name, Type[Any] value)
 

Protected Attributes

 _registry
 
 _ignore_case
 
 _kwargs
 
 _result
 

Detailed Description

Wrapper class to perform a search for a certain set of containers.

This class is primarily intended to be used internally by
ContainerRegistry::findContainers. It is used to perform the actual
searching for containers and cache the results.

:note Instances of this class will ignore the query results when
comparing. This is done to simplify the caching code in ContainerRegistry.

Constructor & Destructor Documentation

◆ __init__()

None UM.Settings.ContainerQuery.ContainerQuery.__init__ ( self,
"ContainerRegistry" registry,
* ignore_case = False,
**Any kwargs )
Constructor

:param registry: The ContainerRegistry instance this query operates on.
:param container_type: A specific container class that should be filtered for.
:param ignore_case: Whether or not the query should be case sensitive.
:param kwargs: A dict of key, value pairs that should be searched for.

Member Function Documentation

◆ __str__()

UM.Settings.ContainerQuery.ContainerQuery.__str__ ( self)
Human-readable string representation for debugging.

◆ execute()

None UM.Settings.ContainerQuery.ContainerQuery.execute ( self,
Optional[List[Any]] candidates = None )
Execute the actual query.

This will search the container metadata of the ContainerRegistry based
on the arguments provided to this class' constructor. After it is done,
the result can be retrieved with getResult().

◆ getContainerType()

Optional[type] UM.Settings.ContainerQuery.ContainerQuery.getContainerType ( self)
Get the class of the containers that this query should find, if any.

If the query doesn't filter on container type, `None` is returned.

◆ getResult()

Optional[List[Dict[str, Any]]] UM.Settings.ContainerQuery.ContainerQuery.getResult ( self)
Retrieve the result of this query.

:return: A list of containers matching this query, or None if the query was not executed.

◆ isIdOnly()

bool UM.Settings.ContainerQuery.ContainerQuery.isIdOnly ( self)
Check to see if this is a very simple query that looks up a single container by ID.

:return: True if this query is case sensitive, has only 1 thing to search for and that thing is "id".

The documentation for this class was generated from the following file: