anyconfig.api._dump¶
Provides the API to dump (serialize) objects.
- anyconfig.api._dump.dump(data, out, ac_parser=None, **options)¶
Save
datatooutin specified or detected format.- Parameters:
data (
Union[None,int,float,bool,str,dict[str,Any]]) – A mapping object may have configurations data to dumpout (
Union[str,Path,IO,IOInfo]) – An output file path, a file, a file-like object,pathlib.Pathobject represents the file or a namedtuple ‘anyconfig.ioinfo.IOInfo’ object represents output to dump some data to.ac_parser (
Union[str,TypeVar(ParserT, bound=Parser),type[TypeVar(ParserT, bound=Parser)],None]) – Forced parser type or parser objectoptions (
Any) – Backend specific optional arguments, e.g. {“indent”: 2} for JSON loader/dumper backend
- Raises:
ValueError, UnknownProcessorTypeError, UnknownFileTypeError
- Return type:
None
- anyconfig.api._dump.dumps(data, ac_parser=None, **options)¶
Return a str representation of
datain specified format.- Parameters:
- Return type:
str- Returns:
Backend-specific string representation for the given data
- Raises:
ValueError, UnknownProcessorTypeError