Utils
filter_keys_in_settings(dictionary, settings_obj)
Utility function for checking the membership of dictionary keys in a settings class definition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dictionary
|
dict
|
Dictionary to check |
required |
settings_obj
|
BaseSettings
|
Settings object for composing |
required |
Source code in lume_services/utils.py
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 |
|
fingerprint_dict(dictionary)
Create a hash for a dictionary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dictionary
|
dict
|
Dictionary for which to create a fingerprint hash. |
required |
Source code in lume_services/utils.py
73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
flatten_dict_for_query(dictionary, level_key=None)
Flatten a dictionary of values for pymongo query
Source code in lume_services/utils.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
get_callable_from_string(callable, bind=None)
Get callable from a string. In the case that the callable points to a bound method, the function returns a callable taking the bind instance as the first arg.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callable
|
str
|
String representation of callable abiding convention module:callable |
required |
bind
|
Any
|
Class to bind as self |
None
|
Returns:
Type | Description |
---|---|
Callable
|
Callable |
Source code in lume_services/utils.py
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
get_jsonable_dict(dictionary)
Converts numpy arrays inside a dictionary to list items.
Source code in lume_services/utils.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
select_python_version(version)
Utility for selecting a python version given a version string formatted with a pin.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
String rep of version with pin |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Sting rep of version to use |
Raises:
Type | Description |
---|---|
ValueError
|
Unable to parse python version. |
Source code in lume_services/utils.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
|