Derived from the flake8-use-pathlib linter.
Checks for uses of the open builtin.
open
pathlib offers a high-level API for path manipulation. When possible, using Path object methods such as Path.open() can improve readability over the open builtin.
pathlib
Path
Path.open()
with open("f1.py", "wb") as fp: Use instead: from pathlib import Path with Path("f1.py").open("wb") as fp: References# Python documentation: Path.open Python documentation: open PEP 428 Correspondence between os and pathlib Why you should be using pathlib No really, pathlib is great
Use instead:
from pathlib import Path with Path("f1.py").open("wb") as fp: References# Python documentation: Path.open Python documentation: open PEP 428 Correspondence between os and pathlib Why you should be using pathlib No really, pathlib is great
Path.open
os