anyconfig.parsers.utils¶
Internal APIs to load, list and find parser class objects.
- anyconfig.parsers.utils.load_plugins()¶
[Re-]Load pluggable processors.
- Return type:
None
- anyconfig.parsers.utils.list_types()¶
List supported processor types.
- Return type:
list[str]
- anyconfig.parsers.utils.list_by_cid()¶
List processors by each cid.
- Return type:
list[tuple[str,list[TypeVar(ParserT, bound=Parser)]]]
- anyconfig.parsers.utils.list_by_type()¶
List processor by eacch type.
- Return type:
list[tuple[str,list[TypeVar(ParserT, bound=Parser)]]]
- anyconfig.parsers.utils.list_by_extension()¶
List processor by file extension supported.
- Return type:
list[tuple[str,list[TypeVar(ParserT, bound=Parser)]]]
- anyconfig.parsers.utils.findall(obj=None, forced_type=None)¶
Find out processor objects can process data from given
obj.objmay be a file path, file or file-like object, pathlib.Path object or an ‘anyconfig.ioinfo.IOInfo’ (namedtuple) object.- Parameters:
obj (
Union[str,Path,IO,IOInfo,None]) – a file path, file or file-like object, pathlib.Path object, an ‘anyconfig.ioinfo.IOInfo’ (namedtuple) object, or Noneforced_type (
str|None) – Forced type or id of the processor
- Return type:
list[TypeVar(ParserT, bound=Parser)]- Returns:
A list of instances of processor classes to process ‘obj’
- Raises:
ValueError, UnknownProcessorTypeError, UnknownFileTypeError
- anyconfig.parsers.utils.find(obj=None, forced_type=None)¶
Very similar to the above
findall().However it returns a processor object instead of a list of processor objects.
- Parameters:
obj (
Union[str,Path,IO,IOInfo,None]) – a file path, file or file-like object, pathlib.Path object, an ‘anyconfig.ioinfo.IOInfo’ (namedtuple) object, or Noneforced_type (
Union[str,TypeVar(ParserT, bound=Parser),type[TypeVar(ParserT, bound=Parser)],None]) – Forced type or id of the processor
- Return type:
TypeVar(ParserT, bound=Parser)- Returns:
An instance of processor class of highest priority to process ‘obj’
- Raises:
ValueError, UnknownProcessorTypeError, UnknownFileTypeError