Skip to content

Commit

Permalink
Fix poetry black lint check (#644)
Browse files Browse the repository at this point in the history
* Fix poetry black lint check

* Revert formatting changes to ws init
  • Loading branch information
justinpolygon authored Apr 29, 2024
1 parent 35b356f commit 9e83bd8
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 123 deletions.
1 change: 1 addition & 0 deletions examples/rest/demo_correlation_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
essential to do your own research or consult a financial advisor for
personalized advice when investing.
"""

import pandas as pd # type: ignore
import numpy as np # type: ignore
import seaborn as sns # type: ignore
Expand Down
32 changes: 20 additions & 12 deletions polygon/rest/models/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ class UpdateRules:
@staticmethod
def from_dict(d):
return UpdateRules(
consolidated=None
if "consolidated" not in d
else Consolidated.from_dict(d["consolidated"]),
market_center=None
if "market_center" not in d
else MarketCenter.from_dict(d["market_center"]),
consolidated=(
None
if "consolidated" not in d
else Consolidated.from_dict(d["consolidated"])
),
market_center=(
None
if "market_center" not in d
else MarketCenter.from_dict(d["market_center"])
),
)


Expand Down Expand Up @@ -82,11 +86,15 @@ def from_dict(d):
id=d.get("id", None),
legacy=d.get("legacy", None),
name=d.get("name", None),
sip_mapping=None
if "sip_mapping" not in d
else SipMapping.from_dict(d["sip_mapping"]),
sip_mapping=(
None
if "sip_mapping" not in d
else SipMapping.from_dict(d["sip_mapping"])
),
type=d.get("type", None),
update_rules=None
if "update_rules" not in d
else UpdateRules.from_dict(d["update_rules"]),
update_rules=(
None
if "update_rules" not in d
else UpdateRules.from_dict(d["update_rules"])
),
)
8 changes: 5 additions & 3 deletions polygon/rest/models/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class OptionsContract:
@staticmethod
def from_dict(d):
return OptionsContract(
additional_underlyings=None
if "additional_underlyings" not in d
else [Underlying.from_dict(u) for u in d["additional_underlyings"]],
additional_underlyings=(
None
if "additional_underlyings" not in d
else [Underlying.from_dict(u) for u in d["additional_underlyings"]]
),
cfi=d.get("cfi", None),
contract_type=d.get("contract_type", None),
correction=d.get("correction", None),
Expand Down
126 changes: 78 additions & 48 deletions polygon/rest/models/financials.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,22 @@ class CashFlowStatement:
@staticmethod
def from_dict(d):
return CashFlowStatement(
exchange_gains_losses=None
if "exchange_gains_losses" not in d
else ExchangeGainsLosses.from_dict(d["exchange_gains_losses"]),
net_cash_flow=None
if "net_cash_flow" not in d
else NetCashFlow.from_dict(d["net_cash_flow"]),
net_cash_flow_from_financing_activities=None
if "net_cash_flow_from_financing_activities" not in d
else NetCashFlowFromFinancingActivities.from_dict(
d["net_cash_flow_from_financing_activities"]
exchange_gains_losses=(
None
if "exchange_gains_losses" not in d
else ExchangeGainsLosses.from_dict(d["exchange_gains_losses"])
),
net_cash_flow=(
None
if "net_cash_flow" not in d
else NetCashFlow.from_dict(d["net_cash_flow"])
),
net_cash_flow_from_financing_activities=(
None
if "net_cash_flow_from_financing_activities" not in d
else NetCashFlowFromFinancingActivities.from_dict(
d["net_cash_flow_from_financing_activities"]
)
),
)

Expand Down Expand Up @@ -145,18 +151,24 @@ class ComprehensiveIncome:
@staticmethod
def from_dict(d):
return ComprehensiveIncome(
comprehensive_income_loss=None
if "comprehensive_income_loss" not in d
else ComprehensiveIncomeLoss.from_dict(d["comprehensive_income_loss"]),
comprehensive_income_loss_attributable_to_parent=None
if "comprehensive_income_loss_attributable_to_parent" not in d
else ComprehensiveIncomeLossAttributableToParent.from_dict(
d["comprehensive_income_loss_attributable_to_parent"]
comprehensive_income_loss=(
None
if "comprehensive_income_loss" not in d
else ComprehensiveIncomeLoss.from_dict(d["comprehensive_income_loss"])
),
comprehensive_income_loss_attributable_to_parent=(
None
if "comprehensive_income_loss_attributable_to_parent" not in d
else ComprehensiveIncomeLossAttributableToParent.from_dict(
d["comprehensive_income_loss_attributable_to_parent"]
)
),
other_comprehensive_income_loss=None
if "other_comprehensive_income_loss" not in d
else OtherComprehensiveIncomeLoss.from_dict(
d["other_comprehensive_income_loss"]
other_comprehensive_income_loss=(
None
if "other_comprehensive_income_loss" not in d
else OtherComprehensiveIncomeLoss.from_dict(
d["other_comprehensive_income_loss"]
)
),
)

Expand Down Expand Up @@ -248,18 +260,26 @@ class IncomeStatement:
@staticmethod
def from_dict(d):
return IncomeStatement(
basic_earnings_per_share=None
if "basic_earnings_per_share" not in d
else BasicEarningsPerShare.from_dict(d["basic_earnings_per_share"]),
cost_of_revenue=None
if "cost_of_revenue" not in d
else CostOfRevenue.from_dict(d["cost_of_revenue"]),
gross_profit=None
if "gross_profit" not in d
else GrossProfit.from_dict(d["gross_profit"]),
operating_expenses=None
if "operating_expenses" not in d
else OperatingExpenses.from_dict(d["operating_expenses"]),
basic_earnings_per_share=(
None
if "basic_earnings_per_share" not in d
else BasicEarningsPerShare.from_dict(d["basic_earnings_per_share"])
),
cost_of_revenue=(
None
if "cost_of_revenue" not in d
else CostOfRevenue.from_dict(d["cost_of_revenue"])
),
gross_profit=(
None
if "gross_profit" not in d
else GrossProfit.from_dict(d["gross_profit"])
),
operating_expenses=(
None
if "operating_expenses" not in d
else OperatingExpenses.from_dict(d["operating_expenses"])
),
revenues=None if "revenues" not in d else Revenues.from_dict(d["revenues"]),
)

Expand All @@ -275,18 +295,28 @@ class Financials:
@staticmethod
def from_dict(d):
return Financials(
balance_sheet=None
if "balance_sheet" not in d
else {k: DataPoint.from_dict(v) for (k, v) in d["balance_sheet"].items()},
cash_flow_statement=None
if "cash_flow_statement" not in d
else CashFlowStatement.from_dict(d["cash_flow_statement"]),
comprehensive_income=None
if "comprehensive_income" not in d
else ComprehensiveIncome.from_dict(d["comprehensive_income"]),
income_statement=None
if "income_statement" not in d
else IncomeStatement.from_dict(d["income_statement"]),
balance_sheet=(
None
if "balance_sheet" not in d
else {
k: DataPoint.from_dict(v) for (k, v) in d["balance_sheet"].items()
}
),
cash_flow_statement=(
None
if "cash_flow_statement" not in d
else CashFlowStatement.from_dict(d["cash_flow_statement"])
),
comprehensive_income=(
None
if "comprehensive_income" not in d
else ComprehensiveIncome.from_dict(d["comprehensive_income"])
),
income_statement=(
None
if "income_statement" not in d
else IncomeStatement.from_dict(d["income_statement"])
),
)


Expand All @@ -311,9 +341,9 @@ def from_dict(d):
company_name=d.get("company_name", None),
end_date=d.get("end_date", None),
filing_date=d.get("filing_date", None),
financials=None
if "financials" not in d
else Financials.from_dict(d["financials"]),
financials=(
None if "financials" not in d else Financials.from_dict(d["financials"])
),
fiscal_period=d.get("fiscal_period", None),
fiscal_year=d.get("fiscal_year", None),
source_filing_file_url=d.get("source_filing_file_url", None),
Expand Down
24 changes: 15 additions & 9 deletions polygon/rest/models/markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,22 @@ class MarketStatus:
def from_dict(d):
return MarketStatus(
after_hours=d.get("afterHours", None),
currencies=None
if "currencies" not in d
else MarketCurrencies.from_dict(d["currencies"]),
currencies=(
None
if "currencies" not in d
else MarketCurrencies.from_dict(d["currencies"])
),
early_hours=d.get("earlyHours", None),
exchanges=None
if "exchanges" not in d
else MarketExchanges.from_dict(d["exchanges"]),
indicesGroups=None
if "indicesGroups" not in d
else MarketIndices.from_dict(d["indicesGroups"]),
exchanges=(
None
if "exchanges" not in d
else MarketExchanges.from_dict(d["exchanges"])
),
indicesGroups=(
None
if "indicesGroups" not in d
else MarketIndices.from_dict(d["indicesGroups"])
),
market=d.get("market", None),
server_time=d.get("serverTime", None),
)
Loading

0 comments on commit 9e83bd8

Please sign in to comment.