epy#

[[Source]]

from etils import epy

Python utils public API.

All symbols#

Module#

epy

Python utils public API.

epy._internal

etils internal utils.

Class#

epy.ContextManager

ContextManager allows to define contextmanager class using yield-syntax.

epy.Lines

Util to build multi-line text.

epy.StrEnum

Like Enum, but enum.auto() assigns str rather than int.

Function#

epy._internal.check_missing_deps

Raise a better error message in case of ImportError.

epy._internal.unwrap_on_reload

Unwrap the function to support colab module reload.

epy._internal.wraps_with_reload

Wrap the function to support colab module reload.

epy.binary_adhoc

epy.dedent

Wrapper around textwrap.dedent which also strip() the content.

epy.diff_str

Pretty diff between 2 objects.

epy.frozen

Class decorator which prevent mutating attributes after __init__.

epy.groupby

Similar to itertools.groupby but return result as a dict().

epy.is_namedtuple

Returns True if the value is instance of NamedTuple.

epy.is_notebook

Returns True if running in a notebook (Colab, Jupyter) environment.

epy.issubclass

Like issubclass, but do not raise error if value is not type.

epy.lazy_api_imports

Lazy-import an API (__init__.py).

epy.lazy_imports

Context Manager which lazy loads packages.

epy.maybe_reraise

Context manager which reraise exceptions with an additional message.

epy.pprint

Pretty print obj.

epy.pretty_repr

Pretty repr(obj) for nested list, dict, dataclasses,…

epy.pretty_repr_top_level

Pretty repr(obj) for nested list, dict, dataclasses,…

epy.reraise

Reraise an exception with an additional message.

epy.reverse_fstring

Reverse f-string.

epy.splitby

Split the iterable into 2 lists (false, true), based on the predicate.

epy.wraps_cls

Equivalent of functools.wraps but for classes.

epy.zip_dict

Iterate over items of dictionaries grouped by their keys.