erlab.utils.misc¶
Utilities that don’t fit in any other category.
Functions
|
Return True if |
|
Emit a warning at the user level by inspecting the stack trace. |
|
Get the appropriate tqdm module. |
Check if the code is running in an interactive environment. |
|
|
Check if a version string is newer than the current installed erlab version. |
|
Check if the given object is a sequence of elements of the specified type. |
|
Reveal a path in the system's file manager. |
- erlab.utils.misc.accepts_kwarg(func, name, *, strict=True)[source]¶
Return True if
funccan be called with keyword argumentname.- Parameters:
func (
Callable) – The callable to inspect.name (
str) – The name of the keyword argument to check for.strict (
bool, default:True) – If True, only return True ifnameis explicitly defined as a keyword parameter infunc’s signature. If False, also return True iffuncaccepts arbitrary keyword arguments via**kwargs.
- erlab.utils.misc.emit_user_level_warning(message, category=None)[source]¶
Emit a warning at the user level by inspecting the stack trace.
- erlab.utils.misc.get_tqdm()[source]¶
Get the appropriate tqdm module.
For frozen packages, we cannot use
tqdm.autosince it causes issues with incomplete IPython installations.
- erlab.utils.misc.is_interactive()[source]¶
Check if the code is running in an interactive environment.
- erlab.utils.misc.is_newer_version(version_str)[source]¶
Check if a version string is newer than the current installed erlab version.
- erlab.utils.misc.is_sequence_of(val, element_type)[source]¶
Check if the given object is a sequence of elements of the specified type.
- Parameters:
- Returns:
bool–Trueifvalis a sequence and all elements in the sequence are of typeelement_type,Falseotherwise.- Return type:
Examples
>>> is_sequence_of([1, 2, 3], int) True
>>> is_sequence_of([1, 2, "3"], int) False