topo_metrics.utils#
Classes#
A context manager to suppress stdout and stderr. |
Functions#
|
Recursively converts a list (or nested lists) to a tuple. |
|
Generates a uniform string representation of an object, supporting both |
|
Count the number of times the minimum value appears in the list X. |
Module Contents#
- class topo_metrics.utils.hushed[source]#
A context manager to suppress stdout and stderr.
Notes
I have made this as aggressive as possible to suppress all warnings and
logging messages. This is because the function `instantiate_julia`brings in a lot of noise that irritates me.
- topo_metrics.utils.to_tuple(not_tuple: list | Any) Any[source]#
Recursively converts a list (or nested lists) to a tuple.
This function is designed to handle lists that may contain nested lists, and it will recursively convert all levels of lists into tuples.
- Parameters:
not_tuple – The input to be converted. If the input is a list, it will be recursively converted to a tuple. Otherwise, it will be returned as-is.
- Returns:
A tuple equivalent of the input list, or the original element if it is not a
list.
Example
>>> totuple([1, 2, [3, 4, [5, 6]], 7]) (1, 2, (3, 4, (5, 6)), 7)
>>> totuple('string') 'string'