0

This is my code:

from twisted.protocols.basic import LineReceiver
from twisted.internet.interfaces import ITransport

class AbcProtocol(LineReceiver):
    transport: ITransport

    def lineReceived(self, line: bytes) -> None:
        self.transport.write(line)

Then, I got a warning from pyright:
8 col 34-44 error| [Pyright reportGeneralTypeIssues] Expected 0 positional arguments [E]
I think, Pyright think the first parameter is just self and I shouldn't pass the self parameter.
Is there a way to let pyright understand the first parameter isn't self?
Or is there something wrong with my understanding?


The ITransport like this:

class ITransport(Interface):
    def write(data: bytes) -> None: ...

The first parameter is not self.
In examples of zope.interface document, the first parameter is not self.


I expected pyright doesn't generate any warning and understand first parameter.

gamecss
  • 7
  • 3

2 Answers2

0

pyright has declined to implement support for zope.interface so it will not be able to understand code written using Zope interfaces.

Jean-Paul Calderone
  • 47,755
  • 6
  • 94
  • 122
0

Switch to Mypy and enable the mypy-zope plugin that supports zope.interface.

Glyph
  • 31,152
  • 11
  • 87
  • 129