From 4356c7ae91a2b8054492d55a0bb8a3eaa3a65f22 Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:26:43 +0200 Subject: [PATCH] Change how Literal is used --- .../providers/oecd/openbb_oecd/models/gdpforecast.py | 3 ++- openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py | 3 ++- openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/gdpforecast.py b/openbb_platform/providers/oecd/openbb_oecd/models/gdpforecast.py index 4224f36f6a4..98cc93ce767 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/gdpforecast.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/gdpforecast.py @@ -11,12 +11,13 @@ from openbb_provider.standard_models.gdpforecast import ( from pydantic import Field, field_validator gdp_countries = tuple(constants.COUNTRY_TO_CODE_GDP_FORECAST.keys()) +GDPCountriesLiteral = Literal[gdp_countries] # type: ignore class OECDGDPForecastQueryParams(GDPForecastQueryParams): """GDP Forecast query.""" - country: Literal[*gdp_countries] = Field( + country: GDPCountriesLiteral = Field( description="Country to get GDP for.", default="united_states" ) diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py b/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py index bbe5e2ce26c..e10b0277b0d 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/gdpnom.py @@ -10,12 +10,13 @@ from openbb_provider.standard_models.gdpnom import GDPNomData, GDPNomQueryParams from pydantic import Field, field_validator gdp_countries = tuple(constants.COUNTRY_TO_CODE_GDP.keys()) +GDPCountriesLiteral = Literal[gdp_countries] # type: ignore class OECDGDPNomQueryParams(GDPNomQueryParams): """GDP query.""" - country: Literal[*gdp_countries] = Field( + country: GDPCountriesLiteral = Field( description="Country to get GDP for.", default="united_states" ) diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py b/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py index 26dc99596bd..ad49351290f 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/gdpreal.py @@ -10,12 +10,13 @@ from openbb_provider.standard_models.gdpreal import GDPRealData, GDPRealQueryPar from pydantic import Field, field_validator rgdp_countries = tuple(constants.COUNTRY_TO_CODE_RGDP.keys()) +RGDPCountriesLiteral = Literal[rgdp_countries] # type: ignore class OECDGDPRealQueryParams(GDPRealQueryParams): """GDP query.""" - country: Literal[*rgdp_countries] = Field( + country: RGDPCountriesLiteral = Field( description="Country to get GDP for.", default="united_states" )