pyappconf.encoding package

Submodules

pyappconf.encoding.ext_json module

class pyappconf.encoding.ext_json.ExtendedJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
Return type:

Any

pyappconf.encoding.ext_toml module

class pyappconf.encoding.ext_toml.CustomTomlEncoder(*args: Any, **kwargs: Any)[source]

Bases: TomlEncoder

__init__(_dict=<class 'dict'>, preserve=False)[source]
dump_value(v)[source]

Overrides TomlEncoder.dump_value to adds support for putting a base class in multi_dump_funcs and have it be used for any subclass of that type

multi_dump_funcs: Dict[Type, Callable[[Any], str]]

pyappconf.encoding.ext_yaml module

class pyappconf.encoding.ext_yaml.CustomDumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]

Bases: Emitter, Serializer, CustomRepresenter, Resolver

__init__(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]
class pyappconf.encoding.ext_yaml.CustomRepresenter(default_style=None, default_flow_style=False, sort_keys=True)[source]

Bases: SafeRepresenter

yaml_multi_representers = {<enum 'Enum'>: <function _represent_enum>, <class 'uuid.UUID'>: <function _represent_uuid>}
yaml_representers = {<class 'NoneType'>: <function SafeRepresenter.represent_none>, <class 'str'>: <function SafeRepresenter.represent_str>, <class 'bytes'>: <function SafeRepresenter.represent_binary>, <class 'bool'>: <function SafeRepresenter.represent_bool>, <class 'int'>: <function SafeRepresenter.represent_int>, <class 'float'>: <function SafeRepresenter.represent_float>, <class 'list'>: <function SafeRepresenter.represent_list>, <class 'tuple'>: <function SafeRepresenter.represent_list>, <class 'dict'>: <function SafeRepresenter.represent_dict>, <class 'set'>: <function SafeRepresenter.represent_set>, <class 'datetime.date'>: <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>: <function SafeRepresenter.represent_datetime>, None: <function SafeRepresenter.represent_undefined>, <class 'pathlib.Path'>: <function _represent_hasstr>, <class 'pathlib.PosixPath'>: <function _represent_hasstr>}

pyappconf.encoding.general module

class pyappconf.encoding.general.HasStr(*args, **kwargs)[source]

Bases: Protocol

__init__(*args, **kwargs)