savu.core.utils module¶
-
add_base
(this, base)[source] Add a base class to a class.
- Params class this
a class instance
- Params class base
a class to add as a base class
-
add_base_classes
(this, bases)[source] Add multiple base classes to a class.
- Params class this
a class instance.
- Params list(class) bases
a list of base classes
-
add_syslog_log_handler
(logger, syslog_address, syslog_port)[source]
-
add_user_log_handler
(logger, user_log_path)[source]
-
add_user_log_level
()[source]
-
docstring_parameter
(*sub)[source] Decorator to add strings to a doc string.
-
ensure_string
(string: Union[str, bytes]) → str[source] Python 3 and HDF5 mixture has created a somewhat ambiguous situation where the strings in Python 3 are UTF-8 by default, but HDF5 strings cannot be unicode.
This function should wrap strings coming in from HDF5 to ensure that they are decoded to UTF-8 so that they can be treated at str in Python, and not bytes.
-
get_available_gpus
()[source]
-
get_memory_usage_linux
(kb=False, mb=True)[source] - Parameters
kb – Return the value in Kilobytes
mb – Return the value in Megabytes
- Returns
The string of the value in either KB or MB
:rtype str
-
import_class
(class_name)[source] Import a class.
- Params
class name
- Returns
class instance
- Return type
instance of class_name
-
logfunction
(func)[source] Decorator to add logging information around calls for use with .
-
logmethod
(func)[source] Decorator to add logging information around calls for use with .
-
user_message
(message)[source]
-
user_messages_from_all
(header, message_list)[source]