Skip to content

Instantly share code, notes, and snippets.

@TomoG29
Last active October 31, 2023 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomoG29/b55fa19874a2bccda064133dec1b6ba6 to your computer and use it in GitHub Desktop.
Save TomoG29/b55fa19874a2bccda064133dec1b6ba6 to your computer and use it in GitHub Desktop.
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