Files
openide/python/python-psi-impl/resources/inspectionDescriptions/PyProtocolInspection.html
Louis Vignier 1869ec9da6 [codeInspection] Fix python inspection descriptions
GitOrigin-RevId: 56876a5dd073a06c3fcc92f63ed1f5674830bc25
2023-04-28 13:13:25 +00:00

25 lines
560 B
HTML

<html>
<body>
<p>Reports invalid definitions and usages of protocols introduced in
<a href="https://www.python.org/dev/peps/pep-0544/">PEP-544</a>.</p>
<p><b>Example:</b></p>
<pre><code>
from typing import Protocol
class MyProtocol(Protocol):
def method(self, p: int) -> str:
pass
class MyClass(MyProtocol):
def method(self, p: str) -> int: # Type of 'method' is not compatible with 'MyProtocol'
pass
class MyAnotherProtocol(MyClass, Protocol): # All bases of a protocol must be protocols
pass
</code></pre>
</body>
</html>