mhammond / pywin32

Python for Windows (pywin32) Extensions
5.01k stars 792 forks source link

Redundant open modes #2121

Closed Avasam closed 11 months ago

Avasam commented 1 year ago

From https://github.com/mhammond/pywin32/pull/2100#issuecomment-1730090462 Automated changes ran using ruff . --select=UP015 --exclude=Pythonwin/Scintilla --fix (Ruff re-implements pyupgrade and is configurable) https://docs.astral.sh/ruff/rules/redundant-open-modes/

mhammond commented 1 year ago

Sorry I didn't mention this in the referenced comment, but I'm fairly luke-warm on this - I really don't see a problem that some people might prefer explicit "r" and some might prefer to specify no args in that case. There can't be any confusion, so I'm really not sure this is actually adding value versus change for change's sake.

Avasam commented 1 year ago

No problem! You can close this PR if you'd like and the decision will be documented as such. (I myself prefer being explicit with open) I do think eventually implementing Flake8/Ruff (honestly Ruff is the go-to at this point, more linting coverage, formatter improvements over black, less checkers, much faster) in the CI at some point is a good idea. And this rule can then be excluded (referencing this conversation). Unlike pyupgrade which is barely configurable.