API Documentation
This API is still in development and may change without notice.
create_script()
Create a minimal script with available cues.
This function creates a minimal script with available cues. It includes an audio cue, a video cue and an action cue. The script is returned as a CuemsScript object.
Returns:
| Name | Type | Description |
|---|---|---|
CuemsScript |
A minimal script with configured cues. |
Source code in src/cuemsutils/create_script.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
Set of helper functions for the cuemsutils package.
CuemsDict
Bases: dict
Custom dictionary class to handle cuemsutils specific items.
Source code in src/cuemsutils/helpers.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
setter(settings)
Set the object properties from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
dict
|
Dictionary containing property values to set. |
required |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If settings is not a dictionary. |
Source code in src/cuemsutils/helpers.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
build_xml_dict(x, parent)
Build an xml element from a dictionary
Source code in src/cuemsutils/helpers.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
check_path(x, dir_only=False)
Check if a path is valid. Raise an error if not.
Source code in src/cuemsutils/helpers.py
68 69 70 71 72 73 74 75 76 77 78 | |
ensure_items(x, requiered)
Ensure that all the items are present in a dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
dict
|
The dictionary to check |
required |
requiered
|
dict
|
The items (key-value pairs) to check for |
required |
Source code in src/cuemsutils/helpers.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
extract_items(x, keys)
Extract list of keys and values from a dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
items
|
The dictionary items to extract from |
required |
keys
|
list
|
The keys to extract |
required |
Source code in src/cuemsutils/helpers.py
102 103 104 105 106 107 108 109 110 | |
mkdir_recursive(folder)
Creates a directory recursively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
str
|
The folder to be created. |
required |
Source code in src/cuemsutils/helpers.py
132 133 134 135 136 137 138 139 140 141 142 143 | |
new_datetime()
Generate a new datetime string.
Source code in src/cuemsutils/helpers.py
145 146 147 | |
new_uuid()
Generate a new Uuid class instance.
Source code in src/cuemsutils/helpers.py
149 150 151 | |
strtobool(val)
Convert a string value representation of truth to true (1) or false (0).
True values are y, yes, t, true, on and 1. False values are n, no, f, false, off and 0. Raises ValueError if val is anything else.
Source code in src/cuemsutils/helpers.py
153 154 155 156 157 158 159 160 161 162 163 164 165 | |
unique_values_to_list(x)
Convert a dictionary to a sorted list of its unique values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
dict
|
The dictionary to convert |
required |
Source code in src/cuemsutils/helpers.py
167 168 169 170 171 172 173 | |
CuemsLoggerAdapter
Bases: LoggerAdapter
Custom LoggerAdapter that properly merges extra dictionaries.
Source code in src/cuemsutils/log.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
process(msg, kwargs)
Process the logging call to merge extra dictionaries. Ensures that both adapter-level and call-level extra dicts are merged.
Source code in src/cuemsutils/log.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Logger
A class for logging messages with different log levels.
This class provides static methods for logging messages with different log levels. It dynamically detects the calling module to use the appropriate logger.
Source code in src/cuemsutils/log.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
log_level_to_obj(log_level)
Convert a log level string to a logging level object.
Source code in src/cuemsutils/log.py
13 14 15 16 17 18 19 20 21 22 23 | |
logged(func)
A decorator function to log information about function calls and their results.
Source code in src/cuemsutils/log.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
main_logger(module_name=None, with_syslog=True, with_stdout=True)
Create a root logger with a custom formatter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name
|
Name of the module to create logger for. Defaults to name if None. |
None
|
|
with_syslog
|
Whether to add syslog handler. |
True
|
|
with_stdout
|
Whether to add stdout handler. |
True
|
Source code in src/cuemsutils/log.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
Timeoutloop
universal for time-out loop
Source code in src/cuemsutils/timeoutloop.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |