Make cubecobra_csv an API
This commit is contained in:
parent
b52958aa81
commit
067e849973
8 changed files with 109 additions and 118 deletions
|
|
@ -2,26 +2,14 @@
|
|||
|
||||
import csv
|
||||
|
||||
import cube_json
|
||||
import cubecobra_csv
|
||||
|
||||
CUBE_NAME = 'TheElegantCube_fetched'
|
||||
|
||||
|
||||
def main():
|
||||
csv_path = cube_json.request_cube_csv('TheElegantCube_fetched', 'elegant')
|
||||
|
||||
core_cards = []
|
||||
with open(csv_path) as f:
|
||||
reader = csv.reader(f)
|
||||
header_line = next(reader)
|
||||
cubecobra_csv.assert_header(header_line)
|
||||
for line in reader:
|
||||
card = line[cubecobra_csv.COLUMNS['Name']]
|
||||
tags = line[cubecobra_csv.COLUMNS['Tags']].split(', ')
|
||||
if 'core' in tags:
|
||||
core_cards.append(card)
|
||||
|
||||
csv_path = cubecobra_csv.request_cube_csv('TheElegantCube_fetched', 'elegant')
|
||||
core_cards = cubecobra_csv.load_cube_names(csv_path, {'core'})
|
||||
core_cards.sort()
|
||||
for card in core_cards:
|
||||
print(card)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue