.utils package
Submodules
.utils.coll module
- T
- sphinx-autodoc can’t document typevars properly right now,
see https://github.com/agronholm/sphinx-autodoc-typehints/issues/39
A generic type for elements of an iterable.
- Type
alias of TypeVar(‘T’)
- flatten(_iter: Iterable[Iterable[ska_ser_skallop.utils.coll.T]]) Iterable[ska_ser_skallop.utils.coll.T] [source]
.utils.device_health module
.utils.env module
.utils.generic_classes module
.utils.nrgen module
- get_id(id_pattern: str = '********-*****') str [source]
Generate a time-based unique id in virtue of the fact that subsequent requests will take place further ahead of time.
- Parameters
id_pattern – the string pattern as to how the numbered id should be rendered. <prefix>pattern<suffix> ‘*’ indicates a digit from the timestamp. Note a maximum of 16 digits is allowed. Defaults to ‘****-*’. Note digits must be seperated by only one dash at a time.
- Returns
the id rendered according to the requested pattern
.utils.singleton module
This module provides a Singleton metaclass.
- class Memo(**kwargs)[source]
Bases:
object
Singleton class that will store any given variables across multiple class instances.
To store a value you can either provide it as an argument upon instantiation or with the set method. To retrieve a value you use a get method (returns None if value doesn’t exist)
e.g.:
memo = Memo(foo='bar') assert memo.get('foo') == 'bar' # or alternatively memo.reset() # equal to creating a new instance with all values resetted. memo.set(foo='bar') assert memo.get('foo') == 'bar'