BSK-E0114
error
Protocol isinstance/issubclass violations
Per PEP 544: - A protocol can be used as the second argument to isinstance() or issubclass() **only** if it is decorated with @runtime_checkable. - issubclass() can only be used with **non-data** protocols (protocols that define only methods, not data attributes).
from typing import Protocol, runtime_checkable
class Proto1(Protocol):
name: str
@runtime_checkable
class Proto2(Protocol):
name: str
def method(self) -> int: ...
isinstance(x, Proto1) # E — not @runtime_checkable
issubclass(x, Proto2) # E — data protocol in issubclass
issubclass(x, (Proto2, Proto1)) # E — tuple contains violating protocol
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
BSK-E0114 down per-file or per-path from your editor or
pyproject.toml, or fix the code
so it type-checks. See the Type System rules and
the complete diagnostic reference.
Canonical URL: https://www.basilisk-python.dev/errors/BSK-E0114