diff --git a/openbb_terminal/config_terminal.py b/openbb_terminal/config_terminal.py index 44d7a66830c..ee34f9470ff 100644 --- a/openbb_terminal/config_terminal.py +++ b/openbb_terminal/config_terminal.py @@ -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 diff --git a/openbb_terminal/core/sdk/sdk_helpers.py b/openbb_terminal/core/sdk/sdk_helpers.py index 9eab5b88a51..00c003c1b03 100644 --- a/openbb_terminal/core/sdk/sdk_helpers.py +++ b/openbb_terminal/core/sdk/sdk_helpers.py @@ -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() diff --git a/openbb_terminal/cryptocurrency/technical_analysis/ta_controller.py b/openbb_terminal/cryptocurrency/technical_analysis/ta_controller.py index d3b2defb290..005933506f2 100644 --- a/openbb_terminal/cryptocurrency/technical_analysis/ta_controller.py +++ b/openbb_terminal/cryptocurrency/technical_analysis/ta_controller.py @@ -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( diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index a40c437c4cd..3215580237e 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -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() diff --git a/terminal.py b/terminal.py index 4401dc078c6..a19009b6bd2 100644 --- a/terminal.py +++ b/terminal.py @@ -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