mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-09-10 02:35:38 -05:00
refactor no cards found exit case to be more pythonic (#123)
replace counting loop with len()
This commit is contained in:
@@ -42,10 +42,7 @@ def parse_mtgs(mtgs, manual_cards=[], card_corrections=[], delete_cards=[], rela
|
||||
cards.remove(card)
|
||||
|
||||
# if we didn't find any cards, let's bail out to prevent overwriting good data
|
||||
count = 0
|
||||
for card in cards:
|
||||
count = count + 1
|
||||
if count < 1:
|
||||
if len(cards) < 1:
|
||||
sys.exit("No cards found, exiting to prevent file overwrite")
|
||||
|
||||
cards2 = []
|
||||
@@ -270,4 +267,4 @@ def list_mtgs_gallery(url=''):
|
||||
cardstree = tree.xpath('//*[contains(@class, "log-card")]')
|
||||
for child in cardstree:
|
||||
cards.append(child.text)
|
||||
return cards
|
||||
return cards
|
||||
|
||||
Reference in New Issue
Block a user