mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
hotfix/fmp-replace-zero: Replace Zero with None in FMP Balance, Cash, Income (#5815)
* replace zeros with None in Balance, Cash, Income * black --------- Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
This commit is contained in:
@@ -92,6 +92,12 @@ class FMPBalanceSheetData(BalanceSheetData):
|
||||
default=None, description="Link to the final statement."
|
||||
)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def replace_zero(cls, values): # pylint: disable=no-self-argument
|
||||
"""Check for zero values and replace with None."""
|
||||
return {k: None if v == 0 else v for k, v in values.items()}
|
||||
|
||||
|
||||
class FMPBalanceSheetFetcher(
|
||||
Fetcher[
|
||||
|
||||
@@ -99,6 +99,12 @@ class FMPCashFlowStatementData(CashFlowStatementData):
|
||||
default=None, description="Link to the final statement."
|
||||
)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def replace_zero(cls, values): # pylint: disable=no-self-argument
|
||||
"""Check for zero values and replace with None."""
|
||||
return {k: None if v == 0 else v for k, v in values.items()}
|
||||
|
||||
|
||||
class FMPCashFlowStatementFetcher(
|
||||
Fetcher[
|
||||
|
||||
@@ -122,6 +122,12 @@ class FMPIncomeStatementData(IncomeStatementData):
|
||||
default=None, description="Final link to the income statement."
|
||||
)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def replace_zero(cls, values): # pylint: disable=no-self-argument
|
||||
"""Check for zero values and replace with None."""
|
||||
return {k: None if v == 0 else v for k, v in values.items()}
|
||||
|
||||
|
||||
class FMPIncomeStatementFetcher(
|
||||
Fetcher[
|
||||
|
||||
Reference in New Issue
Block a user