Last active
October 31, 2023 11:15
-
-
Save TomoG29/b55fa19874a2bccda064133dec1b6ba6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECTION_KEY_DEFAULT = 0 | |
SECTION_KEY_A = 1 | |
SECTION_KEY_B = 2 | |
OPTION_KEY_A = "A" | |
OPTION_KEY_B = "B" | |
#コンフィグ設定をまとめたリスト | |
config_list = { | |
SECTION_KEY_DEFAULT: {OPTION_KEY_A: 0, OPTION_KEY_B: 0}, # デフォルト | |
SECTION_KEY_A: {OPTION_KEY_A: 2, OPTION_KEY_B: 3}, | |
SECTION_KEY_B: {OPTION_KEY_A: 10, OPTION_KEY_B: 20} | |
} | |
#セクションキーをまとめたリスト | |
section_key_list = { | |
SECTION_KEY_DEFAULT, | |
SECTION_KEY_A, | |
SECTION_KEY_B | |
} | |
#オプションキーをまとめたリスト | |
option_key_list = { | |
OPTION_KEY_A, | |
OPTION_KEY_B | |
} | |
def init(key): | |
if key not in config_list: | |
print(f"警告:セクションキー {key} は存在しません。デフォルト設定を使用します。") | |
key = SECTION_KEY_DEFAULT | |
return config_list[key] | |
def get_section_key_list(): | |
return section_key_list | |
def get_option_key_list(): | |
return option_key_list | |
if __name__ == '__main__': | |
print("サンプル用のモジュールです") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment