Change _is_file to return booleans and never raise anything.
parent
babff61ec2
commit
058c6f6ca8
9
gnupg.py
9
gnupg.py
|
@ -554,11 +554,12 @@ def _is_file(input):
|
|||
:func:`os.path.isfile`.
|
||||
"""
|
||||
try:
|
||||
assert os.lstat(input).st_size > 0, "not a file"
|
||||
except AssertionError as ae:
|
||||
raise ProtectedOption(ae.message)
|
||||
except TypeError:
|
||||
assert os.lstat(input).st_size > 0, "not a file: %s" % input
|
||||
except (AssertionError, TypeError) as error:
|
||||
logger.debug(error.message)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def _has_readwrite(path):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue