-
Notifications
You must be signed in to change notification settings - Fork 103
Delete Python 2 leftover #387
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
Conversation
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.
Thanks Dimitri! 🙏
Had one comment below
_json.dump(codec.get_config(), cf, sort_keys=True, indent=4) | ||
# load config and compare with expectation | ||
with open(codec_fn, mode='r') as cf: | ||
with open(codec_fn) as cf: |
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.
Could we keep the mode
here? Explicit is better than implicit
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.
I understand, but pyupgrade or refurb disagree and believe implicit is better than explicit 😄
I believe the rationale is that open() has many default arguments, and all of them are implicit (buffering, encoding, errors, newline, closefd, opener). That's why Python has default arguments. Why make an exception for mode?
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.
But then I don't have strong opinions on the subject. I was myself rather reluctant initially:
codespell-project/codespell#2364 (comment)
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.
Yeah mode
seems special since it affects whether the file may be modified (or even truncated) when opening
That said, not too worried about it given the placement (in the tests)
Have occasionally run into unexpected default behavior around mode
in some libraries. Hence the initial pause
Detected by pyugrade.
205a050
to
4c99200
Compare
Codecov Report
@@ Coverage Diff @@
## main #387 +/- ##
===========================================
+ Coverage 99.61% 100.00% +0.38%
===========================================
Files 54 53 -1
Lines 2101 2024 -77
===========================================
- Hits 2093 2024 -69
+ Misses 8 0 -8
|
Detected by pyugrade.
TODO: