def test_from_txt(self): """ # from_txt """ args = 'data/mtga-hazoret_aggro.txt' self.arg_print(args) res = ScryfallCardName.from_txt(args) for r in res: print(r) if r: pprint.pprint(r[0]._url) pprint.pprint(r[0].data)
def from_txt(cls, txtfile, **kwargs): """ Read cards from text file; default line format: <[amount] [name] ([set]) [collector_number]> """ scryings = ScryfallCardName.from_txt(txtfile, **kwargs) for lyst in scryings: if lyst: N = len(lyst) scry = lyst[0] yield N*[Card(**scry.data)] else: yield None