mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 04:31:13 +00:00
[Feature] Remove Python 3.9 (#7235)
* remove python 3.9 support and code * black * more cli lint * more linting * more lint * fix for tests * docstring grammar police * add lock to to build function to avoid async import race conditions * grammar police * lots more linting * relock
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
from datetime import (
|
||||
datetime,
|
||||
)
|
||||
from typing import Any, Literal, Optional
|
||||
from typing import Any, Literal
|
||||
|
||||
from openbb_core.app.model.abstract.error import OpenBBError
|
||||
from openbb_core.provider.abstract.fetcher import Fetcher
|
||||
@@ -82,7 +82,7 @@ class CftcCotFetcher(Fetcher[CftcCotQueryParams, list[CftcCotData]]):
|
||||
@staticmethod
|
||||
async def aextract_data(
|
||||
query: CftcCotQueryParams,
|
||||
credentials: Optional[dict[str, str]],
|
||||
credentials: dict[str, str] | None,
|
||||
**kwargs: Any,
|
||||
) -> list[dict]:
|
||||
"""Extract the data from the CFTC API."""
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any
|
||||
|
||||
from openbb_core.provider.abstract.fetcher import Fetcher
|
||||
from openbb_core.provider.standard_models.cot_search import (
|
||||
@@ -29,25 +29,25 @@ class CftcCotSearchData(CotSearchData):
|
||||
"subcategory": "commodity_subgroup_name",
|
||||
}
|
||||
|
||||
commodity: Optional[str] = Field(default=None, description="Name of the commodity.")
|
||||
commodity: str | None = Field(default=None, description="Name of the commodity.")
|
||||
|
||||
|
||||
class CftcCotSearchFetcher(Fetcher[CftcCotSearchQueryParams, List[CftcCotSearchData]]):
|
||||
class CftcCotSearchFetcher(Fetcher[CftcCotSearchQueryParams, list[CftcCotSearchData]]):
|
||||
"""CFTC COT Search Fetcher."""
|
||||
|
||||
require_credentials = False
|
||||
|
||||
@staticmethod
|
||||
def transform_query(params: Dict[str, Any]) -> CftcCotSearchQueryParams:
|
||||
def transform_query(params: dict[str, Any]) -> CftcCotSearchQueryParams:
|
||||
"""Transform the query params."""
|
||||
return CftcCotSearchQueryParams(**params)
|
||||
|
||||
@staticmethod
|
||||
def extract_data(
|
||||
query: CftcCotSearchQueryParams,
|
||||
credentials: Optional[Dict[str, str]],
|
||||
credentials: dict[str, str] | None,
|
||||
**kwargs: Any,
|
||||
) -> List[Dict]:
|
||||
) -> list[dict]:
|
||||
"""Search a curated list of CFTC Commitment of Traders Reports."""
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from importlib.resources import files # noqa
|
||||
@@ -83,8 +83,8 @@ class CftcCotSearchFetcher(Fetcher[CftcCotSearchQueryParams, List[CftcCotSearchD
|
||||
@staticmethod
|
||||
def transform_data(
|
||||
query: CotSearchQueryParams,
|
||||
data: List[Dict],
|
||||
data: list[dict],
|
||||
**kwargs: Any,
|
||||
) -> List[CftcCotSearchData]:
|
||||
) -> list[CftcCotSearchData]:
|
||||
"""Transform the data."""
|
||||
return [CftcCotSearchData.model_validate(d) for d in data]
|
||||
|
||||
Reference in New Issue
Block a user