pttools.speedup.utils
Utilities for the speedups
Functions
- pttools.speedup.utils.conditional_decorator(dec, condition, **kwargs)
Applies the given decorator if the given condition is True.
- Parameters:
dec (callable) – decorator
condition (bool) – whether the decorator should be applied
- Return type:
callable
- pttools.speedup.utils.copy_doc(copy_func)
Copies the docstring of the given function to another. This function is intended to be used as a decorator. From: https://stackoverflow.com/a/68901244
def foo(): '''This is a foo doc string''' ... @copy_doc(foo) def bar(): ...
- Parameters:
copy_func (callable)
- Return type:
callable
- pttools.speedup.utils.is_nan_or_none(value=None)
- Parameters:
value (float)
- Return type:
bool
- pttools.speedup.utils.threadsafe_lru(func)
Thread-safe LRU cache
From https://noamkremen.github.io/a-simple-threadsafe-caching-decorator.html
- Parameters:
func (callable)
- Return type:
callable