forked from OpenBB-finance/OpenBB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_terminal.py
81 lines (69 loc) · 2.25 KB
/
config_terminal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# IMPORTATION STANDARD
import os
# IMPORTATION THIRDPARTY
import i18n
# IMPORTATION INTERNAL
from openbb_terminal.core.config.paths import MISCELLANEOUS_DIRECTORY
from openbb_terminal.base_helpers import load_env_vars, strtobool
from openbb_terminal.core.session.current_user import get_current_user
from .helper_classes import TerminalStyle as _TerminalStyle
# # Terminal UX section
current_user = get_current_user()
theme = _TerminalStyle(
current_user.preferences.MPL_STYLE,
current_user.preferences.PMF_STYLE,
current_user.preferences.RICH_STYLE,
)
# Logging section
# USE IN LOG LINES + FOR FOLDER NAME INSIDE S3 BUCKET
LOGGING_APP_NAME = (
"gst_packaged_pypi"
if "site-packages" in __file__
else os.getenv("OPENBB_LOGGING_APP_NAME") or "gst"
)
# AWS KEYS
LOGGING_AWS_ACCESS_KEY_ID = (
os.getenv("OPENBB_LOGGING_AWS_ACCESS_KEY_ID") or "REPLACE_ME"
)
LOGGING_AWS_SECRET_ACCESS_KEY = (
os.getenv("OPENBB_LOGGING_AWS_SECRET_ACCESS_KEY") or "REPLACE_ME"
)
LOGGING_COMMIT_HASH = str(os.getenv("OPENBB_LOGGING_COMMIT_HASH", "REPLACE_ME"))
# D | H | M | S
LOGGING_FREQUENCY = os.getenv("OPENBB_LOGGING_FREQUENCY") or "H"
# stdout,stderr,noop,file
LOGGING_HANDLERS = os.getenv("OPENBB_LOGGING_HANDLERS") or "file"
LOGGING_ROLLING_CLOCK = load_env_vars("OPENBB_LOGGING_ROLLING_CLOCK", strtobool, False)
# CRITICAL = 50
# FATAL = CRITICAL
# ERROR = 40
# WARNING = 30
# WARN = WARNING
# INFO = 20
# DEBUG = 10
# NOTSET = 0
LOGGING_VERBOSITY = load_env_vars("OPENBB_LOGGING_VERBOSITY", int, 20)
# LOGGING SUB APP
LOGGING_SUB_APP = os.getenv("OPENBB_LOGGING_SUB_APP") or "terminal"
LOGGING_SUPPRESS = False
# pylint: disable=no-member,c-extension-no-member
try:
__import__("git")
except ImportError:
WITH_GIT = False
else:
WITH_GIT = True
try:
if not WITH_GIT:
import pkg_resources
version = pkg_resources.get_distribution("OpenBB").version
else:
raise Exception("Using git")
except Exception:
version = "2.4.1"
VERSION = str(os.getenv("OPENBB_VERSION", version))
# # Select the terminal translation language
i18n_dict_location = MISCELLANEOUS_DIRECTORY / "i18n"
i18n.load_path.append(i18n_dict_location)
i18n.set("locale", get_current_user().preferences.USE_LANGUAGE)
i18n.set("filename_format", "{locale}.{format}")