Repository navigation
Fill in the missing type annotations in backend.cffi.* - #2215
Conversation
|
CI could use a rerun |
backend.cffi.*backend.cffi.*
That's not quite true, as explained in the typing spec (https://typing.python.org/en/latest/spec/concepts.html#union-types):
|
|
In this particular case, I think it's fine, because it doesn't reduce it at all or narrow anything. It's also invalid syntax on 3.9, causing the cffi backend to fail to import. I realize adding |
|
Thanks so much for your contributions and patience! |
Happy to help :) |
This increase type coverage by filling in the missing annotations for the public-facing symbols in the submodules of
zmq.backend.cffi.According to
pyrefly coverage check --public-only(and excludingzmq/tests), this increases type coverage by 7.65%, for a grand total of 93.17% ( 🎉 ).The remanining untyped typables live in
devices,eventloop,green,log, andsugar. My plan is to have a go at those next, with that oh-so-sweet 100% type coverage as (intermediate) life goal (see https://jorenham.github.io/typestats/dashboard/report/#pyzmq for details and some fancy pie charts).No behavior changes (modulo some trivial
asserts for type narroing purposes to appease mypy).Oh and because Python 3.9 is still supported I had to use
__future__.annotatiionsimports. So we can get rid of those once py39 support is dropped (it'd require stringifying some type-check-only annotations though, such asBuffer).No AI touched the code. I only used AI to review the annotations that I wrote myself and I'm pretty sure I'm human.