tslumen.misc module¶
Miscellaneous utils available to all modules.
-
tslumen.misc.
import_error_function
(module: str) → Callable[source]¶ Proxy function to raise import error
-
tslumen.misc.
lazyproperty
(func: Callable) → property[source]¶ Decorator to create lazy-loading properties. Creates a class attribute with the same name prefixed with an underscore and sets it to
None
. When accessing the property, if the underscored attribute isNone
, executes the decorated function and stores the result. Returns the underscored attribute.- Parameters
func (Callable) – Function to decorate.
- Returns
Decorated
fn
turned into a property.- Return type
property
-
tslumen.misc.
repr_html
(klass: type) → type[source]¶ Decorator to inject a
_repr_html_
method in a given class. Will attempt to load the jinja template and render to html, else returns html. Passesself
onto the jinja variableobj
on the template. Template should be under/ipython
(seetslumen.misc.JINJA_FILE_SEARCHPATHS
for the full list of search paths).