Esempio n. 1
0
 def cards_by_attr(attr_name):
     from service import json_data
     for set_code, card_set in json_data.items():
         for card in card_set.get("cards"):
             if attr_name in card:
                 card["set_code"] = set_code
                 yield card
Esempio n. 2
0
def populate_set_table(eng):
    conn = eng.connect()
    from service import json_data
    getter = itemgetter(*"code name border releaseDate type".split())
    for key, val in json_data.items():
        code, name, border, releaseDate, type = getter(val)
        conn.execute(card_set_table.insert().values(code=code, name=name, border=border,
                                                    releaseDate=releaseDate, type=type))
Esempio n. 3
0
 def generate_abridged_set():
     from service import json_data
     getter = itemgetter(*"artist type name imageName rarity layout".split())
     for set_code, v in json_data.items():
         for card in v.get("cards"):
             artist, type, name, imageName, rarity, layout = getter(card)
             new_card = {"artist": artist, "type": type, "name": name,
                         "imageName": imageName, "rarity": rarity, "layout": layout,
                         "set_code": set_code}
             yield new_card