Skip to main content

MixedAnnotatedAndDefaultStyleError

This class is a specialized exception raised when a function argument is defined using both an Annotated type hint and a default value style that conflict. It captures the argument name and the specific parameter types involved to provide a detailed error message regarding the incompatible definitions.

Attributes

AttributeTypeDescription
argument_namestrThe name of the function argument that has conflicting parameter definitions.
annotated_param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The type of parameter information extracted from the Annotated type hint.
default_param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The type of parameter information inferred from the argument's default value.

Constructor

Signature

def MixedAnnotatedAndDefaultStyleError(
argument_name: str,
annotated_param_type: type[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)],
default_param_type: type[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]
) - > null

Parameters

NameTypeDescription
argument_namestrThe name of the argument that has conflicting definitions.
annotated_param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The parameter type specified within the Annotated metadata.
default_param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The parameter type inferred from the default value.

Signature

def MixedAnnotatedAndDefaultStyleError(
argument_name: str,
annotated_param_type: type[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)],
default_param_type: type[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]
)

Parameters

NameTypeDescription
argument_namestrThe name of the function argument that has conflicting definitions.
annotated_param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The type of parameter metadata found within the Annotated type hint.
default_param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The type of parameter metadata found in the argument's default value.