enums_definition
error
access to an enum member that does not exist for the target
Enum members may be defined conditionally on a statically-known check such as the Python version:
class Color(Enum):
RED = 1
if sys.version_info >= (4, 0):
BLUE = 3 # absent when checking for 3.12
Color.BLUE # error — BLUE does not exist at the target version
This rule flags access to a member that was defined only under an if-guard that is statically false at the configured target. It is intentionally narrow — it never touches unconditional members, inherited attributes, or functional Enum(...) calls — so it cannot fire on valid code.
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
enums_definition 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/enums_definition