diff --git a/openbb_platform/providers/cboe/openbb_cboe/models/index_snapshots.py b/openbb_platform/providers/cboe/openbb_cboe/models/index_snapshots.py index cd0c703ea624..77313159449c 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/models/index_snapshots.py +++ b/openbb_platform/providers/cboe/openbb_cboe/models/index_snapshots.py @@ -21,7 +21,7 @@ class CboeIndexSnapshotsQueryParams(IndexSnapshotsQueryParams): Source: https://www.cboe.com/ """ - region: Literal[None, "us", "eu"] = Field( + region: Optional[Literal["us", "eu"]] = Field( default="us", ) @@ -89,7 +89,7 @@ def transform_query(params: Dict[str, Any]) -> CboeIndexSnapshotsQueryParams: @staticmethod async def aextract_data( query: CboeIndexSnapshotsQueryParams, - credentials: Optional[Dict[str, str]], + credentials: Optional[Dict[str, str]], # pylint: disable=unused-argument **kwargs: Any, ) -> List[Dict]: """Return the raw data from the Cboe endpoint""" @@ -104,12 +104,14 @@ async def aextract_data( @staticmethod def transform_data( - query: CboeIndexSnapshotsQueryParams, data: dict, **kwargs: Any + query: CboeIndexSnapshotsQueryParams, # pylint: disable=unused-argument + data: dict, + **kwargs: Any, # pylint: disable=unused-argument ) -> List[CboeIndexSnapshotsData]: """Transform the data to the standard format""" if not data: raise EmptyDataError() - data = DataFrame(data) + df = DataFrame(data) percent_cols = [ "price_change_percent", "iv30", @@ -117,10 +119,10 @@ def transform_data( "iv30_change_percent", ] for col in percent_cols: - if col in data.columns: - data[col] = round(data[col] / 100, 6) - data = ( - data.replace(0, None) + if col in df.columns: + df[col] = round(df[col] / 100, 6) + df = ( + df.replace(0, None) .replace("", None) .dropna(how="all", axis=1) .fillna("N/A") @@ -135,9 +137,9 @@ def transform_data( "bid_size", ] for col in drop_cols: - if col in data.columns: - data = data.drop(columns=col) + if col in df.columns: + df = df.drop(columns=col) return [ CboeIndexSnapshotsData.model_validate(d) - for d in data.to_dict(orient="records") + for d in df.to_dict(orient="records") ] diff --git a/openbb_platform/providers/fred/openbb_fred/models/search.py b/openbb_platform/providers/fred/openbb_fred/models/search.py index 99bf76c71836..0681472256a9 100644 --- a/openbb_platform/providers/fred/openbb_fred/models/search.py +++ b/openbb_platform/providers/fred/openbb_fred/models/search.py @@ -41,8 +41,8 @@ class FredSearchQueryParams(SearchQueryParams): default=0, description="Offset the results in conjunction with limit.", ) - filter_variable: Literal[None, "frequency", "units", "seasonal_adjustment"] = Field( - default=None, description="Filter by an attribute." + filter_variable: Optional[Literal["frequency", "units", "seasonal_adjustment"]] = ( + Field(default=None, description="Filter by an attribute.") ) filter_value: Optional[str] = Field( default=None, diff --git a/openbb_platform/providers/fred/openbb_fred/models/series.py b/openbb_platform/providers/fred/openbb_fred/models/series.py index 7c1108e73f3c..36e5f911c579 100644 --- a/openbb_platform/providers/fred/openbb_fred/models/series.py +++ b/openbb_platform/providers/fred/openbb_fred/models/series.py @@ -30,22 +30,23 @@ class FredSeriesQueryParams(SeriesQueryParams): } __json_schema_extra__ = {"symbol": ["multiple_items_allowed"]} - frequency: Literal[ - None, - "a", - "q", - "m", - "w", - "d", - "wef", - "weth", - "wew", - "wetu", - "wem", - "wesu", - "wesa", - "bwew", - "bwem", + frequency: Optional[ + Literal[ + "a", + "q", + "m", + "w", + "d", + "wef", + "weth", + "wew", + "wetu", + "wem", + "wesu", + "wesa", + "bwew", + "bwem", + ] ] = Field( default=None, description=""" @@ -67,7 +68,7 @@ class FredSeriesQueryParams(SeriesQueryParams): bwem = Biweekly, Ending Monday """, ) - aggregation_method: Literal[None, "avg", "sum", "eop"] = Field( + aggregation_method: Optional[Literal["avg", "sum", "eop"]] = Field( default="eop", description=""" A key that indicates the aggregation method used for frequency aggregation. @@ -77,10 +78,11 @@ class FredSeriesQueryParams(SeriesQueryParams): eop = End of Period """, ) - transform: Literal[None, "chg", "ch1", "pch", "pc1", "pca", "cch", "cca", "log"] = ( - Field( - default=None, - description=""" + transform: Optional[ + Literal["chg", "ch1", "pch", "pc1", "pca", "cch", "cca", "log"] + ] = Field( + default=None, + description=""" Transformation type None = No transformation chg = Change @@ -92,7 +94,6 @@ class FredSeriesQueryParams(SeriesQueryParams): cca = Continuously Compounded Annual Rate of Change log = Natural Log """, - ) ) limit: int = Field(description=QUERY_DESCRIPTIONS.get("limit", ""), default=100000) diff --git a/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py b/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py index a4fcc6efcca9..8892cfd770be 100644 --- a/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py +++ b/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py @@ -22,7 +22,7 @@ class GovernmentUSTreasuryPricesQueryParams(TreasuryPricesQueryParams): """US Government Treasury Prices Query.""" cusip: Optional[str] = Field(description="Filter by CUSIP.", default=None) - security_type: Literal[None, "bill", "note", "bond", "tips", "frn"] = Field( + security_type: Optional[Literal["bill", "note", "bond", "tips", "frn"]] = Field( description="Filter by security type.", default=None, ) diff --git a/openbb_platform/providers/polygon/openbb_polygon/models/cash_flow.py b/openbb_platform/providers/polygon/openbb_polygon/models/cash_flow.py index c0d6b366f85e..51d7f432a6f1 100644 --- a/openbb_platform/providers/polygon/openbb_polygon/models/cash_flow.py +++ b/openbb_platform/providers/polygon/openbb_polygon/models/cash_flow.py @@ -64,10 +64,10 @@ class PolygonCashFlowStatementQueryParams(CashFlowStatementQueryParams): default=False, description="Whether to include the sources of the financial statement.", ) - order: Literal[None, "asc", "desc"] = Field( + order: Optional[Literal["asc", "desc"]] = Field( default=None, description="Order of the financial statement." ) - sort: Literal[None, "filing_date", "period_of_report_date"] = Field( + sort: Optional[Literal["filing_date", "period_of_report_date"]] = Field( default=None, description="Sort of the financial statement." ) @@ -160,9 +160,9 @@ async def aextract_data( @staticmethod def transform_data( - query: PolygonCashFlowStatementQueryParams, + query: PolygonCashFlowStatementQueryParams, # pylint: disable=unused-argument data: dict, - **kwargs: Any, + **kwargs: Any, # pylint: disable=unused-argument ) -> List[PolygonCashFlowStatementData]: """Return the transformed data.""" transformed_data = [] diff --git a/openbb_platform/providers/tmx/openbb_tmx/models/index_snapshots.py b/openbb_platform/providers/tmx/openbb_tmx/models/index_snapshots.py index 2052991fff7d..e3f81710561f 100644 --- a/openbb_platform/providers/tmx/openbb_tmx/models/index_snapshots.py +++ b/openbb_platform/providers/tmx/openbb_tmx/models/index_snapshots.py @@ -24,7 +24,7 @@ class TmxIndexSnapshotsQueryParams(IndexSnapshotsQueryParams): """TMX Index Snapshots Query Params.""" - region: Literal[None, "ca", "us"] = Field(default="ca") # type: ignore + region: Optional[Literal["ca", "us"]] = Field(default="ca") # type: ignore use_cache: bool = Field( default=True, description="Whether to use a cached request."