@@ -74,16 +74,22 @@ class CashFlowStatement:
7474 @staticmethod
7575 def from_dict (d ):
7676 return CashFlowStatement (
77- exchange_gains_losses = None
78- if "exchange_gains_losses" not in d
79- else ExchangeGainsLosses .from_dict (d ["exchange_gains_losses" ]),
80- net_cash_flow = None
81- if "net_cash_flow" not in d
82- else NetCashFlow .from_dict (d ["net_cash_flow" ]),
83- net_cash_flow_from_financing_activities = None
84- if "net_cash_flow_from_financing_activities" not in d
85- else NetCashFlowFromFinancingActivities .from_dict (
86- d ["net_cash_flow_from_financing_activities" ]
77+ exchange_gains_losses = (
78+ None
79+ if "exchange_gains_losses" not in d
80+ else ExchangeGainsLosses .from_dict (d ["exchange_gains_losses" ])
81+ ),
82+ net_cash_flow = (
83+ None
84+ if "net_cash_flow" not in d
85+ else NetCashFlow .from_dict (d ["net_cash_flow" ])
86+ ),
87+ net_cash_flow_from_financing_activities = (
88+ None
89+ if "net_cash_flow_from_financing_activities" not in d
90+ else NetCashFlowFromFinancingActivities .from_dict (
91+ d ["net_cash_flow_from_financing_activities" ]
92+ )
8793 ),
8894 )
8995
@@ -145,18 +151,24 @@ class ComprehensiveIncome:
145151 @staticmethod
146152 def from_dict (d ):
147153 return ComprehensiveIncome (
148- comprehensive_income_loss = None
149- if "comprehensive_income_loss" not in d
150- else ComprehensiveIncomeLoss .from_dict (d ["comprehensive_income_loss" ]),
151- comprehensive_income_loss_attributable_to_parent = None
152- if "comprehensive_income_loss_attributable_to_parent" not in d
153- else ComprehensiveIncomeLossAttributableToParent .from_dict (
154- d ["comprehensive_income_loss_attributable_to_parent" ]
154+ comprehensive_income_loss = (
155+ None
156+ if "comprehensive_income_loss" not in d
157+ else ComprehensiveIncomeLoss .from_dict (d ["comprehensive_income_loss" ])
158+ ),
159+ comprehensive_income_loss_attributable_to_parent = (
160+ None
161+ if "comprehensive_income_loss_attributable_to_parent" not in d
162+ else ComprehensiveIncomeLossAttributableToParent .from_dict (
163+ d ["comprehensive_income_loss_attributable_to_parent" ]
164+ )
155165 ),
156- other_comprehensive_income_loss = None
157- if "other_comprehensive_income_loss" not in d
158- else OtherComprehensiveIncomeLoss .from_dict (
159- d ["other_comprehensive_income_loss" ]
166+ other_comprehensive_income_loss = (
167+ None
168+ if "other_comprehensive_income_loss" not in d
169+ else OtherComprehensiveIncomeLoss .from_dict (
170+ d ["other_comprehensive_income_loss" ]
171+ )
160172 ),
161173 )
162174
@@ -248,18 +260,26 @@ class IncomeStatement:
248260 @staticmethod
249261 def from_dict (d ):
250262 return IncomeStatement (
251- basic_earnings_per_share = None
252- if "basic_earnings_per_share" not in d
253- else BasicEarningsPerShare .from_dict (d ["basic_earnings_per_share" ]),
254- cost_of_revenue = None
255- if "cost_of_revenue" not in d
256- else CostOfRevenue .from_dict (d ["cost_of_revenue" ]),
257- gross_profit = None
258- if "gross_profit" not in d
259- else GrossProfit .from_dict (d ["gross_profit" ]),
260- operating_expenses = None
261- if "operating_expenses" not in d
262- else OperatingExpenses .from_dict (d ["operating_expenses" ]),
263+ basic_earnings_per_share = (
264+ None
265+ if "basic_earnings_per_share" not in d
266+ else BasicEarningsPerShare .from_dict (d ["basic_earnings_per_share" ])
267+ ),
268+ cost_of_revenue = (
269+ None
270+ if "cost_of_revenue" not in d
271+ else CostOfRevenue .from_dict (d ["cost_of_revenue" ])
272+ ),
273+ gross_profit = (
274+ None
275+ if "gross_profit" not in d
276+ else GrossProfit .from_dict (d ["gross_profit" ])
277+ ),
278+ operating_expenses = (
279+ None
280+ if "operating_expenses" not in d
281+ else OperatingExpenses .from_dict (d ["operating_expenses" ])
282+ ),
263283 revenues = None if "revenues" not in d else Revenues .from_dict (d ["revenues" ]),
264284 )
265285
@@ -275,18 +295,28 @@ class Financials:
275295 @staticmethod
276296 def from_dict (d ):
277297 return Financials (
278- balance_sheet = None
279- if "balance_sheet" not in d
280- else {k : DataPoint .from_dict (v ) for (k , v ) in d ["balance_sheet" ].items ()},
281- cash_flow_statement = None
282- if "cash_flow_statement" not in d
283- else CashFlowStatement .from_dict (d ["cash_flow_statement" ]),
284- comprehensive_income = None
285- if "comprehensive_income" not in d
286- else ComprehensiveIncome .from_dict (d ["comprehensive_income" ]),
287- income_statement = None
288- if "income_statement" not in d
289- else IncomeStatement .from_dict (d ["income_statement" ]),
298+ balance_sheet = (
299+ None
300+ if "balance_sheet" not in d
301+ else {
302+ k : DataPoint .from_dict (v ) for (k , v ) in d ["balance_sheet" ].items ()
303+ }
304+ ),
305+ cash_flow_statement = (
306+ None
307+ if "cash_flow_statement" not in d
308+ else CashFlowStatement .from_dict (d ["cash_flow_statement" ])
309+ ),
310+ comprehensive_income = (
311+ None
312+ if "comprehensive_income" not in d
313+ else ComprehensiveIncome .from_dict (d ["comprehensive_income" ])
314+ ),
315+ income_statement = (
316+ None
317+ if "income_statement" not in d
318+ else IncomeStatement .from_dict (d ["income_statement" ])
319+ ),
290320 )
291321
292322
@@ -311,9 +341,9 @@ def from_dict(d):
311341 company_name = d .get ("company_name" , None ),
312342 end_date = d .get ("end_date" , None ),
313343 filing_date = d .get ("filing_date" , None ),
314- financials = None
315- if "financials" not in d
316- else Financials . from_dict ( d [ "financials" ] ),
344+ financials = (
345+ None if "financials" not in d else Financials . from_dict ( d [ "financials" ])
346+ ),
317347 fiscal_period = d .get ("fiscal_period" , None ),
318348 fiscal_year = d .get ("fiscal_year" , None ),
319349 source_filing_file_url = d .get ("source_filing_file_url" , None ),
0 commit comments