summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiogo Sousa <montezdesousa@gmail.com>2024-04-23 14:20:48 +0100
committerDiogo Sousa <montezdesousa@gmail.com>2024-04-23 14:20:48 +0100
commit07d397bcdfca7b136578587c9a7e5940d2569d61 (patch)
tree404f1f76fc3942cdd2b53b6431bf1a493c5b7701
parentf914f21f445b91cdca1e74b33ca556439421396a (diff)
Danger: create controllers/ and move stuff
-rw-r--r--openbb_terminal/cli.py4
-rw-r--r--openbb_terminal/core/controllers/base_controller.py (renamed from openbb_terminal/base_controller.py)20
-rw-r--r--openbb_terminal/core/controllers/base_platform_controller.py (renamed from openbb_terminal/base_platform_controller.py)6
-rw-r--r--openbb_terminal/core/controllers/choices.py (renamed from openbb_terminal/core/completer/choices.py)5
-rw-r--r--openbb_terminal/core/controllers/featflags_controller.py (renamed from openbb_terminal/featflags_controller.py)14
-rw-r--r--openbb_terminal/core/controllers/helper_funcs.py (renamed from openbb_terminal/helper_funcs.py)0
-rw-r--r--openbb_terminal/core/controllers/intro.json (renamed from openbb_terminal/intro.json)0
-rw-r--r--openbb_terminal/core/controllers/menu.py (renamed from openbb_terminal/menu.py)0
-rw-r--r--openbb_terminal/core/controllers/platform_controller_factory.py (renamed from openbb_terminal/platform_controller_factory.py)2
-rw-r--r--openbb_terminal/core/controllers/terminal_controller.py (renamed from openbb_terminal/terminal_controller.py)28
-rw-r--r--openbb_terminal/core/controllers/terminal_helper.py (renamed from openbb_terminal/terminal_helper.py)8
-rw-r--r--openbb_terminal/core/session/launcher.py (renamed from openbb_terminal/core/session/session_controller.py)2
-rw-r--r--openbb_terminal/routines/account_view.py4
13 files changed, 49 insertions, 44 deletions
diff --git a/openbb_terminal/cli.py b/openbb_terminal/cli.py
index bf956576ffe..609f1ece2ab 100644
--- a/openbb_terminal/cli.py
+++ b/openbb_terminal/cli.py
@@ -1,7 +1,7 @@
import sys
import openbb_terminal.core.config.config_terminal as cfg
-from openbb_terminal.core.session import session_controller
+from openbb_terminal.core.session import launcher
def main():
@@ -10,7 +10,7 @@ def main():
dev = "--dev" in sys.argv[1:]
debug = "--debug" in sys.argv[1:]
- session_controller.launch_terminal(dev=dev, debug=debug)
+ launcher.launch_terminal(dev=dev, debug=debug)
if __name__ == "__main__":
diff --git a/openbb_terminal/base_controller.py b/openbb_terminal/core/controllers/base_controller.py
index 146b6568ca6..e05dfcda036 100644
--- a/openbb_terminal/base_controller.py
+++ b/openbb_terminal/core/controllers/base_controller.py
@@ -18,12 +18,21 @@ from typing import Any, Dict, List, Literal, Optional, Union
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.styles import Style
-from openbb_terminal.core.completer.choices import build_controller_choice_map
from openbb_terminal.core.completer.custom_prompt_toolkit import NestedCompleter
# IMPORTS INTERNAL
from openbb_terminal.core.config import config_terminal
from openbb_terminal.core.config.rich_config import console
+from openbb_terminal.core.controllers.choices import build_controller_choice_map
+from openbb_terminal.core.controllers.helper_funcs import (
+ check_file_type_saved,
+ check_positive,
+ get_flair_and_username,
+ parse_and_split_input,
+ system_clear,
+)
+from openbb_terminal.core.controllers.menu import session
+from openbb_terminal.core.controllers.terminal_helper import print_guest_block_msg
# from openbb_terminal.core.config.paths import HIST_FILE_PATH
from openbb_terminal.core.session import hub_service as HubService
@@ -34,15 +43,6 @@ from openbb_terminal.core.session.current_user import (
is_local,
)
from openbb_terminal.core.session.utils import remove
-from openbb_terminal.helper_funcs import (
- check_file_type_saved,
- check_positive,
- get_flair_and_username,
- parse_and_split_input,
- system_clear,
-)
-from openbb_terminal.menu import session
-from openbb_terminal.terminal_helper import print_guest_block_msg
# pylint: disable=R0912
diff --git a/openbb_terminal/base_platform_controller.py b/openbb_terminal/core/controllers/base_platform_controller.py
index 0f5e0cf9bf0..f37549b5797 100644
--- a/openbb_terminal/base_platform_controller.py
+++ b/openbb_terminal/core/controllers/base_platform_controller.py
@@ -13,12 +13,12 @@ from openbb_charting.core.openbb_figure import OpenBBFigure
from argparse_translator.argparse_class_processor import ArgparseClassProcessor
from argparse_translator.obbject_registry import Registry
-from openbb_terminal.base_controller import BaseController
from openbb_terminal.core.completer.custom_prompt_toolkit import NestedCompleter
from openbb_terminal.core.config.rich_config import MenuText, console
+from openbb_terminal.core.controllers.base_controller import BaseController
+from openbb_terminal.core.controllers.helper_funcs import export_data, print_rich_table
+from openbb_terminal.core.controllers.menu import session
from openbb_terminal.core.session.current_settings import get_current_settings
-from openbb_terminal.helper_funcs import export_data, print_rich_table
-from openbb_terminal.menu import session
class DummyTranslation:
diff --git a/openbb_terminal/core/completer/choices.py b/openbb_terminal/core/controllers/choices.py
index 4924dd2ca3a..110166a0da2 100644
--- a/openbb_terminal/core/completer/choices.py
+++ b/openbb_terminal/core/controllers/choices.py
@@ -5,8 +5,11 @@ from types import MethodType
from typing import Callable, List, Literal
from unittest.mock import patch
+from openbb_terminal.core.controllers.helper_funcs import (
+ check_file_type_saved,
+ check_positive,
+)
from openbb_terminal.core.session.current_settings import get_current_settings
-from openbb_terminal.helper_funcs import check_file_type_saved, check_positive
def __mock_parse_known_args_and_warn(
diff --git a/openbb_terminal/featflags_controller.py b/openbb_terminal/core/controllers/featflags_controller.py
index 1942284dbfd..f865f06603f 100644
--- a/openbb_terminal/featflags_controller.py
+++ b/openbb_terminal/core/controllers/featflags_controller.py
@@ -6,24 +6,24 @@ import argparse
from pathlib import Path
from typing import List, Optional, Union
-from openbb_terminal.base_controller import BaseController
from openbb_terminal.core.completer.custom_prompt_toolkit import NestedCompleter
from openbb_terminal.core.config.rich_config import MenuText, console
# pylint: disable=too-many-lines,no-member,too-many-public-methods,C0302
# pylint:disable=import-outside-toplevel
from openbb_terminal.core.config.terminal_style import theme
+from openbb_terminal.core.controllers.base_controller import BaseController
+from openbb_terminal.core.controllers.helper_funcs import (
+ AVAILABLE_FLAIRS,
+ all_timezones,
+ is_timezone_valid,
+)
+from openbb_terminal.core.controllers.menu import session
from openbb_terminal.core.session.current_settings import (
get_current_settings,
set_settings,
)
from openbb_terminal.core.session.env_handler import write_to_dotenv
-from openbb_terminal.helper_funcs import (
- AVAILABLE_FLAIRS,
- all_timezones,
- is_timezone_valid,
-)
-from openbb_terminal.menu import session
def set_and_save_preference(name: str, value: Union[bool, Path, str]):
diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/core/controllers/helper_funcs.py
index a2df8f1ca4d..a2df8f1ca4d 100644
--- a/openbb_terminal/helper_funcs.py
+++ b/openbb_terminal/core/controllers/helper_funcs.py
diff --git a/openbb_terminal/intro.json b/openbb_terminal/core/controllers/intro.json
index 8b3c70f323d..8b3c70f323d 100644
--- a/openbb_terminal/intro.json
+++ b/openbb_terminal/core/controllers/intro.json
diff --git a/openbb_terminal/menu.py b/openbb_terminal/core/controllers/menu.py
index 5a3d6db8273..5a3d6db8273 100644
--- a/openbb_terminal/menu.py
+++ b/openbb_terminal/core/controllers/menu.py
diff --git a/openbb_terminal/platform_controller_factory.py b/openbb_terminal/core/controllers/platform_controller_factory.py
index 247362afe1d..20746233334 100644
--- a/openbb_terminal/platform_controller_factory.py
+++ b/openbb_terminal/core/controllers/platform_controller_factory.py
@@ -1,7 +1,7 @@
from typing import Dict, List, Union
from argparse_translator.argparse_class_processor import ArgparseClassProcessor
-from openbb_terminal.base_platform_controller import PlatformController
+from openbb_terminal.core.controllers.base_platform_controller import PlatformController
class PlatformControllerFactory:
diff --git a/openbb_terminal/terminal_controller.py b/openbb_terminal/core/controllers/terminal_controller.py
index f6e24584915..375562f26ea 100644
--- a/openbb_terminal/terminal_controller.py
+++ b/openbb_terminal/core/controllers/terminal_controller.py
@@ -26,7 +26,6 @@ from prompt_toolkit.styles import Style
from pydantic import BaseModel
from argparse_translator.obbject_registry import Registry
-from openbb_terminal.base_controller import BaseController
from openbb_terminal.core.completer.custom_prompt_toolkit import NestedCompleter
from openbb_terminal.core.config.paths import (
HOME_DIRECTORY,
@@ -35,25 +34,17 @@ from openbb_terminal.core.config.paths import (
SETTINGS_ENV_FILE,
)
from openbb_terminal.core.config.rich_config import MenuText, console
-from openbb_terminal.core.session import constants
-from openbb_terminal.core.session.current_settings import (
- get_current_settings,
- set_settings,
-)
-from openbb_terminal.core.session.current_user import (
- get_platform_user,
-)
-from openbb_terminal.helper_funcs import (
+from openbb_terminal.core.controllers.base_controller import BaseController
+from openbb_terminal.core.controllers.helper_funcs import (
get_flair_and_username,
parse_and_split_input,
print_rich_table,
)
-from openbb_terminal.menu import session
-from openbb_terminal.platform_controller_factory import (
+from openbb_terminal.core.controllers.menu import session
+from openbb_terminal.core.controllers.platform_controller_factory import (
PlatformControllerFactory,
)
-from openbb_terminal.routines.routine_functions import is_reset, parse_openbb_script
-from openbb_terminal.terminal_helper import (
+from openbb_terminal.core.controllers.terminal_helper import (
bootup,
first_time_user,
is_installer,
@@ -62,6 +53,15 @@ from openbb_terminal.terminal_helper import (
suppress_stdout,
welcome_message,
)
+from openbb_terminal.core.session import constants
+from openbb_terminal.core.session.current_settings import (
+ get_current_settings,
+ set_settings,
+)
+from openbb_terminal.core.session.current_user import (
+ get_platform_user,
+)
+from openbb_terminal.routines.routine_functions import is_reset, parse_openbb_script
PLATFORM_ROUTERS = {
d: "menu" if not isinstance(getattr(obb, d), BaseModel) else "command"
diff --git a/openbb_terminal/terminal_helper.py b/openbb_terminal/core/controllers/terminal_helper.py
index 758a41e983f..489fda66b95 100644
--- a/openbb_terminal/terminal_helper.py
+++ b/openbb_terminal/core/controllers/terminal_helper.py
@@ -12,6 +12,7 @@ from packaging import version
from openbb_terminal.core.config.paths import SETTINGS_ENV_FILE
from openbb_terminal.core.config.rich_config import console
+from openbb_terminal.core.controllers.helper_funcs import request
from openbb_terminal.core.session.constants import BackendEnvironment
from openbb_terminal.core.session.current_settings import (
get_current_settings,
@@ -23,7 +24,6 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.core.session.env_handler import load_env_files, write_to_dotenv
from openbb_terminal.core.session.utils import remove
-from openbb_terminal.helper_funcs import request
# pylint: disable=too-many-statements,no-member,too-many-branches,C0302
@@ -201,13 +201,13 @@ def reset(queue: Optional[List[str]] = None):
# pylint: disable=import-outside-toplevel
# we run the terminal again
if is_local():
- from openbb_terminal.terminal_controller import main
+ from openbb_terminal.core.controllers.terminal_controller import main
main(debug, dev, queue_list, module="") # type: ignore
else:
- from openbb_terminal.core.session import session_controller
+ from openbb_terminal.core.session import launcher
- session_controller.launch_terminal(queue=queue_list)
+ launcher.launch_terminal(queue=queue_list)
except Exception as e:
console.print(f"Unfortunately, resetting wasn't possible: {e}\n")
diff --git a/openbb_terminal/core/session/session_controller.py b/openbb_terminal/core/session/launcher.py
index 27ca3e2cd57..69b6d031d96 100644
--- a/openbb_terminal/core/session/session_controller.py
+++ b/openbb_terminal/core/session/launcher.py
@@ -7,7 +7,7 @@ def launch_terminal(
):
"""Launch terminal"""
# pylint: disable=import-outside-toplevel
- from openbb_terminal import terminal_controller
+ from openbb_terminal.core.controllers import terminal_controller
if queue:
return terminal_controller.main(debug, dev, queue, module="")
diff --git a/openbb_terminal/routines/account_view.py b/openbb_terminal/routines/account_view.py
index 25c66cbbe32..564aa3f88cd 100644
--- a/openbb_terminal/routines/account_view.py
+++ b/openbb_terminal/routines/account_view.py
@@ -1,7 +1,9 @@
import pandas as pd
from openbb_terminal.core.config.rich_config import console
-from openbb_terminal.helper_funcs import print_rich_table
+from openbb_terminal.core.controllers.helper_funcs import print_rich_table
+
+# TODO: Check if this module is still in use
def clean_df(df: pd.DataFrame) -> pd.DataFrame: