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
fnturned 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. Passesselfonto the jinja variableobjon the template. Template should be under/ipython(seetslumen.misc.JINJA_FILE_SEARCHPATHSfor the full list of search paths).