Reworks feature_flags.py to use strtobool from distutils

This commit is contained in:
clothespin
2021-03-18 17:30:58 -07:00
parent d58264eb35
commit 7745867d5d

View File

@@ -1,23 +1,13 @@
from distutils.util import strtobool
import os
# env vars are strings not booleans
# check for "false" or "0"
# any other value is true (including empty string)
USE_COLOR = os.getenv("GTFF_USE_COLOR", "true").lower() not in ["false", "0"]
USE_FLAIR = os.getenv("GTFF_USE_FLAIR", "stars")
USE_ION = os.getenv("GTFF_USE_ION", "true").lower() not in ["false", "0"]
USE_PROMPT_TOOLKIT = os.getenv("GTFF_USE_PROMPT_TOOLKIT", "false").lower() not in [
"false",
"0",
]
USE_COLOR = strtobool(os.getenv("GTFF_USE_COLOR", "True"))
USE_FLAIR = os.getenv("GTFF_USE_FLAIR") or "stars"
USE_ION = strtobool(os.getenv("GTFF_USE_ION", "True"))
USE_PROMPT_TOOLKIT = strtobool(os.getenv("GTFF_USE_PROMPT_TOOLKIT", "False"))
# Enable Prediction features
ENABLE_PREDICT = os.getenv("GTFF_ENABLE_PREDICT", "false").lower() not in ["false", "0"]
ENABLE_PREDICT = strtobool(os.getenv("GTFF_ENABLE_PREDICT", "False"))
# Enable plot autoscaling
USE_PLOT_AUTOSCALING = os.getenv("GTFF_USE_PLOT_AUTOSCALING", "false").lower() not in [
"false",
"0",
]
USE_PLOT_AUTOSCALING = strtobool(os.getenv("GTFF_USE_PLOT_AUTOSCALING", "False"))