Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting for upgrade to poetry black 23.7.0 #486

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/rest/crypto-exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

# loop over exchanges
for exchange in exchanges:

# verify this is an exchange
if isinstance(exchange, Exchange):

# print exchange info
print(
"{:<15}{} ({})".format(
Expand Down
2 changes: 0 additions & 2 deletions examples/rest/crypto-market_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# print date, name, and exchange
for holiday in holidays:

# verify this is an exchange
if isinstance(holiday, MarketHoliday):

print("{:<15}{:<15} ({})".format(holiday.date, holiday.name, holiday.exchange))
4 changes: 0 additions & 4 deletions examples/rest/crypto-snapshots_all_tickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@

# crunch some numbers
for item in snapshot:

# verify this is an TickerSnapshot
if isinstance(item, TickerSnapshot):

# verify this is an Agg
if isinstance(item.prev_day, Agg):

# verify this is a float
if isinstance(item.prev_day.open, float) and isinstance(
item.prev_day.close, float
):

percent_change = (
(item.prev_day.close - item.prev_day.open)
/ item.prev_day.open
Expand Down
6 changes: 0 additions & 6 deletions examples/rest/crypto-snapshots_gainers_losers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@

# print ticker with % change
for gainer in gainers:

# verify this is a TickerSnapshot
if isinstance(gainer, TickerSnapshot):

# verify this is a float
if isinstance(gainer.todays_change_percent, float):

print("{:<15}{:.2f} %".format(gainer.ticker, gainer.todays_change_percent))

print()
Expand All @@ -33,11 +30,8 @@

# print ticker with % change
for loser in losers:

# verify this is a TickerSnapshot
if isinstance(loser, TickerSnapshot):

# verify this is a float
if isinstance(loser.todays_change_percent, float):

print("{:<15}{:.2f} %".format(loser.ticker, loser.todays_change_percent))
2 changes: 1 addition & 1 deletion examples/rest/financials.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
financials = client.get_ticker_details("NFLX")
print(financials)

for (i, n) in enumerate(client.list_ticker_news("INTC", limit=5)):
for i, n in enumerate(client.list_ticker_news("INTC", limit=5)):
print(i, n)
if i == 5:
break
2 changes: 0 additions & 2 deletions examples/rest/forex-exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

# loop over exchanges
for exchange in exchanges:

# verify this is an exchange
if isinstance(exchange, Exchange):

# print exchange info
print(
"{:<15}{} ({})".format(
Expand Down
2 changes: 0 additions & 2 deletions examples/rest/forex-market_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# print date, name, and exchange
for holiday in holidays:

# verify this is an exchange
if isinstance(holiday, MarketHoliday):

print("{:<15}{:<15} ({})".format(holiday.date, holiday.name, holiday.exchange))
4 changes: 0 additions & 4 deletions examples/rest/forex-snapshots_all_tickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@

# crunch some numbers
for item in snapshot:

# verify this is an TickerSnapshot
if isinstance(item, TickerSnapshot):

# verify this is an Agg
if isinstance(item.prev_day, Agg):

# verify this is a float
if isinstance(item.prev_day.open, float) and isinstance(
item.prev_day.close, float
):

percent_change = (
(item.prev_day.close - item.prev_day.open)
/ item.prev_day.open
Expand Down
6 changes: 0 additions & 6 deletions examples/rest/forex-snapshots_gainers_losers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@

# print ticker with % change
for gainer in gainers:

# verify this is a TickerSnapshot
if isinstance(gainer, TickerSnapshot):

# verify this is a float
if isinstance(gainer.todays_change_percent, float):

print("{:<15}{:.2f} %".format(gainer.ticker, gainer.todays_change_percent))

print()
Expand All @@ -33,11 +30,8 @@

# print ticker with % change
for loser in losers:

# verify this is a TickerSnapshot
if isinstance(loser, TickerSnapshot):

# verify this is a float
if isinstance(loser.todays_change_percent, float):

print("{:<15}{:.2f} %".format(loser.ticker, loser.todays_change_percent))
2 changes: 0 additions & 2 deletions examples/rest/indices-market_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# print date, name, and exchange
for holiday in holidays:

# verify this is an exchange
if isinstance(holiday, MarketHoliday):

print("{:<15}{:<15} ({})".format(holiday.date, holiday.name, holiday.exchange))
2 changes: 0 additions & 2 deletions examples/rest/options-exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

# loop over exchanges
for exchange in exchanges:

# verify this is an exchange
if isinstance(exchange, Exchange):

# print exchange info
print(
"{:<15}{} ({})".format(
Expand Down
2 changes: 0 additions & 2 deletions examples/rest/options-market_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# print date, name, and exchange
for holiday in holidays:

# verify this is an exchange
if isinstance(holiday, MarketHoliday):

print("{:<15}{:<15} ({})".format(holiday.date, holiday.name, holiday.exchange))
2 changes: 0 additions & 2 deletions examples/rest/options-ticker_news.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

# print date + title
for index, item in enumerate(news):

# verify this is an agg
if isinstance(item, TickerNews):

print("{:<25}{:<15}".format(item.published_utc, item.title))

if index == 20:
Expand Down
3 changes: 0 additions & 3 deletions examples/rest/stocks-aggregates_bars_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@

# writing data
for agg in aggs:

# verify this is an agg
if isinstance(agg, Agg):

# verify this is an int
if isinstance(agg.timestamp, int):

writer.writerow(
{
"timestamp": datetime.datetime.fromtimestamp(agg.timestamp / 1000),
Expand Down
3 changes: 0 additions & 3 deletions examples/rest/stocks-aggregates_bars_highcharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,10 @@

# writing data
for agg in aggs:

# verify this is an agg
if isinstance(agg, Agg):

# verify this is an int
if isinstance(agg.timestamp, int):

new_record = {
"date": agg.timestamp,
"open": agg.open,
Expand Down
2 changes: 0 additions & 2 deletions examples/rest/stocks-exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

# loop over exchanges
for exchange in exchanges:

# verify this is an exchange
if isinstance(exchange, Exchange):

# print exchange info
print(
"{:<15}{} ({})".format(
Expand Down
2 changes: 0 additions & 2 deletions examples/rest/stocks-market_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# print date, name, and exchange
for holiday in holidays:

# verify this is an exchange
if isinstance(holiday, MarketHoliday):

print("{:<15}{:<15} ({})".format(holiday.date, holiday.name, holiday.exchange))
4 changes: 0 additions & 4 deletions examples/rest/stocks-snapshots_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@

# crunch some numbers
for item in snapshot:

# verify this is an TickerSnapshot
if isinstance(item, TickerSnapshot):

# verify this is an Agg
if isinstance(item.prev_day, Agg):

# verify this is a float
if isinstance(item.prev_day.open, float) and isinstance(
item.prev_day.close, float
):

percent_change = (
(item.prev_day.close - item.prev_day.open)
/ item.prev_day.open
Expand Down
6 changes: 0 additions & 6 deletions examples/rest/stocks-snapshots_gainers_losers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@

# print ticker with % change
for gainer in gainers:

# verify this is a TickerSnapshot
if isinstance(gainer, TickerSnapshot):

# verify this is a float
if isinstance(gainer.todays_change_percent, float):

print("{:<15}{:.2f} %".format(gainer.ticker, gainer.todays_change_percent))

print()
Expand All @@ -33,11 +30,8 @@

# print ticker with % change
for loser in losers:

# verify this is a TickerSnapshot
if isinstance(loser, TickerSnapshot):

# verify this is a float
if isinstance(loser.todays_change_percent, float):

print("{:<15}{:.2f} %".format(loser.ticker, loser.todays_change_percent))
2 changes: 0 additions & 2 deletions examples/rest/stocks-ticker_news.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

# print date + title
for index, item in enumerate(news):

# verify this is an agg
if isinstance(item, TickerNews):

print("{:<25}{:<15}".format(item.published_utc, item.title))

if index == 20:
Expand Down
3 changes: 0 additions & 3 deletions examples/rest/stocks-trades_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@

# loop through and count price * volume
for t in client.list_trades("DIS", "2023-02-07", limit=50000):

# verify this is an Trade
if isinstance(t, Trade):

# verify these are float
if isinstance(t.price, float) and isinstance(t.size, int):

money += t.price * t.size

# format the number so it's human readable
Expand Down
4 changes: 0 additions & 4 deletions examples/websocket/stocks-ws_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,21 @@ def handle_msg(msgs: List[WebSocketMessage]):
# print(m)

if type(m) == EquityTrade:

# verify this is a string
if isinstance(m.symbol, str):

if m.symbol in string_map:
string_map[m.symbol] += 1
else:
string_map[m.symbol] = 1

# verify these are float
if isinstance(m.price, float) and isinstance(m.size, int):

global cash_traded
cash_traded += m.price * m.size
# print(cash_traded)


def top_function():

# start timer
start_time = time.time()

Expand Down
4 changes: 2 additions & 2 deletions polygon/modelclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def modelclass(cls):
]

def init(self, *args, **kwargs):
for (i, a) in enumerate(args):
for i, a in enumerate(args):
if i < len(attributes):
self.__dict__[attributes[i]] = a
for (k, v) in kwargs.items():
for k, v in kwargs.items():
if k in attributes:
self.__dict__[k] = v

Expand Down
1 change: 0 additions & 1 deletion polygon/rest/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def get_ticker_events(
raw: bool = False,
options: Optional[RequestOptionBuilder] = None,
) -> Union[TickerChangeResults, HTTPResponse]:

"""
Get event history of ticker given particular point in time.
:param ticker: The ticker symbol of the asset.
Expand Down
1 change: 0 additions & 1 deletion test_rest/models/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_request_options_builder(self):
self.assertDictEqual(all_options, options.headers)

def test_header_update(self):

options = RequestOptionBuilder(
edge_id="test", edge_ip_address="test", edge_user="test"
)
Expand Down