BSK-E0067 error

Non-member referenced in LiteralEnumClass.X annotation

The LiteralEnumClass.X type is only valid when X is an actual enum member. Using it with a non-member (a method, property, lambda, nested class, private attribute, or nonmember()-wrapped attribute) is a type error.

from enum import Enum, nonmember
from typing import Literal

class Pet4(Enum):
    CAT = 1
    converter = lambda x: str(x)  # Non-member (lambda)

    def speak(self) -> None: ...  # Non-member (method)

converter: Literal[Pet4.converter]  # E — converter is not an enum member
speak: Literal[Pet4.speak]          # E — speak is not an enum member

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial BSK-E0067 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-E0067