mass.util.util
Contains utility functions to assist in various mass
functions.
Module Contents
Classes
Colored Formatter for logging output. |
Functions
Print dependency information. |
|
|
Ensure the given item is an returned as an iterable. |
|
Ensure provided value is a non-negative value, or |
Attributes
Contains logger levels and corresponding color codes. |
- mass.util.util.ensure_iterable(item)[source]
Ensure the given item is an returned as an iterable.
- Parameters
item (object) – The item to ensure is returned as an iterable.
- mass.util.util.ensure_non_negative_value(value, exclude_zero=False)[source]
Ensure provided value is a non-negative value, or
None
.- Parameters
value (float) – The value to ensure is non-negative
- Raises
ValueError – Occurs if the value is negative.
- class mass.util.util.ColorFormatter(fmt=None, datefmt=None, style='%')[source]
Bases:
logging.Formatter
Colored Formatter for logging output.
Based on http://uran198.github.io/en/python/2016/07/12/colorful-python-logging.html