API Documentation

Runtime validation library for attrs data classes.

exception attrs_strict.AttributeTypeError(value: Any, attribute: attr.Attribute[Any])[source]
exception attrs_strict.BadTypeError[source]
exception attrs_strict.CallableError(attribute: attr.Attribute[Any], callable_signature: inspect.Signature, expected_signature: type[Callable[..., Any]], mismatch_callable_arg: type[Any], expected_callable_arg: type[Any])[source]
exception attrs_strict.LiteralError(attribute: str, value: Any, literals: list[str])[source]
exception attrs_strict.TupleError(container: Any, attribute: type[Any] | None, tuple_types: tuple[type[Any]])[source]
exception attrs_strict.TypeValidationError[source]
exception attrs_strict.UnionError(container: Any, attribute: str, expected_type: type[Any])[source]
attrs_strict.type_validator(empty_ok: bool = True) Callable[[Any, attr.Attribute[Any], Any], None][source]

Validates the attributes using the type argument specified. If the type argument is not present, the attribute is considered valid.

Parameters:

empty_ok – Boolean flag that indicates if the field can be empty in case of a collection or None for builtin types.