anyconfig.backends

A module to aggregate config parser (loader/dumper) backends.

class anyconfig.backends.Parsers(processors=None)

Bases: anyconfig.processors.Processors, anyconfig.singleton.Singleton

Manager class for parsers.

find_by_type_or_id(ptype)

Find parser object to process data of given type or by its ID.

Parameters:ptype – Forced parser type or ID or parser class or its instance
Returns:An instance of Parser
Raises:UnknownProcessorTypeError
find(obj, forced_type=None, cls=<class 'anyconfig.models.processor.Processor'>)

Find appropriate parser object to process given obj.

Parameters:
  • obj – a file path, file or file-like object, pathlib.Path object or ~anyconfig.globals.IOInfo (namedtuple) object
  • forced_type – Forced parser type or ID
Returns:

Parser object

Raises:

ValueError, UnknownProcessorTypeError, UnknownFileTypeError

list_types()

List available types parsers support.