Skip to content

Reference

ellipsize

Pretty reducing huge Python objects to visualise them nicely.

Classes

ellipsize.Dots

Bases: dict

Show dots inside Python objects repr.

Functions

ellipsize.format_ellipsized

format_ellipsized(obj: object, max_items_to_show: int = 10, max_item_length: int = 1024) -> str

Pformat ellipsized obj.

Use pprint.pformat to convert ellipsize result into string

Args: obj: Python object to ellipsize max_items_to_show: if List or Dict in obj (including nested) has more items, then show ".." instead of the rest items max_item_length: if List's or Dict's item are not another List/Dict and its string representation is longer, show ".." instead of the rest of it

ellipsize.print_ellipsized

print_ellipsized(*objs: object, max_items_to_show: int = 10, max_item_length: int = 1024, **kwargs: Any) -> None

Print ellipsized obj with pprint.

Can print many objects, like general print. Pass args to print like end.

Args: objs: Python objects to ellipsize max_items_to_show: if List or Dict in objs (including nested) has more items, then show ".." instead of the rest items max_item_length: if List's or Dict's item are not another List/Dict and its string representation is longer, show ".." instead of the rest of it

Modules

ellipsize.ellipsize

Visualize huge Python objects as nicely reduced strings.

Attributes
ellipsize.ellipsize.EllipsizedValue module-attribute
EllipsizedValue = Union[int, float, str, list['EllipsizedValue'], tuple['EllipsizedValue', ...], dict[Hashable, 'EllipsizedValue'], 'Dots']
Classes
ellipsize.ellipsize.Dots

Bases: dict

Show dots inside Python objects repr.

Functions
ellipsize.ellipsize.ellipsize
ellipsize(obj: object, max_items_to_show: int = 10, max_item_length: int = 1024) -> EllipsizedValue

Reduce huge list/dict to show on screen.

In lists (including dict items) show only 1st max_items_to_show and add ".." if there is more. Limit max dict/list length at max_item_length.

Args: obj: Python object to ellipsize max_items_to_show: if List or Dict in obj (including nested) has more items, then show ".." instead of the rest items max_item_length: if List's or Dict's item are not another List/Dict and its string representation is longer, show ".." instead of the rest of it

ellipsize.ellipsize.format_ellipsized
format_ellipsized(obj: object, max_items_to_show: int = 10, max_item_length: int = 1024) -> str

Pformat ellipsized obj.

Use pprint.pformat to convert ellipsize result into string

Args: obj: Python object to ellipsize max_items_to_show: if List or Dict in obj (including nested) has more items, then show ".." instead of the rest items max_item_length: if List's or Dict's item are not another List/Dict and its string representation is longer, show ".." instead of the rest of it

ellipsize.ellipsize.print_ellipsized
print_ellipsized(*objs: object, max_items_to_show: int = 10, max_item_length: int = 1024, **kwargs: Any) -> None

Print ellipsized obj with pprint.

Can print many objects, like general print. Pass args to print like end.

Args: objs: Python objects to ellipsize max_items_to_show: if List or Dict in objs (including nested) has more items, then show ".." instead of the rest items max_item_length: if List's or Dict's item are not another List/Dict and its string representation is longer, show ".." instead of the rest of it