no-shallow-container-type-guard
Do not claim typed container contents from a container-only type guard.
Why
TypeGuard and TypeIs let callers trust their declared narrowing. Checking only dict, list, or set does not validate keys, values, or elements, so callers can perform operations that fail at runtime.
Fix
Use object for unchecked container slots, or validate their contents when the narrower contract is required. Keep constrained input types that already prove the contents.
Examples
from typing import TypeGuard
def is_mapping(value: object) -> TypeGuard[dict[str, object]]: return isinstance(value, dict)from typing import TypeGuard
def is_mapping(value: object) -> TypeGuard[dict[object, object]]: return isinstance(value, dict)