woob.tools.application.formatters.iformatter
¶
- class IFormatter(display_keys=True, display_header=True, outfile=None)[source]¶
Bases:
object
- MANDATORY_FIELDS = None¶
- DISPLAYED_FIELDS = None¶
- BOLD = '\x1b[1m'¶
- NC = '\x1b[0m'¶
- format(obj, selected_fields=None, alias=None)[source]¶
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 (default:
None
)alias (str) – an alias to use instead of the object’s ID (default:
None
)
- format_obj(obj, alias=None)[source]¶
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:
- format_collection(collection, only)[source]¶
Format a collection to be human-readable.
- Parameters:
collection (BaseCollection) – collection to format
- Return type: