def read_marc_file(part, f, pos=0): try: for data, int_length in fast_parse.read_file(f): loc = "marc:%s:%d:%d" % (part, pos, int_length) pos += int_length yield (pos, loc, data) except ValueError: print f raise
def read_marc_file(part, f, pos=0): """ Generator to step through bulk MARC data f. :param str part: :param str f: Full binary MARC data containing many records :param int pos: Start position within the data :rtype: (int, str, str) :return: (Next position, Current source_record name, Current single MARC record) """ for data, int_length in fast_parse.read_file(f): loc = "marc:%s:%d:%d" % (part, pos, int_length) pos += int_length yield (pos, loc, data)