def read(self, filename: str): """Read print counts from deckbox csv file.""" with open(filename, 'r') as deckbox_file: reader = csv.DictReader(deckbox_file) card_counts = (create_card_row(self.cdb, row) for row in reader) return counts.aggregate_print_counts( self.cdb, card_counts, strict=False)
def read(self, filename: str): """Read print counts from deckbox csv file.""" with open(filename, "r") as deckbox_file: reader = csv.DictReader(deckbox_file) card_counts = (create_card_row(self.cdb, row) for row in reader) return counts.aggregate_print_counts(self.cdb, card_counts, strict=False)
def read(self, filename: str): """Read print counts from an xlsx file.""" workbook = openpyxl.load_workbook(filename=filename, read_only=True) # pylint: disable=redefined-variable-type print_counts = {} for sheet in workbook.worksheets: if sheet.title not in self.cdb.code_to_card_set: if sheet.title in {'Sets', 'All Sets', 'All Cards'}: continue raise interface.DeserializationError( 'No known set with code {}'.format(sheet.title)) print_counts = counts.merge_print_counts( print_counts, counts.aggregate_print_counts( self.cdb, counts_from_sheet(sheet), strict=True)) return print_counts
def read(self, filename: str): """Read print counts from an xlsx file.""" workbook = openpyxl.load_workbook(filename=filename, read_only=True) print_counts = {} for sheet in workbook.worksheets: if sheet.title not in self.cdb.code_to_card_set: if sheet.title in {"Sets", "All Sets", "All Cards"}: continue raise interface.DeserializationError( "No known set with code {}".format(sheet.title)) print_counts = counts.merge_print_counts( print_counts, counts.aggregate_print_counts(self.cdb, counts_from_sheet(sheet), strict=True), ) return print_counts
def read(self, filename: str): """Read print counts from file.""" with open(filename, 'r') as csv_file: return counts.aggregate_print_counts( self.cdb, csv.DictReader(csv_file), strict=True)
def read(self, filename: str): """Read print counts from file.""" with open(filename, "r") as csv_file: return counts.aggregate_print_counts(self.cdb, csv.DictReader(csv_file), strict=True)
def test_aggregate_print_counts(cdb, card_rows, strict, expected): print_counts = counts.aggregate_print_counts(cdb, card_rows, strict) assert print_counts == expected