Skip to content

Commit

Permalink
Merge branch 'release/4.13.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Feb 11, 2019
2 parents eae26a4 + ff34ef4 commit 1188a54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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.13.0'
__version__ = '4.13.1'
__license__ = 'BSD'
__copyright__ = 'Copyright 2015 Rick van Hattem (wolph)'
__url__ = 'https://github.com/WoLpH/mt940'
8 changes: 7 additions & 1 deletion mt940/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ def parse(src, encoding=None):
:rtype: Transactions
'''

def safe_is_file(filename):
try:
return os.path.isfile(src)
except ValueError: # pragma: no cover
return False

if hasattr(src, 'read'): # pragma: no branch
data = src.read()
elif os.path.isfile(src):
elif safe_is_file(src):
return parse(open(src, 'rb').read())
elif hasattr(src, 'decode'):
exception = None
Expand Down

0 comments on commit 1188a54

Please sign in to comment.