Skip to content

Commit 9e83bd8

Browse files
Fix poetry black lint check (#644)
* Fix poetry black lint check * Revert formatting changes to ws init
1 parent 35b356f commit 9e83bd8

File tree

7 files changed

+192
-123
lines changed

7 files changed

+192
-123
lines changed

examples/rest/demo_correlation_matrix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
essential to do your own research or consult a financial advisor for
4141
personalized advice when investing.
4242
"""
43+
4344
import pandas as pd # type: ignore
4445
import numpy as np # type: ignore
4546
import seaborn as sns # type: ignore

polygon/rest/models/conditions.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ class UpdateRules:
4747
@staticmethod
4848
def from_dict(d):
4949
return UpdateRules(
50-
consolidated=None
51-
if "consolidated" not in d
52-
else Consolidated.from_dict(d["consolidated"]),
53-
market_center=None
54-
if "market_center" not in d
55-
else MarketCenter.from_dict(d["market_center"]),
50+
consolidated=(
51+
None
52+
if "consolidated" not in d
53+
else Consolidated.from_dict(d["consolidated"])
54+
),
55+
market_center=(
56+
None
57+
if "market_center" not in d
58+
else MarketCenter.from_dict(d["market_center"])
59+
),
5660
)
5761

5862

@@ -82,11 +86,15 @@ def from_dict(d):
8286
id=d.get("id", None),
8387
legacy=d.get("legacy", None),
8488
name=d.get("name", None),
85-
sip_mapping=None
86-
if "sip_mapping" not in d
87-
else SipMapping.from_dict(d["sip_mapping"]),
89+
sip_mapping=(
90+
None
91+
if "sip_mapping" not in d
92+
else SipMapping.from_dict(d["sip_mapping"])
93+
),
8894
type=d.get("type", None),
89-
update_rules=None
90-
if "update_rules" not in d
91-
else UpdateRules.from_dict(d["update_rules"]),
95+
update_rules=(
96+
None
97+
if "update_rules" not in d
98+
else UpdateRules.from_dict(d["update_rules"])
99+
),
92100
)

polygon/rest/models/contracts.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ class OptionsContract:
3232
@staticmethod
3333
def from_dict(d):
3434
return OptionsContract(
35-
additional_underlyings=None
36-
if "additional_underlyings" not in d
37-
else [Underlying.from_dict(u) for u in d["additional_underlyings"]],
35+
additional_underlyings=(
36+
None
37+
if "additional_underlyings" not in d
38+
else [Underlying.from_dict(u) for u in d["additional_underlyings"]]
39+
),
3840
cfi=d.get("cfi", None),
3941
contract_type=d.get("contract_type", None),
4042
correction=d.get("correction", None),

polygon/rest/models/financials.py

Lines changed: 78 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -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),

polygon/rest/models/markets.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,22 @@ class MarketStatus:
7474
def from_dict(d):
7575
return MarketStatus(
7676
after_hours=d.get("afterHours", None),
77-
currencies=None
78-
if "currencies" not in d
79-
else MarketCurrencies.from_dict(d["currencies"]),
77+
currencies=(
78+
None
79+
if "currencies" not in d
80+
else MarketCurrencies.from_dict(d["currencies"])
81+
),
8082
early_hours=d.get("earlyHours", None),
81-
exchanges=None
82-
if "exchanges" not in d
83-
else MarketExchanges.from_dict(d["exchanges"]),
84-
indicesGroups=None
85-
if "indicesGroups" not in d
86-
else MarketIndices.from_dict(d["indicesGroups"]),
83+
exchanges=(
84+
None
85+
if "exchanges" not in d
86+
else MarketExchanges.from_dict(d["exchanges"])
87+
),
88+
indicesGroups=(
89+
None
90+
if "indicesGroups" not in d
91+
else MarketIndices.from_dict(d["indicesGroups"])
92+
),
8793
market=d.get("market", None),
8894
server_time=d.get("serverTime", None),
8995
)

0 commit comments

Comments
 (0)