vcorelib.io.mapping
index
/home/vkottler/src/vkottler/workspace/vcorelib/vcorelib/io/mapping.py

A module mapping file extensions to encoders and decoders.

 
Classes
       
builtins.object
DataMapping
builtins.tuple(builtins.object)
DataHandle
enum.Enum(builtins.object)
DataType

 
class DataHandle(builtins.tuple)
    DataHandle(decoder: Callable[[Union[TextIO, _io.StringIO], Union[logging.Logger, logging.LoggerAdapter[Any]]], vcorelib.io.types.LoadResult], encoder: Callable[[Dict[str, Union[str, int, float, bool, NoneType, Dict[str, Union[str, int, float, bool, NoneType]], List[Union[str, int, float, bool, NoneType]]]], Union[TextIO, _io.StringIO], Union[logging.Logger, logging.LoggerAdapter[Any]]], int])
 
A description of a data type.
 
 
Method resolution order:
DataHandle
builtins.tuple
builtins.object

Methods defined here:
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__repr__(self)
Return a nicely formatted representation string
_asdict(self)
Return a new dict which maps field names to their values.
_replace(self, /, **kwds)
Return a new DataHandle object replacing specified fields with new values

Class methods defined here:
_make(iterable) from builtins.type
Make a new DataHandle object from a sequence or iterable

Static methods defined here:
__new__(_cls, decoder: Callable[[Union[TextIO, _io.StringIO], Union[logging.Logger, logging.LoggerAdapter[Any]]], vcorelib.io.types.LoadResult], encoder: Callable[[Dict[str, Union[str, int, float, bool, NoneType, Dict[str, Union[str, int, float, bool, NoneType]], List[Union[str, int, float, bool, NoneType]]]], Union[TextIO, _io.StringIO], Union[logging.Logger, logging.LoggerAdapter[Any]]], int])
Create new instance of DataHandle(decoder, encoder)

Data descriptors defined here:
decoder
Alias for field number 0
encoder
Alias for field number 1

Data and other attributes defined here:
__annotations__ = {'decoder': typing.Callable[[typing.Union[typing.TextIO, _io...pter[typing.Any]]], vcorelib.io.types.LoadResult], 'encoder': typing.Callable[[typing.Dict[str, typing.Union[s...Logger, logging.LoggerAdapter[typing.Any]]], int]}
__match_args__ = ('decoder', 'encoder')
__orig_bases__ = (<function NamedTuple>,)
_field_defaults = {}
_fields = ('decoder', 'encoder')

Methods inherited from builtins.tuple:
__add__(self, value, /)
Return self+value.
__contains__(self, key, /)
Return bool(key in self).
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__getitem__(self, key, /)
Return self[key].
__gt__(self, value, /)
Return self>value.
__hash__(self, /)
Return hash(self).
__iter__(self, /)
Implement iter(self).
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__mul__(self, value, /)
Return self*value.
__ne__(self, value, /)
Return self!=value.
__rmul__(self, value, /)
Return value*self.
count(self, value, /)
Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
 
Raises ValueError if the value is not present.

Class methods inherited from builtins.tuple:
__class_getitem__(...) from builtins.type
See PEP 585

 
class DataMapping(builtins.object)
    Map interfaces that read and write data formats to the file extensions
that most-likely indicate the desire for that kind of format.
 
  Static methods defined here:
from_ext(ext: vcorelib.io.types.FileExtension = None) -> Optional[ForwardRef('DataType')]
Map a file extension to a data type.
from_ext_str(ext: str) -> Optional[ForwardRef('DataType')]
Get a data type from a file-extension string.

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

Data and other attributes defined here:
mapping = {<FileExtension.INI: ['ini', 'cfg']>: <DataType.INI: DataHandle(decoder=<function deco...encoder=<function encode_ini at 0x7fc39d319940>)>, <FileExtension.JSON: ['json']>: <DataType.JSON: DataHandle(decoder=<function dec...ncoder=<function encode_json at 0x7fc39d319760>)>, <FileExtension.YAML: ['yaml', 'yml', 'eyaml']>: <DataType.YAML: DataHandle(decoder=<function dec...ncoder=<function encode_yaml at 0x7fc39d3198a0>)>, <FileExtension.TOML: ['toml']>: <DataType.TOML: DataHandle(decoder=<function dec...ncoder=<function encode_toml at 0x7fc39d3199e0>)>}

 
class DataType(enum.Enum)
    DataType(*values)
 
An aggregation of all known data types.
 
 
Method resolution order:
DataType
enum.Enum
builtins.object

Data and other attributes defined here:
INI = <DataType.INI: DataHandle(decoder=<function deco...encoder=<function encode_ini at 0x7fc39d319940>)>
JSON = <DataType.JSON: DataHandle(decoder=<function dec...ncoder=<function encode_json at 0x7fc39d319760>)>
TOML = <DataType.TOML: DataHandle(decoder=<function dec...ncoder=<function encode_toml at 0x7fc39d3199e0>)>
YAML = <DataType.YAML: DataHandle(decoder=<function dec...ncoder=<function encode_yaml at 0x7fc39d3198a0>)>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Methods inherited from enum.EnumType:
__contains__(value) from enum.EnumType
Return True if `value` is in `cls`.
 
`value` is in `cls` if:
1) `value` is a member of `cls`, or
2) `value` is the value of one of the `cls`'s members.
__getitem__(name) from enum.EnumType
Return the member matching `name`.
__iter__() from enum.EnumType
Return members in definition order.
__len__() from enum.EnumType
Return the number of members (no aliases)

Readonly properties inherited from enum.EnumType:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.