16 from .normalizing
import NormalizedDict
17 from .robottypes
import is_string
32 def __init__(self, no_current_msg='No open connection.'):
39 current_index = property
44 for index, conn
in enumerate(self):
52 if index
is not None else self.
_no_current_no_current
65 self.
currentcurrent = connection
96 if alias_or_index
is None:
98 self.
currentcurrent.raise_error()
102 except ValueError
as err:
106 __getitem__ = get_connection
116 getattr(conn, closer_method)()
141 return resolver(alias_or_index)
144 raise ValueError(f
"Non-existing index or alias '{alias_or_index}'.")
170 if name.startswith(
'__')
and name.endswith(
'__'):
Cache for libraries to use with concurrent connections, processes, etc.
def empty_cache(self)
Empties the connection cache.
def _resolve_alias(self, alias)
def get_connection(self, alias_or_index=None)
Get the connection specified by the given alias or index.
def switch(self, alias_or_index)
Switches to the connection specified by the given alias or index.
def _resolve_index(self, index)
def __init__(self, no_current_msg='No open connection.')
def close_all(self, closer_method='close')
Closes connections using given closer method and empties cache.
def resolve_alias_or_index(self, alias_or_index)
def register(self, connection, alias=None)
Registers given connection with optional alias and returns its index.
def _is_connection(self, conn)
def __getattr__(self, name)
def __init__(self, message)
Custom dictionary implementation automatically normalizing keys.