typing overhaul + pre-commit updates #200
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
STILL WIP!!!
For a bit of a background, Im planning to go off the list of open typing issues and fix stuff. First one in the list was some BLE-related one, and when i cloned it and started working, noticed that
mypywasn't ignoring this (adafruit_ble) module due to the lack ofpy.typedon it. Then decided to open a quick PR to simply add such empty marker file... But, surprise, typing was very broken, so here we are, fixing it ;)Notes
optional-requirements.txtcircuitpython-stubsto run the testsasserton some places to concreteUnionandOptionaldown to one of their options.assert foo is not Nonebefore doingfoo.baron the very next line.py.typedwill be added on the final commit, when every single file passes the checksWhile working on this, i've made a couple upgrades to
pre-commit's configisortpylint(old version does not build/install on Py312)mypyRight now, only a couple errors are left. These, for some reason, are not spotted when running
pre-commit run --all-filesbut i get them running$ mypy adafruit_blemanually. Would like to know what the cause for this is, maybe related to pre-commit using its own virtual environment....