idmtools.utils.display.displays module

class idmtools.utils.display.displays.IDisplaySetting(header: str = None, field: str = None)

Bases: object

Base class for a display setting. The child class needs to implement the display() method.

Includes:

  • header: Optional header for the display.

  • field: If specified, the get_object() will call getattr for this field on the object.

get_object(obj: Any) → Any
abstract display(obj: Any) → str

Display the object. Note that the attribute (identified by self.field) should be handled with get_object().

Parameters

obj – The object to consider for display.

Returns

A string representing what to show.

class idmtools.utils.display.displays.StringDisplaySetting(header: str = None, field: str = None)

Bases: idmtools.utils.display.displays.IDisplaySetting

Class that displays the object as string.

display(obj)

Display the object. Note that the attribute (identified by self.field) should be handled with get_object().

Parameters

obj – The object to consider for display.

Returns

A string representing what to show.

class idmtools.utils.display.displays.DictDisplaySetting(header: str = None, field: str = None, max_items: int = 10, flat: bool = False)

Bases: idmtools.utils.display.displays.IDisplaySetting

Class that displays a dictionary.

display(obj: Any) → str

Display the object. Note that the attribute (identified by self.field) should be handled with get_object().

Parameters

obj – The object to consider for display.

Returns

A string representing what to show.

class idmtools.utils.display.displays.TableDisplay(columns, max_rows=5, field=None)

Bases: idmtools.utils.display.displays.IDisplaySetting

Class that displays the object as a table.

display(obj)

Display the object. Note that the attribute (identified by self.field) should be handled with get_object().

Parameters

obj – The object to consider for display.

Returns

A string representing what to show.