From 68dc4a3fa02c0110f0a731db983bbae7f3f64380 Mon Sep 17 00:00:00 2001 From: Theodore Aptekarev Date: Wed, 11 Oct 2023 19:08:02 +0200 Subject: [PATCH] More linting --- openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py | 6 +++++- .../providers/oecd/openbb_oecd/models/gdpreal.py | 6 +++++- openbb_platform/providers/oecd/tests/test_oecd_fetchers.py | 3 ++- openbb_terminal/economy/oecd_model.py | 5 ----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py b/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py index bbe5e2ce26c..18ff68cb8b6 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py @@ -52,7 +52,11 @@ class OECDGDPNomFetcher(Fetcher[OECDGDPNomQueryParams, List[OECDGDPNomData]]): **kwargs: Any, ) -> dict: unit = "MLN_USD" if query.units == "usd" else "USD_CAP" - url = f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.TOT.{unit}.A/OECD?contentType=csv&detail=code&separator=comma&csv-lang=en&startPeriod={query.start_date}&endPeriod={query.end_date}" + url = ( + f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.TOT.{unit}.A/OECD" + "?contentType=csv&detail=code&separator=comma&csv-lang=en" + f"&startPeriod={query.start_date}&endPeriod={query.end_date}" + ) data_df = helpers.fetch_data(url, csv_kwargs={"encoding": "utf-8"}, **kwargs) # Sometimes there is weird unicode characters in the column names, so we need to rename them. # Even changing the encoding on the fetch doesn't seem to help. diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py b/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py index 26dc99596bd..b61cd709a46 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py @@ -61,7 +61,11 @@ class OECDGDPRealFetcher(Fetcher[OECDGDPRealQueryParams, List[OECDGDPRealData]]) **kwargs: Any, ) -> dict: units = {"qoq": "PC_CHGPP", "yoy": "PC_CHGPY", "idx": "IDX"}[query.units] - url = f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.QGDP.{'VOLIDX' if units == 'IDX' else 'TOT'}.{units}.Q/OECD?contentType=csv&detail=code&separator=comma&csv-lang=en&startPeriod={query.start_date}&endPeriod={query.end_date}" + url = ( + f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.QGDP.{'VOLIDX' if units == 'IDX' else 'TOT'}" + f".{units}.Q/OECD?contentType=csv&detail=code&separator=comma&csv-lang=en" + f"&startPeriod={query.start_date}&endPeriod={query.end_date}" + ) data_df = helpers.fetch_data(url, csv_kwargs={"encoding": "utf-8"}, **kwargs) # Sometimes there is weird unicode characters in the column names, so we need to rename them. # Even changing the encoding on the fetch doesn't seem to help. diff --git a/openbb_platform/providers/oecd/tests/test_oecd_fetchers.py b/openbb_platform/providers/oecd/tests/test_oecd_fetchers.py index b1bfed598d1..08ba368ff99 100644 --- a/openbb_platform/providers/oecd/tests/test_oecd_fetchers.py +++ b/openbb_platform/providers/oecd/tests/test_oecd_fetchers.py @@ -1,9 +1,10 @@ import datetime + import pytest from openbb_core.app.service.user_service import UserService +from openbb_oecd.models.gdpforecast import OECDGDPForecastFetcher from openbb_oecd.models.gdpnom import OECDGDPNomFetcher from openbb_oecd.models.gdpreal import OECDGDPRealFetcher -from openbb_oecd.models.gdpforecast import OECDGDPForecastFetcher test_credentials = UserService().default_user_settings.credentials.dict() diff --git a/openbb_terminal/economy/oecd_model.py b/openbb_terminal/economy/oecd_model.py index f757ff6d880..bc8d7ad4739 100644 --- a/openbb_terminal/economy/oecd_model.py +++ b/openbb_terminal/economy/oecd_model.py @@ -540,11 +540,6 @@ def get_gdp( no_data_message(error=str(e)) return df - print( - f"https://stats.oecd.org/sdmx-json/data/DP_LIVE/.GDP.TOT.{units_dict[units]}.A/OECD?contentType=csv&detail=code" - f"&separator=comma&csv-lang=en&startPeriod={start_date}&endPeriod={end_date}" - ) - df = df.iloc[:, [0, 5]] result = pd.DataFrame()