about_time API Reference

Tracks execution time, throughput, and timing metrics easily with context managers.

about_time.FEATURES
Python Library Documentation: Features in module about_time.features object

class Features(builtins.object)
 |  Methods defined here:
 |
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  feature_1024
 |
 |  feature_iec
 |
 |  feature_space
about_time.HumanCount
Python Library Documentation: class HumanCount in module about_time.human_count

class HumanCount(builtins.object)
 |  HumanCount(value, unit)
 |
 |  Methods defined here:
 |
 |  __eq__(self, other)
 |      Return self==value.
 |
 |  __init__(self, value, unit)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  __str__(self)
 |      Return str(self).
 |
 |  as_human(self, prec: Optional[int] = None) -> str
 |      Return a beautiful representation of this count.
 |      It dynamically calculates the best scale to use.
 |
 |      Args:
 |          prec: an optional custom precision
 |
 |      Returns:
 |          the human friendly representation.
 |
 |  unit(self, value: str) -> 'HumanCount'
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  value
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __hash__ = None
about_time.HumanDuration
Python Library Documentation: class HumanDuration in module about_time.human_duration

class HumanDuration(builtins.object)
 |  HumanDuration(value)
 |
 |  Methods defined here:
 |
 |  __eq__(self, other)
 |      Return self==value.
 |
 |  __init__(self, value)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  __str__(self)
 |      Return str(self).
 |
 |  as_human(self, prec: Optional[int] = None) -> str
 |      Return a beautiful representation of this duration.
 |      It dynamically calculates the best scale to use.
 |
 |      Args:
 |          prec: an optional custom precision
 |
 |      Returns:
 |          the human friendly representation.
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  value
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __hash__ = None
about_time.HumanThroughput
Python Library Documentation: class HumanThroughput in module about_time.human_throughput

class HumanThroughput(builtins.object)
 |  HumanThroughput(value, unit)
 |
 |  Methods defined here:
 |
 |  __eq__(self, other)
 |      Return self==value.
 |
 |  __init__(self, value, unit)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  __str__(self)
 |      Return str(self).
 |
 |  as_human(self, prec: Optional[int] = None) -> str
 |      Return a beautiful representation of this count.
 |      It dynamically calculates the best scale to use.
 |
 |      Args:
 |          prec: an optional custom precision
 |
 |      Returns:
 |          the human friendly representation.
 |
 |  unit(self, value: str) -> 'HumanThroughput'
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  value
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __hash__ = None
about_time.VERSION
Python Library Documentation: tuple object

class tuple(object)
 |  tuple(iterable=(), /)
 |
 |  Built-in immutable sequence.
 |
 |  If no argument is given, the constructor returns an empty tuple.
 |  If iterable is specified the tuple is initialized from iterable's items.
 |
 |  If the argument is a tuple, the return value is the same object.
 |
 |  Built-in subclasses:
 |      asyncgen_hooks
 |      UnraisableHookArgs
 |
 |  Methods defined here:
 |
 |  __add__(self, value, /)
 |      Return self+value.
 |
 |  __contains__(self, key, /)
 |      Return bool(key in self).
 |
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  __ge__(self, value, /)
 |      Return self>=value.
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __getitem__(self, key, /)
 |      Return self[key].
 |
 |  __getnewargs__(self, /)
 |
 |  __gt__(self, value, /)
 |      Return self>value.
 |
 |  __hash__(self, /)
 |      Return hash(self).
 |
 |  __iter__(self, /)
 |      Implement iter(self).
 |
 |  __le__(self, value, /)
 |      Return self<=value.
 |
 |  __len__(self, /)
 |      Return len(self).
 |
 |  __lt__(self, value, /)
 |      Return self<value.
 |
 |  __mul__(self, value, /)
 |      Return self*value.
 |
 |  __ne__(self, value, /)
 |      Return self!=value.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __rmul__(self, value, /)
 |      Return value*self.
 |
 |  count(self, value, /)
 |      Return number of occurrences of value.
 |
 |  index(self, value, start=0, stop=9223372036854775807, /)
 |      Return first index of value.
 |
 |      Raises ValueError if the value is not present.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __class_getitem__(...)
 |      See PEP 585
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
about_time.about_time
Python Library Documentation: function about_time in module about_time.core

about_time(func_or_it=None, *args, **kwargs)
    Measure timing and throughput of code blocks, with beautiful
    human friendly representations.

    There are three modes of operation: context manager, callable and
    throughput.

    1. Use it like a context manager:

    >>> with about_time() as t:
    ....    # code block.

    2. Use it with a callable:

    >>> def func(a, b): ...
    >>> t = about_time(func, 1, b=2)  # send arguments at will.

    3. Use it with an iterable or generator:

    >>> t = about_time(it)  # any iterable or generator.
    >>> for item in t:
    ....    # use item