pg.Formattable

Accessible via pg.Formattable, pg.object_utils.Formattable.

class Formattable[source]

Bases: object

Interface for classes whose instances can be pretty-formatted.

This interface overrides the default __repr__ and __str__ method, thus all Formattable objects can be printed nicely.

All symbolic types implement this interface.

Methods:

format([compact, verbose, root_indent])

Formats this object into a string representation.

abstract format(compact=False, verbose=True, root_indent=0, **kwargs)[source]

Formats this object into a string representation.

Return type:

str

Parameters:
  • compact – If True, this object will be formatted into a single line.

  • verbose – If True, this object will be formatted with verbosity. Subclasses should define verbosity on their own.

  • root_indent – The start indent level for this object if the output is a multi-line string.

  • **kwargs – Subclass specific keyword arguments.

Returns:

A string of formatted object.