ftrack_api.formatter

ftrack_api.formatter.FILTER = {'ignore_unset': <function <lambda>>}

Useful filters to pass to format().`

ftrack_api.formatter.format(entity, formatters=None, attribute_filter=None, recursive=False, indent=0, indent_first_line=True, _seen=None)[source]

Return formatted string representing entity.

formatters can be used to customise formatting of elements. It should be a mapping with one or more of the following keys:

  • header - Used to format entity type.

  • label - Used to format attribute names.

Specify an attribute_filter to control which attributes to include. By default all attributes are included. The attribute_filter should be a callable that accepts (entity, attribute_name, attribute_value) and returns True if the attribute should be included in the output. For example, to filter out all unset values:

attribute_filter=ftrack_api.formatter.FILTER['ignore_unset']

If recursive is True then recurse into Collections and format each entity present.

indent specifies the overall indentation in spaces of the formatted text, whilst indent_first_line determines whether to apply that indent to the first generated line.

Warning

Iterates over all entity attributes which may cause multiple queries to the server. Turn off auto populating in the session to prevent this.