mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Fix typing of Pickler.persistent_id and Unpickler.persistent_load for Python < 3.13. (#13818)
This commit is contained in:
+6
-9
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, SupportsWrite
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from pickle import PickleBuffer as PickleBuffer
|
||||
@@ -75,10 +74,9 @@ class Pickler:
|
||||
def memo(self, value: PicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ...
|
||||
def dump(self, obj: Any, /) -> None: ...
|
||||
def clear_memo(self) -> None: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def persistent_id(self, obj: Any, /) -> Any: ...
|
||||
else:
|
||||
persistent_id: Callable[[Any], Any]
|
||||
|
||||
# this method has no default implementation for Python < 3.13
|
||||
def persistent_id(self, obj: Any, /) -> Any: ...
|
||||
|
||||
@type_check_only
|
||||
class UnpicklerMemoProxy:
|
||||
@@ -101,7 +99,6 @@ class Unpickler:
|
||||
def memo(self, value: UnpicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ...
|
||||
def load(self) -> Any: ...
|
||||
def find_class(self, module_name: str, global_name: str, /) -> Any: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def persistent_load(self, pid: Any, /) -> Any: ...
|
||||
else:
|
||||
persistent_load: Callable[[Any], Any]
|
||||
|
||||
# this method has no default implementation for Python < 3.13
|
||||
def persistent_load(self, pid: Any, /) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user