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`.
|
:func:`os.path.isfile`.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
assert os.lstat(input).st_size > 0, "not a file"
|
assert os.lstat(input).st_size > 0, "not a file: %s" % input
|
||||||
except AssertionError as ae:
|
except (AssertionError, TypeError) as error:
|
||||||
raise ProtectedOption(ae.message)
|
logger.debug(error.message)
|
||||||
except TypeError:
|
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def _has_readwrite(path):
|
def _has_readwrite(path):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue