Utils
enum_converter(enum_name)
Return a callable that can be used in attr converters to convert values to enums
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enum_name
|
str
|
The name of the enum the value has |
required |
Returns:
| Type | Description |
|---|---|
Callable
|
A callable converter |
Source code in src/bungio/utils.py
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 | |
get_now_with_tz()
Returns the timezone aware current datetime
Returns:
| Type | Description |
|---|---|
datetime
|
Timezone aware datetime |
Source code in src/bungio/utils.py
10 11 12 13 14 15 16 17 18 | |
split_list(to_split, chunk_size)
Yield successive n-sized chunks from list
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_split
|
list
|
The list to split |
required |
chunk_size
|
int
|
How long the chunks should be |
required |
Returns:
| Type | Description |
|---|---|
None
|
A generator which returns the chunks |
Source code in src/bungio/utils.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |