Additional utilities
Run all checks on the implementations package.
Source code in utils\check_implementations.py
23 24 25 26 27 28 29 30 | |
Helper for mapping message level names to QColor instances.
The colours are used by the GUI console to display messages with different visual emphasis (alert, warning, normal).
Source code in utils\console_colours.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
Utility for parsing and serialising my custom timestamp format.
The helper supports flexible separators and format strings used to construct
filenames and labels, and provides round-tripping between strings and
:class:datetime.datetime objects.
Source code in utils\custom_datetime.py
6 7 8 9 10 11 12 13 14 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 | |
create_datetime_from_string(input_datetime_str=None)
Creates a datetime object from an input datetime string.
- Infers %Y vs %y from the year token length.
- Allows HH_MM or HH_MM_SS; pads seconds to 00 when missing.
Source code in utils\custom_datetime.py
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 | |
get_current_timestamp(now=None)
Returns a timestamp string using label_format, suitable for filenames.
Pass now for deterministic testing; otherwise uses current local time.
Source code in utils\custom_datetime.py
87 88 89 90 91 92 93 | |
Export matrix to a delimiter-separated text file.
Parameters
filename: Path to the output file that will be created/overwritten. list_of_lists: List of equal-length iterables, each representing a column of data. header: List of column labels written as the first line of the file. delimiter: String used to join header fields and row values (defaults to tab).
Notes
The function assumes that all columns in list_of_lists have the same
length and will raise IndexError if this is not the case.
Source code in utils\export_to_csv.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
Read a JSON configuration file and return its contents as a dictionary.
Parameters
config_path : str The file path to the JSON configuration file.
Returns
dict A dictionary containing the configuration settings.
Source code in utils\read_config.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |