text_lint.operations.mixins.parameter_validation.parameter_definition.ParameterDefinition
- class text_lint.operations.mixins.parameter_validation.parameter_definition.ParameterDefinition(attribute: Any, attribute_name: str, expected_type: Type[Any], optional: bool = False, of: Type[Any] | Tuple[Type[Any], Type[Any] | Tuple[Type[Any], AliasParameterOfType] | None] | None = None, validators: Tuple[Callable[[Any], bool], ...] = ())[source]
Bases:
objectEncapsulate a class attribute with validation constraints.
- __init__(attribute: Any, attribute_name: str, expected_type: Type[Any], optional: bool = False, of: Type[Any] | Tuple[Type[Any], Type[Any] | Tuple[Type[Any], AliasParameterOfType] | None] | None = None, validators: Tuple[Callable[[Any], bool], ...] = ()) None[source]
Instantiate ParameterDefinition instances.
- Parameters:
attribute (Any) – The value of the attribute being encapsulated.
attribute_name (str) – The name of the attribute being encapsulated.
expected_type (Type[Any]) – The type the attribute should conform to.
optional (bool) – A boolean which allows the attribute to be optional.
of (Type[Any] | Tuple[Type[Any], Type[Any] | Tuple[Type[Any], AliasParameterOfType] | None] | None) – Required for container types, defines the nested value types.
validators (Tuple[Callable[[Any], bool], ...]) – A tuple of validator functions for this attribute.