fgen_runtime.formatting#

Formatting of fgen wrapped objects

get_attribute_str_value#

get_attribute_str_value(instance, attribute)[source]#

Get the string version of an attribute’s value

Parameters:
Returns:

str – String version of the attribute’s value, with graceful handling of errors.

to_str#

to_str(instance, exposed_attributes)[source]#

Convert an instance to its string representation

Parameters:
Returns:

str – String representation of the instance

to_pretty#

to_pretty(instance, exposed_attributes, p, cycle, indent=4)[source]#

Pretty-print an instance

Parameters:
Return type:

None

add_attribute_row#

add_attribute_row(attribute_name, attribute_value, attribute_rows)[source]#

Add a row for displaying an attribute’s value to a list of rows

Parameters:
  • attribute_name (str) – Attribute’s name

  • attribute_value (str) – Attribute’s value

  • attribute_rows (list[str]) – Existing attribute rows

Returns:

list[str] – Attribute rows, with the new row appended

to_html#

to_html(instance, exposed_attributes)[source]#

Convert an instance to its html representation

Parameters:
Returns:

str – HTML representation of the instance