-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pyupgrade
to pre-commit
#174
Conversation
@@ -27,7 +27,7 @@ def extract(self, path_to_ipynb: Path) -> List[str]: | |||
|
|||
@staticmethod | |||
def _read_ipynb_file(path_to_ipynb: Path) -> Dict[str, Any]: | |||
with open(path_to_ipynb, "r") as f: | |||
with open(path_to_ipynb) as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -93,7 +93,7 @@ def test_cli_with_json_output(dir_with_venv_installed): | |||
|
|||
# assert that there is json output | |||
subprocess.run(shlex.split("poetry run deptry . -o deptry.json"), capture_output=True, text=True) | |||
with open("deptry.json", "r") as f: | |||
with open("deptry.json") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -8,7 +8,7 @@ def test_simple(tmp_path): | |||
with run_within_dir(tmp_path): | |||
JsonWriter(json_output="output.json").write(issues={"one": "two", "three": "four"}) | |||
|
|||
with open("output.json", "r") as f: | |||
with open("output.json") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## main #174 +/- ##
=====================================
Coverage 95.1% 95.1%
=====================================
Files 28 28
Lines 895 895
Branches 136 136
=====================================
Hits 852 852
Misses 28 28
Partials 15 15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
9cd2e41
to
a4d21cf
Compare
PR Checklist
docs
is updatedDescription of changes
Add https://github.com/asottile/pyupgrade/ to our pre-commit hooks.
The library rewrites code to newer syntax of Python versions, which will prove useful the day we drop support for Python 3.7.
A nice feature of
pyupgrade
is also https://github.com/asottile/pyupgrade/#python2-and-old-python3x-blocks, which will rewrite a conditional import whenever the Python version in the condition is not supported anymore.