Utilities

jade_utils.human_tools Tools to make things more human readable.
jade_utils.iris_tools

Human Tools

Tools to make things more human readable.

jade_utils.human_tools.human_bytes(num, suffix='B', use_binary_prefix=True)[source]

Provide a human readable representation of a specified number of bytes.

Convert a number of bytes into a higher order representation such as megabytes or gigabytes to make more human readable. Similar to specifying -h in many command line tools.

Args:

num (int): The number of bytes you wish to represent. suffix (str, optional): The suffix for the representation. Defaults to ‘B’ use_binary_prefix (bool, optional): Use binary prefix, Defaults to True, if False use decimal prefix.

Returns:
str: The human representation of the bytes provided.
Examples:
>>> print(human_bytes(1024))
1.0KiB

Iris Tools