Skip to content

Commit

Permalink
Removed match statement for backwards compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
shner-elmo committed Nov 19, 2023
1 parent d3b3471 commit a576920
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/tradingview_screener/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,19 @@ def set_markets(self, *markets: str) -> Query:
:param markets: one or more markets from `tradingview_screener.constants.MARKETS`
:return: Self
"""
match markets:
case [single_market]:
assert single_market in MARKETS
if len(markets) == 1:
market = markets[0]
assert market in MARKETS

self.url = URL.format(market=single_market)
self.query['markets'] = [single_market]
self.url = URL.format(market=market)
self.query['markets'] = [market]

case [*multiple_markets]:
for m in multiple_markets:
assert m in MARKETS
elif len(markets) >= 1:
for m in markets:
assert m in MARKETS

self.url = URL.format(market='global')
self.query['markets'] = multiple_markets
self.url = URL.format(market='global')
self.query['markets'] = list(markets)

return self

Expand Down

0 comments on commit a576920

Please sign in to comment.