From afb4883fd97869cd102d09eaa4225a37bbf95b8e Mon Sep 17 00:00:00 2001 From: martinb-bb <105685594+martinb-bb@users.noreply.github.com> Date: Tue, 28 Feb 2023 14:18:00 -0500 Subject: [PATCH] linting for controller --- .../forecast/forecast_controller.py | 24 +------------------ openbb_terminal/forecast/whisper_model.py | 13 +++++++++- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/openbb_terminal/forecast/forecast_controller.py b/openbb_terminal/forecast/forecast_controller.py index 52dab20f617..4c2698ad125 100644 --- a/openbb_terminal/forecast/forecast_controller.py +++ b/openbb_terminal/forecast/forecast_controller.py @@ -32,6 +32,7 @@ try: from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE from openbb_terminal.forecast.whisper_utils import str2bool + transformers_ver = transformers.__version__ # if imports are successful, set flag to True WHISPER_AVAILABLE = True @@ -46,17 +47,6 @@ except ModuleNotFoundError: "pip install transformers \n" ) -try: - import yt_dlp -except ModuleNotFoundError: - raise ModuleNotFoundError( - "Please use poetry to install latest yt-dlp library and dependencies. \n" - "poetry install -E forecast \n" - "\n" - "If you are not using poetry, please install the yt_dlp library with the following command: \n" - "pip install yt_dlp \n" - ) - import pandas as pd import psutil @@ -116,18 +106,6 @@ from openbb_terminal.forecast import ( trans_view, whisper_model, ) -from openbb_terminal.helper_funcs import ( - EXPORT_ONLY_FIGURES_ALLOWED, - EXPORT_ONLY_RAW_DATA_ALLOWED, - NO_EXPORT, - check_positive, - check_positive_float, - log_and_raise, - valid_date, -) -from openbb_terminal.menu import session -from openbb_terminal.parent_classes import BaseController -from openbb_terminal.rich_config import MenuText, console logger = logging.getLogger(__name__) empty_df = pd.DataFrame() diff --git a/openbb_terminal/forecast/whisper_model.py b/openbb_terminal/forecast/whisper_model.py index 7a6e36dfec2..a691ec76b41 100644 --- a/openbb_terminal/forecast/whisper_model.py +++ b/openbb_terminal/forecast/whisper_model.py @@ -8,7 +8,18 @@ import warnings from typing import Optional import whisper -import yt_dlp + +try: + import yt_dlp +except ModuleNotFoundError as exc: + raise ModuleNotFoundError( + "Please use poetry to install latest yt-dlp library and dependencies. \n" + "poetry install -E forecast \n" + "\n" + "If you are not using poetry, please install the yt_dlp library with the following command: \n" + "pip install yt_dlp \n" + ) from exc + from huggingface_hub import scan_cache_dir from tqdm import tqdm from transformers import BartForConditionalGeneration, BartTokenizer, pipeline