Closed dgw closed 1 year ago
I'm seeing an additional failure on 3.7.16, looks like mypy
surfaced a subtle bug in that version's error handling:
00:12 [snoopjedi@denton ~/repos/sopel-src (mypy-error-cleanup)]
$ python3 -V && mypy -V && make mypy
Python 3.7.16
mypy 0.991 (compiled: yes)
mypy sopel
sopel/plugins/capabilities.py:64: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/capabilities.py:70: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/capabilities.py:71: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/capabilities.py:72: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/irc/backends.py:316: error: Module has no attribute "exceptions" [attr-defined]
sopel/irc/backends.py:319: error: Module has no attribute "exceptions" [attr-defined]
sopel/plugins/rules.py:1065: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1066: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1263: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1265: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/bot.py:59: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
Found 2 errors in 1 file (checked 86 source files)
make: *** [Makefile:9: mypy] Error 1
Looks like between 3.7 and 3.8, these exceptions were moved into a separate submodule but are still available at the module root. If we change asyncio.exceptions.*
to asyncio.*
on the failing lines, this resolves the issue.
I do like the asyncio.execeptions
spelling better, but adding ad-hoc version comparison code doesn't seem worth it here, especially as 3.7 approaches its EOL and a presumptive dropping of it from Sopel's support window.
Modulo this one wrinkle, this passes type-checking on all versions. Nice one!
Even in 3.12 alpha docs, there's no hint of those exceptions being removed from the asyncio
namespace, so I added a commit to fix it w/SnoopJ as co-author.
Looks like @SnoopJ's efforts to set up tox
locally went well. Incoming contrib/
PR? 😁
Description
This resolves all known errors in
mypy sopel
output, as of commit time. There are few enough other outstanding PRs, I don't think introducing new errors after this is merged will be much of an issue.(It would help if I started checking
make mypy
before merging things, to avoid introducing new errors after fixing this set of them… I'll try to remember that step.)Checklist
make qa
(runsmake quality
andmake test
)