refactor no cards found exit case to be more pythonic (#123)

replace counting loop with len()
This commit is contained in:
Lee Matos
2017-07-14 23:32:53 -04:00
committed by tritoch
parent 1e52497bc3
commit e4a5b51307

View File

@@ -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