diff --git a/fastapi/_compat/shared.py b/fastapi/_compat/shared.py index a82eeba08..3a11e88ac 100644 --- a/fastapi/_compat/shared.py +++ b/fastapi/_compat/shared.py @@ -60,7 +60,7 @@ def lenient_issubclass( def _annotation_is_sequence(annotation: Union[type[Any], None]) -> bool: if lenient_issubclass(annotation, (str, bytes)): return False - return lenient_issubclass(annotation, sequence_types) # type: ignore[arg-type] + return lenient_issubclass(annotation, sequence_types) def field_annotation_is_sequence(annotation: Union[type[Any], None]) -> bool: @@ -76,7 +76,7 @@ def field_annotation_is_sequence(annotation: Union[type[Any], None]) -> bool: def value_is_sequence(value: Any) -> bool: - return isinstance(value, sequence_types) and not isinstance(value, (str, bytes)) # type: ignore[arg-type] + return isinstance(value, sequence_types) and not isinstance(value, (str, bytes)) def _annotation_is_complex(annotation: Union[type[Any], None]) -> bool: diff --git a/fastapi/_compat/v2.py b/fastapi/_compat/v2.py index 9456873dd..c4fa49e40 100644 --- a/fastapi/_compat/v2.py +++ b/fastapi/_compat/v2.py @@ -457,7 +457,7 @@ def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: origin_type = get_origin(union_arg) or union_arg break assert issubclass(origin_type, shared.sequence_types) # type: ignore[arg-type] - return shared.sequence_annotation_to_type[origin_type](value) # type: ignore[no-any-return] + return shared.sequence_annotation_to_type[origin_type](value) # type: ignore[no-any-return,index] def get_missing_field_error(loc: tuple[str, ...]) -> dict[str, Any]: diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 5a461c505..3db006a91 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -915,7 +915,7 @@ async def _extract_form_body( and value_is_sequence(value) ): # For types - assert isinstance(value, sequence_types) # type: ignore[arg-type] + assert isinstance(value, sequence_types) results: list[Union[bytes, str]] = [] async def process_fn(