skais_mapper.utils.helper
Generic helper functions and other stuff.
Functions:
Name | Description |
---|---|
alias_kw |
Decorator for aliasing a keyword argument in a function. |
compress_encode |
Compress and encode a string for shorter representations. |
current_time |
Get current time as string. |
extract_decode |
Decompress and decode a short representation string. |
alias_kw
alias_kw(key: str, alias: str) -> Callable
Decorator for aliasing a keyword argument in a function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
Name of keyword argument in function to alias |
required |
alias
|
str
|
Alias that can be used for this keyword argument |
required |
Source code in skais_mapper/utils/helper.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
compress_encode
compress_encode(string: str) -> str
Compress and encode a string for shorter representations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
String to be encoded. |
required |
Source code in skais_mapper/utils/helper.py
33 34 35 36 37 38 39 40 41 |
|
current_time
current_time(
date_only: bool = True,
as_str: bool = True,
no_delim: bool = True,
) -> datetime.datetime | str
Get current time as string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date_only
|
bool
|
If True, only the date is returned. |
True
|
as_str
|
bool
|
If True, a string is returned instead of a datetime object. |
True
|
no_delim
|
bool
|
If a string is returned, remove the standard delimiters. |
True
|
Source code in skais_mapper/utils/helper.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
extract_decode
extract_decode(string: str) -> str
Decompress and decode a short representation string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
Compressed base64 string to be decoded. |
required |
Source code in skais_mapper/utils/helper.py
44 45 46 47 48 49 50 51 52 |
|