mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Fix .env reading before loading (#4432)
* fix .env reading before loading * Update sdk.py * import cfg terminal explicitly * clear * add comment and update sdk helper * make it even more explicit * remove some comments * pylint * pylint
This commit is contained in:
@@ -5,14 +5,15 @@ import os
|
||||
import i18n
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from openbb_terminal.base_helpers import load_env_vars, strtobool
|
||||
from openbb_terminal.base_helpers import load_env_vars, strtobool, load_env_files
|
||||
from openbb_terminal.core.config.paths import MISCELLANEOUS_DIRECTORY
|
||||
from openbb_terminal.core.plots.backend import plots_backend
|
||||
from openbb_terminal.core.session.current_user import get_current_user
|
||||
from openbb_terminal.core.config.paths_helper import init_userdata
|
||||
|
||||
from .helper_classes import TerminalStyle as _TerminalStyle
|
||||
|
||||
# # Terminal UX section
|
||||
# Terminal UX section
|
||||
current_user = get_current_user()
|
||||
theme = _TerminalStyle(
|
||||
current_user.preferences.MPL_STYLE,
|
||||
@@ -20,8 +21,13 @@ theme = _TerminalStyle(
|
||||
current_user.preferences.RICH_STYLE,
|
||||
)
|
||||
|
||||
# Start Backend for plotting
|
||||
plots_backend().start(load_env_vars("DEBUG_MODE", strtobool, False))
|
||||
|
||||
def start_required_configurations():
|
||||
"""Starts the required configurations for the terminal to work"""
|
||||
load_env_files()
|
||||
init_userdata()
|
||||
plots_backend().start(load_env_vars("DEBUG_MODE", strtobool, False))
|
||||
|
||||
|
||||
# Logging section
|
||||
|
||||
|
||||
@@ -336,7 +336,6 @@ import logging
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal import helper_funcs as helper # noqa: F401
|
||||
from openbb_terminal.base_helpers import load_env_files
|
||||
from openbb_terminal.config_terminal import theme
|
||||
|
||||
from openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model import Coin
|
||||
@@ -353,8 +352,7 @@ from openbb_terminal.core.sdk import (
|
||||
from openbb_terminal.core.session.current_user import is_local
|
||||
from openbb_terminal.terminal_helper import is_auth_enabled
|
||||
|
||||
load_env_files()
|
||||
init_userdata()
|
||||
cfg.start_required_configurations()
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
theme.applyMPLstyle()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Crypto Technical Analysis Controller Module"""
|
||||
__docformat__ = "numpy"
|
||||
# pylint:disable=too-many-lines,R0904,C0201
|
||||
# pylint: disable=R0904,C0201,C0302
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
@@ -1486,8 +1486,8 @@ class TechnicalAnalysisController(CryptoBaseController):
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="cones",
|
||||
description="""
|
||||
Calculates the realized volatility quantiles over rolling windows of time.
|
||||
The model for calculating volatility is selectable.
|
||||
Calculates the realized volatility quantiles over rolling windows of time.
|
||||
The model for calculating volatility is selectable.
|
||||
""",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -6,9 +6,7 @@ import logging
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal import helper_funcs as helper # noqa: F401
|
||||
from openbb_terminal.base_helpers import load_env_files
|
||||
from openbb_terminal.config_terminal import theme
|
||||
from openbb_terminal.core.config.paths_helper import init_userdata
|
||||
|
||||
from openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model import Coin
|
||||
from openbb_terminal.dashboards.dashboards_controller import DashboardsController
|
||||
@@ -24,8 +22,7 @@ from openbb_terminal.core.sdk import (
|
||||
from openbb_terminal.core.session.current_user import is_local
|
||||
from openbb_terminal.terminal_helper import is_auth_enabled
|
||||
|
||||
load_env_files()
|
||||
init_userdata()
|
||||
cfg.start_required_configurations()
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
theme.applyMPLstyle()
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
import sys
|
||||
from multiprocessing import freeze_support
|
||||
|
||||
# pylint:disable=unused-import,import-outside-toplevel
|
||||
import openbb_terminal.config_terminal as cfg # noqa: F401
|
||||
import openbb_terminal.core.session.current_user as _ # noqa: F401
|
||||
from openbb_terminal.base_helpers import load_env_files
|
||||
from openbb_terminal.core.config.paths_helper import init_userdata
|
||||
from openbb_terminal.terminal_helper import is_auth_enabled
|
||||
|
||||
# pylint: disable=import-outside-toplevel
|
||||
|
||||
|
||||
def main():
|
||||
sent_args = sys.argv[1:]
|
||||
|
||||
load_env_files()
|
||||
init_userdata()
|
||||
cfg.start_required_configurations()
|
||||
|
||||
if "-t" in sent_args or "--test" in sent_args:
|
||||
from openbb_terminal.core.integration_tests import integration_controller
|
||||
|
||||
Reference in New Issue
Block a user