prefer-immutable-module-constant
Nonempty uppercase module collections allow top-level membership or keys to change at runtime.
Why
A constant-looking collection can expose process-wide top-level mutation even when callers intend it as a read-only lookup table.
Fix
When the concrete collection API is not part of the contract, use a tuple for ordered values, a frozenset for membership, or a Mapping-typed immutable mapping for keyed values. Recursively freeze nested values when needed.
Examples
ROLE_NAMES = ["admin", "member"]ROLE_NAMES = ("admin", "member")ROLE_LABELS = {"admin": "Administrator"}from collections.abc import Mappingfrom types import MappingProxyType
ROLE_LABELS: Mapping[str, str] = MappingProxyType({"admin": "Administrator"})