runtimepy.mapping
index
/home/vkottler/src/vkottler/workspace/runtimepy/runtimepy/mapping.py

A module implementing a generic, two-way mapping interface.

 
Classes
       
runtimepy.mixins.regex.RegexMixin(builtins.object)
TwoWayNameMapping(runtimepy.mixins.regex.RegexMixin, vcorelib.logging.LoggerMixin, typing.Generic)
typing.Generic(builtins.object)
TwoWayNameMapping(runtimepy.mixins.regex.RegexMixin, vcorelib.logging.LoggerMixin, typing.Generic)
vcorelib.logging.LoggerMixin(builtins.object)
TwoWayNameMapping(runtimepy.mixins.regex.RegexMixin, vcorelib.logging.LoggerMixin, typing.Generic)

 
class TwoWayNameMapping(runtimepy.mixins.regex.RegexMixin, vcorelib.logging.LoggerMixin, typing.Generic)
    TwoWayNameMapping(mapping: MutableMapping[~T, str] = None, reverse: MutableMapping[str, ~T] = None) -> None
 
A class interface for managing two-way mappings.
 
 
Method resolution order:
TwoWayNameMapping
runtimepy.mixins.regex.RegexMixin
vcorelib.logging.LoggerMixin
typing.Generic
builtins.object

Methods defined here:
__init__(self, mapping: MutableMapping[~T, str] = None, reverse: MutableMapping[str, ~T] = None) -> None
Initialize this name registry.
asdict(self) -> dict[str, ~T]
Provide a dictionary representation.
identifier(self, key: Union[str, ~T]) -> Optional[~T]
Get the integer identifier associated with a registry key.
load_key_to_name(self, mapping: MutableMapping[~T, str]) -> None
Load a key-to-name mapping.
load_name_to_key(self, reverse: MutableMapping[str, ~T]) -> None
Load a name-to-key mapping.
name(self, key: Union[str, ~T]) -> Optional[str]
Get the name associated with a registry key.
search(self, pattern: str, exact: bool = False) -> Iterator[str]
Get names in this mapping based on a pattern.

Class methods defined here:
bool_from_dict(data: MutableMapping[Union[str, bool], Union[str, bool]]) -> ~BoolMapping from builtins.type
Create a boolean-to-name mapping from a dictionary with arbitrary data.
int_from_dict(data: MutableMapping[Union[str, int], Union[str, int]]) -> ~IntMapping from builtins.type
Create an integer-to-name mapping from a dictionary with arbitrary
data.

Readonly properties defined here:
names
Iterate over names.

Data and other attributes defined here:
__annotations__ = {}
__orig_bases__ = (<class 'runtimepy.mixins.regex.RegexMixin'>, <class 'vcorelib.logging.LoggerMixin'>, typing.Generic[~T])
__parameters__ = (~T,)

Class methods inherited from runtimepy.mixins.regex.RegexMixin:
validate_name(name: str, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = None) -> bool from builtins.type
Determine if a name is valid for this class.

Data descriptors inherited from runtimepy.mixins.regex.RegexMixin:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

Data and other attributes inherited from runtimepy.mixins.regex.RegexMixin:
name_regex = re.compile('^[\\w\\:.-]+$')

Methods inherited from vcorelib.logging.LoggerMixin:
log_time(self, message: str, *args, level: int = 20, reminder: bool = False, **kwargs) -> Iterator[NoneType]
A simple wrapper.

Class methods inherited from typing.Generic:
__class_getitem__(...) from builtins.type
Parameterizes a generic class.
 
At least, parameterizing a generic class is the *main* thing this
method does. For example, for some generic class `Foo`, this is called
when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
 
However, note that this method is also called when defining generic
classes in the first place with `class Foo[T]: ...`.
__init_subclass__(...) from builtins.type
Function to initialize subclasses.

 
Data
        BoolMapping = ~BoolMapping
BoolMappingData = typing.MutableMapping[typing.Union[str, bool], typing.Union[str, bool]]
DEFAULT_PATTERN = '.*'
EnumMappingData = typing.Union[typing.MutableMapping[typing.Union[...ping[str, bool], typing.MutableMapping[str, int]]
IntMapping = ~IntMapping
IntMappingData = typing.MutableMapping[typing.Union[str, int], typing.Union[str, int]]
Iterator = typing.Iterator
KeyToName = typing.MutableMapping[~T, str]
MappingKey = typing.Union[str, ~T]
NameToKey = typing.MutableMapping[str, ~T]
T = ~T