diff options
author | montezdesousa <79287829+montezdesousa@users.noreply.github.com> | 2024-03-08 11:58:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 11:58:23 +0000 |
commit | 8f3d3323e3d1635314e8f5ba02db57f6f55fdabc (patch) | |
tree | df9a6c5a6e7fa7e7501794cffd579558c702efad | |
parent | f24e9713792ddd4c69eb518029a9246e9597375e (diff) |
[Bugfix] - Lower case validator in standard models (#6172)
* add to_lower validator
* change validator name
* docstrings
* fix interval
76 files changed, 337 insertions, 168 deletions
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py b/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py index 7ffe2462b0a..4a4e76c796d 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/analyst_estimates.py @@ -1,7 +1,7 @@ """Analyst Estimates Standard Model.""" from datetime import date as dateType -from typing import List, Literal, Set, Union +from typing import List, Literal, Optional, Set, Union from pydantic import Field, field_validator @@ -24,10 +24,16 @@ class AnalystEstimatesQueryParams(QueryParams): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: str) -> str: - """Convert symbol to uppercase.""" + def to_upper(cls, v: str) -> str: + """Convert field to uppercase.""" return v.upper() + @field_validator("period", mode="before", check_fields=False) + @classmethod + def to_lower(cls, v: Optional[str]) -> Optional[str]: + """Convert field to lowercase.""" + return v.lower() if v else v + class AnalystEstimatesData(Data): """Analyst Estimates data.""" @@ -71,8 +77,8 @@ class AnalystEstimatesData(Data): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: Union[str, List[str], Set[str]]): - """Convert symbol to uppercase.""" + def to_upper(cls, v: Union[str, List[str], Set[str]]): + """Convert field to uppercase.""" if isinstance(v, str): return v.upper() return ",".join([symbol.upper() for symbol in list(v)]) if v else None diff --git a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py index 799b8ab197c..860b28bad1c 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet.py @@ -26,9 +26,16 @@ class BalanceSheetQueryParams(QueryParams): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: str): + def to_upper(cls, v: str): + """Convert field to uppercase.""" return v.upper() + @field_validator("period", mode="before", check_fields=False) + @classmethod + def to_lower(cls, v: Optional[str]) -> Optional[str]: + """Convert field to lowercase.""" + return v.lower() if v else v + class BalanceSheetData(Data): """Balance Sheet Data.""" diff --git a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py index 746eaacf0e3..e2aff45cb5d 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/balance_sheet_growth.py @@ -21,8 +21,8 @@ class BalanceSheetGrowthQueryParams(QueryParams): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: str): - """Convert symbol to uppercase.""" + def to_upper(cls, v: str): + """Convert field to uppercase.""" return v.upper() @@ -130,8 +130,8 @@ class BalanceSheetGrowthData(Data): @field_validator("symbol", mode="before", check_fields=False) @classmethod - def upper_symbol(cls, v: Union[str, List[str], Set[str]]): - |