python: Type-annotate rpc.py
This has required a few code changes and turned up a few bugs.
The type annotations pass with mypy
.
Notable code changes:
With type annotations, variable assignment may no longer change the type of a variable. This has complicated a few things.
Note that some TODOs remain: I have no clear sense how to annotate
the library type from ctypes
, and better wrappers are needed in
some cases.