Enable flake8 annotations
In this pull request, we enable ruff's flake8-annotations rule.
One of the more major things this rule complains about is missing type annotations on self and cls arguments, so there are a lot of places that got Self and type[Self] annotations added respectfully, as there is not a way to specifically ignore self or cls in particular without missing others.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.63%. Comparing base (
c7801ae) to head (cf7df04). Report is 19 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3098 +/- ##
=======================================
Coverage 99.63% 99.63%
=======================================
Files 122 122
Lines 18380 18380
Branches 1222 1222
=======================================
Hits 18312 18312
Misses 47 47
Partials 21 21
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/trio/_channel.py | 100.00% <ø> (ø) |
|
| src/trio/_core/_instrumentation.py | 100.00% <100.00%> (ø) |
|
| src/trio/_core/_mock_clock.py | 100.00% <100.00%> (ø) |
|
| src/trio/_core/_run.py | 99.02% <ø> (ø) |
|
| src/trio/_dtls.py | 97.50% <100.00%> (ø) |
|
| src/trio/_file_io.py | 100.00% <100.00%> (ø) |
|
| src/trio/_highlevel_socket.py | 100.00% <100.00%> (ø) |
|
| src/trio/_repl.py | 100.00% <100.00%> (ø) |
|
| src/trio/_socket.py | 100.00% <100.00%> (ø) |
|
| src/trio/_subprocess_platform/__init__.py | 100.00% <100.00%> (ø) |
|
| ... and 12 more |
Actually, the self/cls issue is because this is enabling the deprecated
ANN101/ANN102rules. Those should be disabled. Also, I really don't see the point anyway in running any of our linters onnotes-to-self. Those are just historical test/example scripts, they're not supposed to be robust or anything. It just produces churn...
Did a force push basically redoing everything, much easier than manually undoing adding self everywhere
Actually, the self/cls issue is because this is enabling the deprecated
ANN101/ANN102rules. Those should be disabled. Also, I really don't see the point anyway in running any of our linters onnotes-to-self. Those are just historical test/example scripts, they're not supposed to be robust or anything. It just produces churn...
tbh, is there any reason to keep them around at all anymore? We could dump them in a gist and save a link somewhere if we want to save them somewhere (other than in the git history)
Could create a git tag to mark which commit is is with the last version.
Planning on merging this in a day or two unless anyone has any other comments.