tux.utils.config
¶
Classes:
Name | Description |
---|---|
Config | |
Functions:
Name | Description |
---|---|
convert_dict_str_to_int | Convert a dictionary with string keys to one with integer keys. |
Classes¶
Config
¶
Attributes:
Name | Type | Description |
---|---|---|
DATABASE_URL | str | Get the database URL for the current environment. |
BOT_TOKEN | str | Get the bot token for the current environment. |
Functions¶
convert_dict_str_to_int(original_dict: dict[str, int]) -> dict[int, int]
¶
Convert a dictionary with string keys to one with integer keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
original_dict | dict[str, int] | The original dictionary with string keys. | required |
Returns:
Type | Description |
---|---|
dict[int, int] | The new dictionary with integer keys. |
Source code in tux/utils/config.py
Python
def convert_dict_str_to_int(original_dict: dict[str, int]) -> dict[int, int]:
"""Convert a dictionary with string keys to one with integer keys.
Parameters
----------
original_dict : dict[str, int]
The original dictionary with string keys.
Returns
-------
dict[int, int]
The new dictionary with integer keys.
"""
return {int(k): v for k, v in original_dict.items()}