This is just a first pass, trying to make the annotations make sense. We
probably need to adjust some of them for packaging before the next
release.
The type annotations for libpathrs.so should be sufficient but it's a
bit unfortunate that ffi.NULL can't be listed as a possible return value
(a-la None with Optional). This makes the typing for errorinfo a little
dodgy, and the Error._fetch typing also is not entirely idiomatic (maybe
we need to have an overload to indicate that only actual ErrorIds return
an Error). It would be nice if we could do Literal[0..] but that syntax
doesn't exist.
This is just a first pass, trying to make the annotations make sense. We probably need to adjust some of them for packaging before the next release.
The type annotations for libpathrs.so should be sufficient but it's a bit unfortunate that ffi.NULL can't be listed as a possible return value (a-la None with Optional). This makes the typing for errorinfo a little dodgy, and the Error._fetch typing also is not entirely idiomatic (maybe we need to have an overload to indicate that only actual ErrorIds return an Error). It would be nice if we could do Literal[0..] but that syntax doesn't exist.
Signed-off-by: Aleksa Sarai cyphar@cyphar.com