Skip to content

Commit 5e5ddf7

Browse files
JaeHyuckSasobolevnpre-commit-ci[bot]
authored
Update django.core.serializers for Django 5.2 (#2614)
Signed-off-by: SaJH <[email protected]> Co-authored-by: sobolevn <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ecfb756 commit 5e5ddf7

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

django-stubs/core/serializers/json.pyi

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import json
2-
from collections.abc import Iterator
3-
from typing import IO, Any
2+
from typing import Any, TypeAlias
43

5-
from django.core.serializers.base import DeserializedObject
4+
import _typeshed
5+
from django.core.serializers.python import Deserializer as PythonDeserializer
66
from django.core.serializers.python import Serializer as PythonSerializer
77

8+
_DeserializerInput: TypeAlias = _typeshed.SupportsRead[bytes | str] | bytes | str
9+
810
class Serializer(PythonSerializer):
911
json_kwargs: dict[str, Any]
1012

11-
def Deserializer(
12-
stream_or_string: IO[bytes] | IO[str] | bytes | str, **options: Any
13-
) -> Iterator[DeserializedObject]: ...
13+
class Deserializer(PythonDeserializer):
14+
def __init__(self, stream_or_string: _DeserializerInput, **options: Any) -> None: ...
1415

1516
class DjangoJSONEncoder(json.JSONEncoder):
1617
allow_nan: bool
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from collections.abc import Iterator
2-
from typing import IO, Any
1+
from typing import Any
32

4-
from django.core.serializers.base import DeserializedObject
3+
from django.core.serializers.json import _DeserializerInput
4+
from django.core.serializers.python import Deserializer as PythonDeserializer
55
from django.core.serializers.python import Serializer as PythonSerializer
66

77
class Serializer(PythonSerializer):
88
json_kwargs: dict[str, Any]
99

10-
def Deserializer(
11-
stream_or_string: IO[bytes] | IO[str] | bytes | str, **options: Any
12-
) -> Iterator[DeserializedObject]: ...
10+
class Deserializer(PythonDeserializer):
11+
def __init__(self, stream_or_string: _DeserializerInput, **options: Any) -> None: ...
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
from collections.abc import Iterator
1+
from collections.abc import Iterable
22
from typing import Any
33

44
from django.core.serializers import base
5-
from django.core.serializers.base import DeserializedObject
65
from django.db.models.base import Model
76

87
class Serializer(base.Serializer):
98
objects: list[Any]
109
def get_dump_object(self, obj: Model) -> dict[str, Any]: ...
1110

12-
def Deserializer(
13-
object_list: list[dict[str, Any]], *, using: str = "default", ignorenonexistent: bool = False, **options: Any
14-
) -> Iterator[DeserializedObject]: ...
11+
class Deserializer(base.Deserializer):
12+
def __init__(
13+
self,
14+
object_list: Iterable[dict[str, Any]],
15+
*,
16+
using: str = ...,
17+
ignorenonexistent: bool = False,
18+
**options: Any,
19+
) -> None: ...

django-stubs/core/serializers/pyyaml.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from collections.abc import Iterator
21
from typing import IO, Any
32

4-
from django.core.serializers.base import DeserializedObject
3+
from django.core.serializers.base import Deserializer as PythonDeserializer
54
from django.core.serializers.python import Serializer as PythonSerializer
65
from django.db.models.fields import Field
76
from yaml import CSafeDumper as SafeDumper
@@ -17,6 +16,5 @@ class Serializer(PythonSerializer):
1716
def end_serialization(self) -> None: ...
1817
def getvalue(self) -> Any: ...
1918

20-
def Deserializer(
21-
stream_or_string: bytes | str | IO[bytes] | IO[str], **options: Any
22-
) -> Iterator[DeserializedObject]: ...
19+
class Deserializer(PythonDeserializer):
20+
def __init__(self, stream_or_string: bytes | str | IO[bytes] | IO[str], **options: Any) -> None: ...

scripts/stubtest/allowlist_todo_django52.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ django.core.handlers.wsgi.LimitedStream.readline
8080
django.core.management.commands.shell.Command.get_auto_imports
8181
django.core.management.commands.shell.Command.get_namespace
8282
django.core.management.utils.run_formatters
83-
django.core.serializers.json.Deserializer
84-
django.core.serializers.jsonl.Deserializer
85-
django.core.serializers.python.Deserializer
86-
django.core.serializers.pyyaml.Deserializer
8783
django.db.backends.base.features.BaseDatabaseFeatures.rounds_to_even
8884
django.db.backends.base.features.BaseDatabaseFeatures.supports_tuple_lookups
8985
django.db.backends.base.schema.BaseDatabaseSchemaEditor.sql_pk_constraint

0 commit comments

Comments
 (0)