mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 22:11:55 +00:00
Change how Literal is used
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user