|
|
|
@ -90,7 +90,7 @@ def _txt_items(text, profile, skipped): |
|
|
|
regular = [re.compile(rf'^({date_re})(.{{{body_size}}})([A-Z ]{{2}})\s+(\S+)\s+(\S+)\s*$')] |
|
|
|
regular = [re.compile(rf'^({date_re})(.{{{body_size}}})([A-Z ]{{2}})\s+(\S+)\s+(\S+)\s*$')] |
|
|
|
if profile == 'OUROCARD_FULL_V1': |
|
|
|
if profile == 'OUROCARD_FULL_V1': |
|
|
|
regular.append(re.compile(rf'^({date_re})(.{{33}})([A-Za-z ]{{7}})\s+(\S+)\s+(\S+)\s*$')) |
|
|
|
regular.append(re.compile(rf'^({date_re})(.{{33}})([A-Za-z ]{{7}})\s+(\S+)\s+(\S+)\s*$')) |
|
|
|
payment = re.compile(rf'^({date_re})\s*(PGTO DEBITO CONTA.*?)200211\s+(\S+)\s+(\S+)\s*$') |
|
|
|
payment = re.compile(rf'^({date_re})\s*(PGTO DEBITO CONTA.*?)\s+(\S+)\s+(\S+)\s*$') |
|
|
|
section, section_count = '1', 0 |
|
|
|
section, section_count = '1', 0 |
|
|
|
for number, line in enumerate(text.splitlines(), 1): |
|
|
|
for number, line in enumerate(text.splitlines(), 1): |
|
|
|
locator = f'line:{number}' |
|
|
|
locator = f'line:{number}' |
|
|
|
@ -117,6 +117,8 @@ def _txt_items(text, profile, skipped): |
|
|
|
skipped['balance'] += 1 |
|
|
|
skipped['balance'] += 1 |
|
|
|
else: |
|
|
|
else: |
|
|
|
yield ParsedItem(locator, section, match[1], match[2].rstrip(), match[4], match[5]) |
|
|
|
yield ParsedItem(locator, section, match[1], match[2].rstrip(), match[4], match[5]) |
|
|
|
|
|
|
|
elif partial and not re.match(r'^\s*(?:\d{1,2}[./]|DATA\s+DE\s+EMISS)', line, re.I): |
|
|
|
|
|
|
|
skipped['metadata'] += 1 |
|
|
|
else: |
|
|
|
else: |
|
|
|
code = 'INVALID_ROW' if re.match(r'^\s*\d{1,2}[./]', line) else 'UNRECOGNIZED_LINE' |
|
|
|
code = 'INVALID_ROW' if re.match(r'^\s*\d{1,2}[./]', line) else 'UNRECOGNIZED_LINE' |
|
|
|
yield ParsedItem(locator, section, description=line, errors=(code,)) |
|
|
|
yield ParsedItem(locator, section, description=line, errors=(code,)) |
|
|
|
|