function

utils.generate_path

def generate_path(obj: typing.Any) -> str

Inverse of ``locate()``. Generates the fully qualified name of an object. Handles cases where the object is not directly importable, e.g. due to nested classes or private modules.

The generated path is simplified by removing redundant module parts, e.g. ``module.submodule._impl.class`` may become ``module.submodule.class`` if the later also resolves to the same object. Bound methods are supported by inspecting the ``__self__`` attribute.

Parameters

NameTypeDescription
objtyping.AnyThe object to generate the path for.

Returns

str — The fully qualified name of the object.

Source: laco/utils.py:37