mirror of
https://github.com/storytold/lightcraft.git
synced 2026-12-02 20:19:40 -05:00
showcase: check the file is readable without an empty with-block (#3001)
This commit is contained in:
1 parent
387bed199f
commit
8020cd081c
2 files changed
+1
-2
No files matched your search
Binary file not shown.
@@ -14,8 +14,7 @@ def _jsonl_path(arg):
|
|||||||
if not path.is_file():
|
if not path.is_file():
|
||||||
sys.exit(f"not a readable file: {arg}")
|
sys.exit(f"not a readable file: {arg}")
|
||||||
try:
|
try:
|
||||||
with path.open("rb"):
|
path.open("rb").close()
|
||||||
pass
|
|
||||||
except OSError:
|
except OSError:
|
||||||
sys.exit(f"not a readable file: {arg}")
|
sys.exit(f"not a readable file: {arg}")
|
||||||
return path
|
return path
|
||||||
|
|||||||
Reference in new issue
Block a user