weboob.tools.application.formatters.iformatter

class weboob.tools.application.formatters.iformatter.IFormatter(display_keys=True, display_header=True, outfile=None)

Bases: object

BOLD = '\x1b[1m'
DISPLAYED_FIELDS = None
MANDATORY_FIELDS = None
NC = '\x1b[0m'
colored(string, color, attrs=None, on_color=None)
flush()
format(obj, selected_fields=None, alias=None)

Format an object to be human-readable. An object has fields which can be selected.

Parameters:
  • obj (BaseObject or dict) – object to format
  • selected_fields (tuple) – fields to display. If None, all fields are selected
  • alias (unicode) – an alias to use instead of the object’s ID
format_collection(collection, only)

Format a collection to be human-readable.

Parameters:collection (BaseCollection) – collection to format
Return type:str
format_dict(obj)

Format a dict to be human-readable.

Parameters:obj (dict) – dict to format
Return type:str
format_obj(obj, alias=None)

Format an object to be human-readable. Called by format(). This method has to be overridden in child classes.

Parameters:obj (BaseObject) – object to format
Return type:str
output(formatted)
start_format(**kwargs)
exception weboob.tools.application.formatters.iformatter.MandatoryFieldsNotFound(missing_fields)

Bases: exceptions.Exception