From 0ecb7429553801f14080af62ef235cc0b906d628 Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:11:44 +0000 Subject: [PATCH] [Bug fix] - Fix package mypy (#6110) * fix: package mypy * types * black --- openbb_platform/core/openbb_core/app/model/abstract/tagged.py | 2 +- .../core/openbb_core/app/model/custom_parameter.py | 4 ++-- openbb_platform/core/openbb_core/app/static/container.py | 2 +- openbb_platform/core/openbb_core/app/static/utils/filters.py | 2 +- .../provider/standard_models/trailing_dividend_yield.py | 4 +++- openbb_platform/openbb/package/equity_fundamental.py | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openbb_platform/core/openbb_core/app/model/abstract/tagged.py b/openbb_platform/core/openbb_core/app/model/abstract/tagged.py index b71485bfc1d..134a2605567 100644 --- a/openbb_platform/core/openbb_core/app/model/abstract/tagged.py +++ b/openbb_platform/core/openbb_core/app/model/abstract/tagged.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from uuid_extensions import uuid7str +from uuid_extensions import uuid7str # type: ignore class Tagged(BaseModel): diff --git a/openbb_platform/core/openbb_core/app/model/custom_parameter.py b/openbb_platform/core/openbb_core/app/model/custom_parameter.py index be88d72aa85..0df8298e59e 100644 --- a/openbb_platform/core/openbb_core/app/model/custom_parameter.py +++ b/openbb_platform/core/openbb_core/app/model/custom_parameter.py @@ -1,12 +1,12 @@ import sys from dataclasses import dataclass -from typing import Optional +from typing import Dict, Optional # `slots` is available on Python >= 3.10 if sys.version_info >= (3, 10): slots_true = {"slots": True} else: - slots_true = {} + slots_true: Dict[str, bool] = {} class BaseMetadata: diff --git a/openbb_platform/core/openbb_core/app/static/container.py b/openbb_platform/core/openbb_core/app/static/container.py index 333f3913712..a8a38b62963 100644 --- a/openbb_platform/core/openbb_core/app/static/container.py +++ b/openbb_platform/core/openbb_core/app/static/container.py @@ -24,7 +24,7 @@ class Container: return getattr(obbject, "to_" + output_type)() def _get_provider( - self, choice: Optional[str], cmd: str, available: Tuple[str] + self, choice: Optional[str], cmd: str, available: Tuple[str, ...] ) -> str: """Get the provider to use in execution.""" if choice is None: diff --git a/openbb_platform/core/openbb_core/app/static/utils/filters.py b/openbb_platform/core/openbb_core/app/static/utils/filters.py index cccec2ada17..aaefb9a040f 100644 --- a/openbb_platform/core/openbb_core/app/static/utils/filters.py +++ b/openbb_platform/core/openbb_core/app/static/utils/filters.py @@ -7,7 +7,7 @@ from openbb_core.app.utils import check_single_item, convert_to_basemodel def filter_inputs( data_processing: bool = False, - extra_info: Optional[Dict[str, List[str]]] = None, + extra_info: Optional[Dict[str, Dict[str, List[str]]]] = None, **kwargs, ) -> dict: """Filter command inputs.""" diff --git a/openbb_platform/core/openbb_core/provider/standard_models/trailing_dividend_yield.py b/openbb_platform/core/openbb_core/provider/standard_models/trailing_dividend_yield.py index d9d4585c096..473d276d5e6 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/trailing_dividend_yield.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/trailing_dividend_yield.py @@ -16,7 +16,9 @@ from openbb_core.provider.utils.descriptions import ( class TrailingDivYieldQueryParams(QueryParams): """Trailing Dividend Yield Query.""" - symbol: str = Field(default=None, description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: Optional[str] = Field( + default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + ) limit: Optional[int] = Field( default=252, description=f"{QUERY_DESCRIPTIONS.get('limit', '')}" diff --git a/openbb_platform/openbb/package/equity_fundamental.py b/openbb_platform/openbb/package/equity_fundamental.py index 8e3b669d4ea..309021fe580 100644 --- a/openbb_platform/openbb/package/equity_fundamental.py +++ b/openbb_platform/openbb/package/equity_fundamental.py @@ -3443,7 +3443,7 @@ class ROUTER_equity_fundamental(Container): def trailing_dividend_yield( self, symbol: Annotated[ - str, OpenBBCustomParameter(description="Symbol to get data for.") + Optional[str], OpenBBCustomParameter(description="Symbol to get data for.") ] = None, limit: Annotated[ Optional[int], @@ -3458,7 +3458,7 @@ class ROUTER_equity_fundamental(Container): Parameters ---------- - symbol : str + symbol : Optional[str] Symbol to get data for. limit : Optional[int] The number of data entries to return. Default is 252, the number of trading days in a year.