Skip to content

Commit

Permalink
fix: Use dict[str, Any] for validated_data (#49)
Browse files Browse the repository at this point in the history
> TODO(sbdchd): figure out how hard it would be to make this return a dict[str, Any]

Turned out not hard at all ;)
  • Loading branch information
last-partizan authored Sep 14, 2024
1 parent 962df60 commit 5bf5fbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rest_framework-stubs/serializers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Serializer(BaseSerializer, metaclass=SerializerMetaclass):
def get_initial(self) -> Any: ...
fields: Any
def get_fields(self) -> dict[str, Field[Any, Any, Any, Any]]: ...
def validate(self, attrs: Any) -> Any: ...
def validate(self, attrs: dict[str, Any]) -> dict[str, Any]: ...
def __iter__(self) -> Iterator[str]: ...
def __getitem__(self, key: str) -> BoundField: ...
def _read_only_defaults(self) -> dict[str, Any]: ...
Expand Down Expand Up @@ -219,8 +219,8 @@ class ModelSerializer(Serializer, BaseSerializer):
allow_null: bool = ...,
allow_empty: bool = ...,
): ...
def update(self, instance: Any, validated_data: Any) -> Any: ...
def create(self, validated_data: Any) -> Any: ...
def update(self, instance: Any, validated_data: dict[str, Any]) -> Any: ...
def create(self, validated_data: dict[str, Any]) -> Any: ...
def save(self, **kwargs: Any) -> Any: ...
def to_representation(self, instance: Any) -> Any: ...
def get_field_names(
Expand Down
2 changes: 1 addition & 1 deletion rest_framework-stubs/test.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ForceAuthClientHandler(ClientHandler):
def __init__(self, *args: Any, **kwargs: Any): ...
def get_response(self, request: Request) -> Response: ... # type: ignore[override]

class APIClient(APIRequestFactory, DjangoClient):
class APIClient(APIRequestFactory, DjangoClient): # pyright: ignore[reportIncompatibleMethodOverride]
handler: Any = ...
def credentials(self, **kwargs: Any) -> Any: ...
def force_authenticate(self, user: Any | None = ..., token: Token | None = ...) -> None: ...
Expand Down

0 comments on commit 5bf5fbb

Please sign in to comment.