Use "with suppress()" to suppress a python exception

This commit is contained in:
Luflosi
2020-01-09 16:21:56 +01:00
parent b6416cf8a9
commit 48728bdfdc

View File

@@ -336,11 +336,9 @@ def newer(dest, *sources):
except EnvironmentError:
return True
for s in sources:
try:
with suppress(FileNotFoundError):
if os.path.getmtime(s) >= dtime:
return True
except FileNotFoundError:
pass
return False