law.target.formatter#
Formatter classes for file targets.
Class FormatterRegister
#
Class Formatter
#
Functions#
- get_formatter(name, silent=False)[source]#
Returns the formatter class whose name attribute is name. When no class could be found and silent is True, None is returned. Otherwise, an exception is raised.
- find_formatters(path, mode, silent=True)[source]#
Returns a list of formatter classes which would accept the file given by path and mode, which should either be
"load"
or"dump"
. When no classes could be found and silent is True, an empty list is returned. Otherwise, an exception is raised.
- find_formatter(path, mode, name='auto')[source]#
Returns the formatter class whose name attribute is name when name is not AUTO_FORMATTER. Otherwise, the first formatter that accepts path is returned. Internally, this method simply uses
get_formatter()
orfind_formatters()
depending on the value of name.