Change how Literal is used

This commit is contained in:
Igor Radovanovic
2023-10-11 19:26:43 +02:00
parent 5b103f0f2a
commit 4356c7ae91
3 changed files with 6 additions and 3 deletions

View File

@@ -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"
)

View File

@@ -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"
)

View File

@@ -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"
)