Skip to content

Commit

Permalink
Merge branch 'release/4.21.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Mar 19, 2020
2 parents af15d69 + 972259f commit 37109af
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ matrix:
env: TOXENV=py37
- python: '3.8'
env: TOXENV=py38
- python: '3.9-dev'
env: TOXENV=py39
# - python: '3.9-dev'
# env: TOXENV=py39
- python: 'pypy'
env: TOXENV=pypy

Expand Down
11 changes: 6 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ Basic parsing:
transactions = mt940.parse('mt940_tests/jejik/abnamro.sta')
print 'Transactions:'
print transactions
print('Transactions:')
print(transactions)
pprint.pprint(transactions.data)
print
print()
for transaction in transactions:
print 'Transaction: ', transaction
print('Transaction: ', transaction)
pprint.pprint(transaction.data)
Set opening / closing balance information on each transaction:

.. code-block:: python
Expand All @@ -105,7 +106,7 @@ Set opening / closing balance information on each transaction:
transactions.parse(data)
for transaction in transactions:
print 'Transaction: ', transaction
print('Transaction: ', transaction)
pprint.pprint(transaction.data)
Simple json encoding:
Expand Down
2 changes: 1 addition & 1 deletion mt940/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
statistics and manipulation.
'''.strip().split())
__email__ = 'wolph@wol.ph'
__version__ = '4.20.0'
__version__ = '4.21.0'
__license__ = 'BSD'
__copyright__ = 'Copyright 2015 Rick van Hattem (wolph)'
__url__ = 'https://github.com/WoLpH/mt940'
6 changes: 3 additions & 3 deletions mt940/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def normalize_tag_id(cls, tag_id):

return tag_id

def sanatize_tag_id_matches(self, matches):
def sanitize_tag_id_matches(self, matches):
i_next = 0
for i, match in enumerate(matches):
# match was rejected
Expand Down Expand Up @@ -401,7 +401,7 @@ def parse(self, data):
matches = list(tag_re.finditer(data))

# identify valid matches
valid_matches = list(self.sanatize_tag_id_matches(matches))
valid_matches = list(self.sanitize_tag_id_matches(matches))

for i, match in enumerate(valid_matches):
tag_id = self.normalize_tag_id(match.group('tag'))
Expand All @@ -414,7 +414,7 @@ def parse(self, data):
# regex matches have a `end()` and `start()` to indicate the start
# and end index of the match.

if valid_matches[i + 1:]:
if valid_matches[i + 1:i + 2]:
tag_data = \
data[match.end():valid_matches[i + 1].start()].strip()
else:
Expand Down
4 changes: 2 additions & 2 deletions mt940/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def parse(self, transactions, value):
self.logger.debug(
'matched (%d) %r against %r, got: %s',
len(value), value, self.pattern,
pprint.pformat(match.groupdict()))
match.groupdict())
else: # pragma: no cover
self.logger.error(
'matching (%d) %r against %r', len(value), value,
Expand All @@ -74,7 +74,7 @@ def parse(self, transactions, value):
if match:
self.logger.info('matched %r against %r, got: %s',
pattern, match.group(0),
pprint.pformat(match.groupdict()))
match.groupdict())
part_value = part_value[len(match.group(0)):]
else:
self.logger.error('no match for %r against %r',
Expand Down

0 comments on commit 37109af

Please sign in to comment.