[Twisted-Python] twistedchecker now uses pylint >= 2.4.4, can we use type annotations in Twisted now?

Craig Rodrigues rodrigc at crodrigues.org
Sun Jun 7 17:21:46 MDT 2020


I have merged a few PR's to trunk which eliminate hundreds of errors
encountered with:


*tox -e mypy*
I think we can take several passes with more PR's to whack away all these
mypy errors,
and turn on mypy as part of the default CI for Twisted.

I have seen a few errors like:

src/twisted/words/protocols/jabber/sasl_mechanisms.py:47:1: error:
'Anonymous' is missing following 'ISASLMechanism' interface members:
getResponse.  [misc]
    class Anonymous(object):
src/twisted/words/protocols/jabber/sasl_mechanisms.py:61:1: error: 'Plain'
is missing following 'ISASLMechanism' interface members: getResponse.
 [misc]
    class Plain(object):
src/twisted/internet/_dumbwin32proc.py:110:1: error: 'Process' is missing
following 'twisted.internet.interfaces.ITransport' interface members:
getHost, getPeer.  [misc]
    class Process(_pollingfile._PollingTimer, BaseProcess):
src/twisted/internet/process.py:959:1: error: 'PTYProcess' is missing
following 'twisted.internet.interfaces.ITransport' interface members:
getHost, getPeer.  [misc]
    class PTYProcess(abstract.FileDescriptor, _BaseProcess):
src/twisted/internet/process.py:959:1: error: 'PTYProcess' is missing
following 'IProcessTransport' interface members: closeChildFD,
writeToChild.  [misc]
    class PTYProcess(abstract.FileDescriptor, _BaseProcess):
src/twisted/internet/base.py:504:1: error: 'ReactorBase' is missing
following 'IReactorCore' interface members: run.  [misc]
    class ReactorBase(PluggableResolverMixin)


For a class to properly implement a Zope interface, is it mandatory that
it  implement every method in that interface?

If we modify the classes with mypy errors to properly implement these
methods (even with no-ops) is that the correct
way to go?

--
Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20200607/7522a25e/attachment.htm>


More information about the Twisted-Python mailing list