mypy-zope icon indicating copy to clipboard operation
mypy-zope copied to clipboard

convert a protocol to an interface

Open graingert opened this issue 3 years ago • 3 comments

it should be possible to create a zope.interface.Interface by introspecting a typing.Protocol

class SomeProtocol(typing.Protocol):
    @property
    def foo(self) -> str: ...

    def ham(self) -> int: ...

ISome = mypy_zope.fromProtocol("ISome", SomeProtocol)

graingert avatar Apr 01 '21 23:04 graingert