Debian Codegraph @

jedi/third_party/typeshed/stdlib/pickletools.pyi

raw symbols SCIP
1 import sys
2 from collections.abc import Callable, Iterator, MutableMapping
3 from typing import IO, Any, Final
4 from typing_extensions import TypeAlias
5
6 __all__ = ["dis", "genops", "optimize"]
7
8 _Reader: TypeAlias = Callable[[IO[bytes]], Any]
9 bytes_types: tuple[type[Any], ...]
10
11 UP_TO_NEWLINE: Final = -1
12 TAKEN_FROM_ARGUMENT1: Final = -2
13 TAKEN_FROM_ARGUMENT4: Final = -3
14 TAKEN_FROM_ARGUMENT4U: Final = -4
15 TAKEN_FROM_ARGUMENT8U: Final = -5
16
17 class ArgumentDescriptor:
18 __slots__ = ("name", "n", "reader", "doc")
19 name: str
20 n: int
21 reader: _Reader
22 doc: str
23 def __init__(self, name: str, n: int, reader: _Reader, doc: str) -> None: ...
24
25 def read_uint1(f: IO[bytes]) -> int: ...
26
27 uint1: ArgumentDescriptor
28
29 def read_uint2(f: IO[bytes]) -> int: ...
30
31 uint2: ArgumentDescriptor
32
33 def read_int4(f: IO[bytes]) -> int: ...
34
35 int4: ArgumentDescriptor
36
37 def read_uint4(f: IO[bytes]) -> int: ...
38
39 uint4: ArgumentDescriptor
40
41 def read_uint8(f: IO[bytes]) -> int: ...
42
43 uint8: ArgumentDescriptor
44
45 if sys.version_info >= (3, 12):
46 def read_stringnl(
47 f: IO[bytes], decode: bool = True, stripquotes: bool = True, *, encoding: str = "latin-1"
48 ) -> bytes | str: ...
49
50 else:
51 def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: ...
52
53 stringnl: ArgumentDescriptor
54
55 def read_stringnl_noescape(f: IO[bytes]) -> str: ...
56
57 stringnl_noescape: ArgumentDescriptor
58
59 def read_stringnl_noescape_pair(f: IO[bytes]) -> str: ...
60
61 stringnl_noescape_pair: ArgumentDescriptor
62
63 def read_string1(f: IO[bytes]) -> str: ...
64
65 string1: ArgumentDescriptor
66
67 def read_string4(f: IO[bytes]) -> str: ...
68
69 string4: ArgumentDescriptor
70
71 def read_bytes1(f: IO[bytes]) -> bytes: ...
72
73 bytes1: ArgumentDescriptor
74
75 def read_bytes4(f: IO[bytes]) -> bytes: ...
76
77 bytes4: ArgumentDescriptor
78
79 def read_bytes8(f: IO[bytes]) -> bytes: ...
80
81 bytes8: ArgumentDescriptor
82
83 def read_unicodestringnl(f: IO[bytes]) -> str: ...
84
85 unicodestringnl: ArgumentDescriptor
86
87 def read_unicodestring1(f: IO[bytes]) -> str: ...
88
89 unicodestring1: ArgumentDescriptor
90
91 def read_unicodestring4(f: IO[bytes]) -> str: ...
92
93 unicodestring4: ArgumentDescriptor
94
95 def read_unicodestring8(f: IO[bytes]) -> str: ...
96
97 unicodestring8: ArgumentDescriptor
98
99 def read_decimalnl_short(f: IO[bytes]) -> int: ...
100 def read_decimalnl_long(f: IO[bytes]) -> int: ...
101
102 decimalnl_short: ArgumentDescriptor
103 decimalnl_long: ArgumentDescriptor
104
105 def read_floatnl(f: IO[bytes]) -> float: ...
106
107 floatnl: ArgumentDescriptor
108
109 def read_float8(f: IO[bytes]) -> float: ...
110
111 float8: ArgumentDescriptor
112
113 def read_long1(f: IO[bytes]) -> int: ...
114
115 long1: ArgumentDescriptor
116
117 def read_long4(f: IO[bytes]) -> int: ...
118
119 long4: ArgumentDescriptor
120
121 class StackObject:
122 __slots__ = ("name", "obtype", "doc")
123 name: str
124 obtype: type[Any] | tuple[type[Any], ...]
125 doc: str
126 def __init__(self, name: str, obtype: type[Any] | tuple[type[Any], ...], doc: str) -> None: ...
127
128 pyint: StackObject
129 pylong: StackObject
130 pyinteger_or_bool: StackObject
131 pybool: StackObject
132 pyfloat: StackObject
133 pybytes_or_str: StackObject
134 pystring: StackObject
135 pybytes: StackObject
136 pyunicode: StackObject
137 pynone: StackObject
138 pytuple: StackObject
139 pylist: StackObject
140 pydict: StackObject
141 pyset: StackObject
142 pyfrozenset: StackObject
143 anyobject: StackObject
144 markobject: StackObject
145 stackslice: StackObject
146
147 class OpcodeInfo:
148 __slots__ = ("name", "code", "arg", "stack_before", "stack_after", "proto", "doc")
149 name: str
150 code: str
151 arg: ArgumentDescriptor | None
152 stack_before: list[StackObject]
153 stack_after: list[StackObject]
154 proto: int
155 doc: str
156 def __init__(
157 self,
158 name: str,
159 code: str,
160 arg: ArgumentDescriptor | None,
161 stack_before: list[StackObject],
162 stack_after: list[StackObject],
163 proto: int,
164 doc: str,
165 ) -> None: ...
166
167 opcodes: list[OpcodeInfo]
168
169 def genops(pickle: bytes | bytearray | IO[bytes]) -> Iterator[tuple[OpcodeInfo, Any | None, int | None]]: ...
170 def optimize(p: bytes | bytearray | IO[bytes]) -> bytes: ...
171 def dis(
172 pickle: bytes | bytearray | IO[bytes],
173 out: IO[str] | None = None,
174 memo: MutableMapping[int, Any] | None = None,
175 indentlevel: int = 4,
176 annotate: int = 0,
177 ) -> None: ...