Delete Python 2 leftover#387
Conversation
jakirkham
left a comment
There was a problem hiding this comment.
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.
Could we keep the mode here? Explicit is better than implicit
There was a problem hiding this comment.
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.
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.
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: