-
Notifications
You must be signed in to change notification settings - Fork 25
Description
inlineCallbacks introduces two problems for type checking. First, it creates a decorator function that has a signature that is effectively:
def f(*a: Any, **kw: Any) -> T:
This means all possible calls to the function are allowed by a type checker, removing almost all value that a type checker could provide related to the function.
Second, GridSync's TwistedDeferred[T] makes the yield and send type of the generator Deferred[Any] and Any respectively. This makes the result of all yields and all future operations on them allowed, similarly removing almost all value that a type checker could provide.
async def is easier to annotate specifically such that a type checker can provide some value. And async def is otherwise basically feature equivalent to inlineCallbacks. So, GridSync should switch from inlineCallbacks to async def.
I propose to do this to gridsync/rootcap.py for now, to enable a refactoring to use tahoe-capabilities in support of #449.