Debian Codegraph @

jedi/third_party/typeshed/stdlib/marshal.pyi

raw symbols SCIP
1 import builtins
2 import sys
3 import types
4 from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite
5 from typing import Any, Final
6 from typing_extensions import TypeAlias
7
8 version: Final[int]
9
10 _Marshallable: TypeAlias = (
11 # handled in w_object() in marshal.c
12 None
13 | type[StopIteration]
14 | builtins.ellipsis
15 | bool
16 # handled in w_complex_object() in marshal.c
17 | int
18 | float
19 | complex
20 | bytes
21 | str
22 | tuple[_Marshallable, ...]
23 | list[Any]
24 | dict[Any, Any]
25 | set[Any]
26 | frozenset[_Marshallable]
27 | types.CodeType
28 | ReadableBuffer
29 )
30
31 if sys.version_info >= (3, 14):
32 def dump(value: _Marshallable, file: SupportsWrite[bytes], version: int = 5, /, *, allow_code: bool = True) -> None: ...
33 def dumps(value: _Marshallable, version: int = 5, /, *, allow_code: bool = True) -> bytes: ...
34
35 elif sys.version_info >= (3, 13):
36 def dump(value: _Marshallable, file: SupportsWrite[bytes], version: int = 4, /, *, allow_code: bool = True) -> None: ...
37 def dumps(value: _Marshallable, version: int = 4, /, *, allow_code: bool = True) -> bytes: ...
38
39 else:
40 def dump(value: _Marshallable, file: SupportsWrite[bytes], version: int = 4, /) -> None: ...
41 def dumps(value: _Marshallable, version: int = 4, /) -> bytes: ...
42
43 if sys.version_info >= (3, 13):
44 def load(file: SupportsRead[bytes], /, *, allow_code: bool = True) -> Any: ...
45 def loads(bytes: ReadableBuffer, /, *, allow_code: bool = True) -> Any: ...
46
47 else:
48 def load(file: SupportsRead[bytes], /) -> Any: ...
49 def loads(bytes: ReadableBuffer, /) -> Any: ...