diff options
author | montezdesousa <79287829+montezdesousa@users.noreply.github.com> | 2023-03-15 14:25:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 14:25:59 +0000 |
commit | b19dc5205dfe934284ad833e92b6b4e6f776c2da (patch) | |
tree | 42373f53a561d13952eef96b1728a7b1adf827b5 | |
parent | 8bd7606120572d20fa8e403bbdd2d83d2ed1e6a6 (diff) |
Remove matplotlib references (#4479)
* remove theme refs
* will come for dtabento later
* remove theme refs except databento
* ruff
* remove mpl variables
* mpl still used in po
* move databento to plotly
* pylint
* ruff
* theme ref to openbb_terminal
* juans sugg
* fix: removed raw arg in `display_candle` which could return the dataframe and error, added figure to `export_data`
---------
Co-authored-by: teh_coderer <me@tehcoderer.com>
37 files changed, 64 insertions, 140 deletions
diff --git a/openbb_terminal/alternative/covid/covid_view.py b/openbb_terminal/alternative/covid/covid_view.py index 789df23cc21..6aac2c9606e 100644 --- a/openbb_terminal/alternative/covid/covid_view.py +++ b/openbb_terminal/alternative/covid/covid_view.py @@ -7,9 +7,8 @@ from typing import Optional, Union import pandas as pd -from openbb_terminal import OpenBBFigure +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.alternative.covid import covid_model -from openbb_terminal.config_terminal import theme from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data, print_rich_table from openbb_terminal.rich_config import console diff --git a/openbb_terminal/common/behavioural_analysis/google_view.py b/openbb_terminal/common/behavioural_analysis/google_view.py index 8f77ba49ac0..db1ab80aaf3 100644 --- a/openbb_terminal/common/behavioural_analysis/google_view.py +++ b/openbb_terminal/common/behavioural_analysis/google_view.py @@ -7,9 +7,8 @@ from typing import List, Optional, Union import pandas as pd -from openbb_terminal import OpenBBFigure +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.common.behavioural_analysis import google_model -from openbb_terminal.config_terminal import theme from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data, print_rich_table diff --git a/openbb_terminal/common/behavioural_analysis/twitter_view.py b/openbb_terminal/common/behavioural_analysis/twitter_view.py index 29a32d27e9d..fba72770628 100644 --- a/openbb_terminal/common/behavioural_analysis/twitter_view.py +++ b/openbb_terminal/common/behavioural_analysis/twitter_view.py @@ -9,9 +9,8 @@ import numpy as np import pandas as pd from dateutil import parser as dparse -from openbb_terminal import OpenBBFigure +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.common.behavioural_analysis import twitter_model -from openbb_terminal.config_terminal import theme from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data, get_closing_price from openbb_terminal.rich_config import console diff --git a/openbb_terminal/common/quantitative_analysis/qa_view.py b/openbb_terminal/common/quantitative_analysis/qa_view.py index 6237f2ab2f9..4b478b85567 100644 --- a/openbb_terminal/common/quantitative_analysis/qa_view.py +++ b/openbb_terminal/common/quantitative_analysis/qa_view.py @@ -18,9 +18,8 @@ from pandas.plotting import register_matplotlib_converters from scipy import stats from statsmodels.graphics.gofplots import qqplot -from openbb_terminal import OpenBBFigure +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.common.quantitative_analysis import qa_model -from openbb_terminal.config_terminal import theme from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data, print_rich_table from openbb_terminal.rich_config import console diff --git a/openbb_terminal/core/models/preferences_model.py b/openbb_terminal/core/models/preferences_model.py index 593f56240e7..3635e82dbdf 100644 --- a/openbb_terminal/core/models/preferences_model.py +++ b/openbb_terminal/core/models/preferences_model.py @@ -79,12 +79,10 @@ class PreferencesModel: MONITOR: NonNegativeInt = 0 # STYLE - # Color for `view` command data. All pyplot colors listed at: - # https://matplotlib.org/stable/gallery/color/named_colors.html - VIEW_COLOR: str = "tab:green" MPL_STYLE: str = "dark" PMF_STYLE: str = "dark" RICH_STYLE: str = "dark" + PLOT_STYLE: str = "dark" # PATHS PREFERRED_DATA_SOURCE_FILE: str = str(USER_DATA_SOURCES_DEFAULT_FILE) diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 49d7aa83591..c6425fbe774 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -212,7 +212,9 @@ class TerminalStyle: return colors -theme = TerminalStyle("dark", "dark") +theme = TerminalStyle( + get_current_user().preferences.PLOT_STYLE, get_current_user().preferences.RICH_STYLE +) theme.apply_style() diff --git a/openbb_terminal/core/plots/plotly_ta/ta_class.py b/openbb_terminal/core/plots/plotly_ta/ta_class.py index 6c6ce8e08f2..4d0b6c9ebd8 100644 --- a/openbb_terminal/core/plots/plotly_ta/ta_class.py +++ b/openbb_terminal/core/plots/plotly_ta/ta_class.py @@ -8,10 +8,9 @@ from typing import Any, Dict, List, Optional, Type, Union import pandas as pd -from openbb_terminal import OpenBBFigure +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.base_helpers import console from openbb_terminal.common.technical_analysis import ta_helpers -from openbb_terminal.config_terminal import theme from openbb_terminal.core.plots.plotly_ta.base import PltTA from openbb_terminal.core.plots.plotly_ta.data_classes import ChartIndicators diff --git a/openbb_terminal/core/sdk/sdk_helpers.py b/openbb_terminal/core/sdk/sdk_helpers.py index 8c21a43dfa6..0bf69fa28f5 100644 --- a/openbb_terminal/core/sdk/sdk_helpers.py +++ b/openbb_terminal/core/sdk/sdk_helpers.py @@ -336,7 +336,7 @@ import logging import openbb_terminal.config_terminal as cfg from openbb_terminal import helper_funcs as helper # noqa: F401 -from openbb_terminal.config_terminal import theme +from openbb_terminal.core.plots.plotly_helper import theme # noqa: F401 from openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model import Coin from openbb_terminal.dashboards.dashboards_controller import DashboardsController diff --git a/openbb_terminal/cryptocurrency/defi/llama_view.py b/openbb_terminal/cryptocurrency/defi/llama_view.py index 65b5587428f..49b49fb5d41 100644 --- a/openbb_terminal/cryptocurrency/defi/llama_view.py +++ b/openbb_terminal/cryptocurrency/defi/llama_view.py @@ -5,10 +5,7 @@ import logging import os from typing import Optional, Union -from openbb_terminal import ( - OpenBBFigure, - config_terminal as cfg, -) +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.cryptocurrency_helpers import read_data_file from openbb_terminal.cryptocurrency.defi import llama_model from openbb_terminal.decorators import log_start_end @@ -46,7 +43,7 @@ def display_grouped_defi_protocols( ) fig.set_title(f"Top {limit} dApp TVL grouped by chain") - colors = iter(cfg.theme.get_colors(reverse=True)) + colors = iter(theme.get_colors(reverse=True)) for chain in chains: chain_filter = df.loc[df.Chain == chain] diff --git a/openbb_terminal/cryptocurrency/due_diligence/coinglass_view.py b/openbb_terminal/cryptocurrency/due_diligence/coinglass_view.py index ccfc05b4bee..375565becbf 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/coinglass_view.py +++ b/openbb_terminal/cryptocurrency/due_diligence/coinglass_view.py @@ -4,8 +4,7 @@ from typing import Optional, Union import pandas as pd -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.due_diligence.coinglass_model import ( get_funding_rate, get_liquidations, diff --git a/openbb_terminal/cryptocurrency/due_diligence/finbrain_crypto_view.py b/openbb_terminal/cryptocurrency/due_diligence/finbrain_crypto_view.py index cee079910fb..68601534684 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/finbrain_crypto_view.py +++ b/openbb_terminal/cryptocurrency/due_diligence/finbrain_crypto_view.py @@ -8,12 +8,11 @@ from typing import Optional, Union import numpy as np import pandas as pd -from openbb_terminal import OpenBBFigure, rich_config +from openbb_terminal import OpenBBFigure, rich_config, theme from openbb_terminal.common.behavioural_analysis.finbrain_model import get_sentiment from openbb_terminal.common.behavioural_analysis.finbrain_view import ( lambda_sentiment_coloring, ) -from openbb_terminal.config_terminal import theme from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data from openbb_terminal.rich_config import console diff --git a/openbb_terminal/cryptocurrency/due_diligence/glassnode_view.py b/openbb_terminal/cryptocurrency/due_diligence/glassnode_view.py index 5b8d34391bc..7102d5ebf2f 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/glassnode_view.py +++ b/openbb_terminal/cryptocurrency/due_diligence/glassnode_view.py @@ -5,8 +5,7 @@ from typing import Optional, Union import numpy as np -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.due_diligence.glassnode_model import ( get_active_addresses, get_exchange_balances, diff --git a/openbb_terminal/cryptocurrency/due_diligence/messari_view.py b/openbb_terminal/cryptocurrency/due_diligence/messari_view.py index 7263ede047b..6977d467cb2 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/messari_view.py +++ b/openbb_terminal/cryptocurrency/due_diligence/messari_view.py @@ -11,8 +11,7 @@ from typing import Optional, Union import numpy as np import pandas as pd -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency import cryptocurrency_helpers from openbb_terminal.cryptocurrency.dataframe_helpers import prettify_paragraph from openbb_terminal.cryptocurrency.due_diligence.messari_model import ( diff --git a/openbb_terminal/cryptocurrency/nft/nftpricefloor_view.py b/openbb_terminal/cryptocurrency/nft/nftpricefloor_view.py index b7f499fc15c..69d472a6f01 100644 --- a/openbb_terminal/cryptocurrency/nft/nftpricefloor_view.py +++ b/openbb_terminal/cryptocurrency/nft/nftpricefloor_view.py @@ -7,8 +7,7 @@ import logging import os from typing import Optional, Union -from openbb_terminal.config_terminal import theme -from openbb_terminal import OpenBBFigure +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.nft import nftpricefloor_model from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data, print_rich_table diff --git a/openbb_terminal/cryptocurrency/onchain/shroom_view.py b/openbb_terminal/cryptocurrency/onchain/shroom_view.py index c9454ad2f8d..5e9f2d1606f 100644 --- a/openbb_terminal/cryptocurrency/onchain/shroom_view.py +++ b/openbb_terminal/cryptocurrency/onchain/shroom_view.py @@ -5,8 +5,7 @@ import logging import os from typing import Optional, Union -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.onchain.shroom_model import ( get_daily_transactions, get_dapp_stats, diff --git a/openbb_terminal/cryptocurrency/overview/blockchaincenter_view.py b/openbb_terminal/cryptocurrency/overview/blockchaincenter_view.py index 840b9d714ea..ec4b08e5973 100644 --- a/openbb_terminal/cryptocurrency/overview/blockchaincenter_view.py +++ b/openbb_terminal/cryptocurrency/overview/blockchaincenter_view.py @@ -4,8 +4,7 @@ import os from datetime import datetime from typing import Optional, Union -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.overview.blockchaincenter_model import ( DAYS, get_altcoin_index, diff --git a/openbb_terminal/cryptocurrency/overview/glassnode_view.py b/openbb_terminal/cryptocurrency/overview/glassnode_view.py index c19b4564b93..fc14ab24569 100644 --- a/openbb_terminal/cryptocurrency/overview/glassnode_view.py +++ b/openbb_terminal/cryptocurrency/overview/glassnode_view.py @@ -6,8 +6,7 @@ from typing import Optional import numpy as np import pandas as pd -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.overview.glassnode_model import get_btc_rainbow from openbb_terminal.decorators import check_api_key, log_start_end from openbb_terminal.helper_funcs import export_data diff --git a/openbb_terminal/cryptocurrency/overview/loanscan_view.py b/openbb_terminal/cryptocurrency/overview/loanscan_view.py index 8f3916a27ae..66cf2564cd8 100644 --- a/openbb_terminal/cryptocurrency/overview/loanscan_view.py +++ b/openbb_terminal/cryptocurrency/overview/loanscan_view.py @@ -5,10 +5,7 @@ from typing import Optional, Union import pandas as pd -from openbb_terminal import ( - OpenBBFigure, - config_terminal as cfg, -) +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.overview import loanscan_model from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import export_data, print_rich_table @@ -63,7 +60,7 @@ def display_crypto_rates( df_non_null = pd.melt(df.reset_index(), id_vars=["index"]).dropna() assets = df_non_null.variable.unique().tolist() - colors = iter(cfg.theme.get_colors(reverse=True)) + colors = iter(theme.get_colors(reverse=True)) for asset in assets: width = df_non_null.loc[(df_non_null.variable == asset)] diff --git a/openbb_terminal/cryptocurrency/overview/tokenterminal_view.py b/openbb_terminal/cryptocurrency/overview/tokenterminal_view.py index 6f55e6b0b25..0389c6a19b8 100644 --- a/openbb_terminal/cryptocurrency/overview/tokenterminal_view.py +++ b/openbb_terminal/cryptocurrency/overview/tokenterminal_view.py @@ -2,10 +2,7 @@ import logging import os -from openbb_terminal import ( - OpenBBFigure, - config_terminal as cfg, -) +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.cryptocurrency.overview.tokenterminal_model import ( CATEGORIES, METRICS, @@ -77,7 +74,7 @@ def display_fundamental_metrics( fig.add_bar( x=metric_series[:limit].index, y=metric_series[:limit].values, - marker_color=cfg.theme.get_colors(reverse=True)[:limit], + marker_color=theme.get_colors(reverse=True)[:limit], ) if category: diff --git a/openbb_terminal/economy/alphavantage_view.py b/openbb_terminal/economy/alphavantage_view.py index 579785b9eb4..7db0a0dc03e 100644 --- a/openbb_terminal/economy/alphavantage_view.py +++ b/openbb_terminal/economy/alphavantage_view.py @@ -5,8 +5,7 @@ import logging import os from typing import Optional, Union -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.decorators import check_api_key, log_start_end from openbb_terminal.economy import alphavantage_model from openbb_terminal.helper_funcs import export_data, print_rich_table diff --git a/openbb_terminal/etf/fmp_view.py b/openbb_terminal/etf/fmp_view.py index 41c014e44ed..6499aa3fc96 100644 --- a/openbb_terminal/etf/fmp_view.py +++ b/openbb_terminal/etf/fmp_view.py @@ -7,8 +7,7 @@ from typing import Optional import pandas as pd -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.decorators import log_start_end from openbb_terminal.etf import fmp_model from openbb_terminal.helper_funcs import ( diff --git a/openbb_terminal/forex/oanda/oanda_view.py b/openbb_terminal/forex/oanda/oanda_view.py index 477dece61eb..bbae3bec9d8 100644 --- a/openbb_terminal/forex/oanda/oanda_view.py +++ b/openbb_terminal/forex/oanda/oanda_view.py @@ -6,8 +6,7 @@ from typing import Dict, Optional, Union import pandas as pd -from openbb_terminal import OpenBBFigure -from openbb_terminal.config_terminal import theme +from openbb_terminal import OpenBBFigure, theme from openbb_terminal.core.plots.plotly_ta.ta_class import PlotlyTA from openbb_terminal.decorators import check_api_key, log_start_end from openbb_terminal.forex.oanda.oanda_model import ( diff --git a/openbb_terminal/futures/databento_vi |