anyconfig.backend.python.builtin

A backend module to load and dump python code conntains data.

  • Format to support: Python code

  • Requirements: None (built-in)

  • Development Status :: 3 - Alpha

  • Limitations:

    • This module will load data as it is. In other words, some options like ac_dict and ac_ordered do not affetct at all.

    • Some primitive data expressions support only

    • It might have some vulnerabilities for DoS and aribitary code execution (ACE) attacks

    • It’s very simple and should be difficult to dump complex data using this

  • Special options:

    • allow_exec: bool [False]: Allow execution of the input python code on load input files. It may cause vulnerabilities for aribitary code execution (ACE) attacks. So you should set True only if you sure inputs are safe from reliable sources.

Changelog:

Added in version 0.14.0:

  • Added builtin data loader from python code

class anyconfig.backend.python.builtin.Parser

Bases: Parser, Loader, Dumper

Parser for python code files.

_cid: ClassVar[str] = 'python.builtin'
_type: ClassVar[str] = 'python'
_extensions: tuple[str, ...] = ('py',)
__annotations__ = {'_allow_primitives': 'typing.ClassVar[bool]', '_cid': 'typing.ClassVar[str]', '_dict_opts': 'tuple[str, ...]', '_dump_opts': 'tuple[str, ...]', '_extensions': 'tuple[str, ...]', '_load_opts': 'tuple[str, ...]', '_open_read_mode': 'typing.ClassVar[str]', '_open_write_mode': 'typing.ClassVar[str]', '_ordered': 'typing.ClassVar[bool]', '_priority': 'typing.ClassVar[int]', '_type': 'typing.ClassVar[str]'}
__module__ = 'anyconfig.backend.python.builtin'