basedpyright 1.12.6 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.map +1 -1
  3. package/dist/pyright.js +1 -1
  4. package/dist/pyright.js.map +1 -1
  5. package/dist/typeshed-fallback/stdlib/_ast.pyi +279 -42
  6. package/dist/typeshed-fallback/stdlib/_bisect.pyi +149 -12
  7. package/dist/typeshed-fallback/stdlib/_codecs.pyi +125 -14
  8. package/dist/typeshed-fallback/stdlib/_csv.pyi +130 -7
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +72 -17
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +626 -78
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +775 -153
  12. package/dist/typeshed-fallback/stdlib/_heapq.pyi +61 -5
  13. package/dist/typeshed-fallback/stdlib/_imp.pyi +70 -15
  14. package/dist/typeshed-fallback/stdlib/_json.pyi +55 -12
  15. package/dist/typeshed-fallback/stdlib/_locale.pyi +63 -12
  16. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +61 -4
  17. package/dist/typeshed-fallback/stdlib/_operator.pyi +238 -62
  18. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +25 -1
  19. package/dist/typeshed-fallback/stdlib/_random.pyi +23 -5
  20. package/dist/typeshed-fallback/stdlib/_socket.pyi +618 -63
  21. package/dist/typeshed-fallback/stdlib/_stat.pyi +140 -13
  22. package/dist/typeshed-fallback/stdlib/_thread.pyi +215 -22
  23. package/dist/typeshed-fallback/stdlib/_tkinter.pyi +44 -11
  24. package/dist/typeshed-fallback/stdlib/_tracemalloc.pyi +71 -10
  25. package/dist/typeshed-fallback/stdlib/_warnings.pyi +53 -6
  26. package/dist/typeshed-fallback/stdlib/_weakref.pyi +43 -10
  27. package/dist/typeshed-fallback/stdlib/_winapi.pyi +255 -255
  28. package/dist/typeshed-fallback/stdlib/array.pyi +233 -44
  29. package/dist/typeshed-fallback/stdlib/atexit.pyi +50 -5
  30. package/dist/typeshed-fallback/stdlib/audioop.pyi +78 -26
  31. package/dist/typeshed-fallback/stdlib/binascii.pyi +105 -18
  32. package/dist/typeshed-fallback/stdlib/builtins.pyi +5254 -829
  33. package/dist/typeshed-fallback/stdlib/cmath.pyi +99 -23
  34. package/dist/typeshed-fallback/stdlib/errno.pyi +15 -0
  35. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +33 -8
  36. package/dist/typeshed-fallback/stdlib/fcntl.pyi +199 -8
  37. package/dist/typeshed-fallback/stdlib/gc.pyi +130 -18
  38. package/dist/typeshed-fallback/stdlib/grp.pyi +58 -7
  39. package/dist/typeshed-fallback/stdlib/itertools.pyi +281 -42
  40. package/dist/typeshed-fallback/stdlib/marshal.pyi +82 -4
  41. package/dist/typeshed-fallback/stdlib/math.pyi +357 -61
  42. package/dist/typeshed-fallback/stdlib/mmap.pyi +47 -8
  43. package/dist/typeshed-fallback/stdlib/msvcrt.pyi +32 -32
  44. package/dist/typeshed-fallback/stdlib/nt.pyi +118 -111
  45. package/dist/typeshed-fallback/stdlib/parser.pyi +55 -24
  46. package/dist/typeshed-fallback/stdlib/posix.pyi +7 -0
  47. package/dist/typeshed-fallback/stdlib/pwd.pyi +60 -10
  48. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +61 -12
  49. package/dist/typeshed-fallback/stdlib/readline.pyi +184 -27
  50. package/dist/typeshed-fallback/stdlib/resource.pyi +56 -16
  51. package/dist/typeshed-fallback/stdlib/select.pyi +97 -5
  52. package/dist/typeshed-fallback/stdlib/spwd.pyi +60 -11
  53. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +386 -48
  54. package/dist/typeshed-fallback/stdlib/syslog.pyi +27 -7
  55. package/dist/typeshed-fallback/stdlib/termios.pyi +88 -8
  56. package/dist/typeshed-fallback/stdlib/time.pyi +314 -37
  57. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +264 -34
  58. package/dist/typeshed-fallback/stdlib/winreg.pyi +172 -132
  59. package/dist/typeshed-fallback/stdlib/zlib.pyi +108 -7
  60. package/package.json +1 -1
@@ -1,3 +1,13 @@
1
+ """
2
+ Operator interface.
3
+
4
+ This module exports a set of functions implemented in C corresponding
5
+ to the intrinsic operators of Python. For example, operator.add(x, y)
6
+ is equivalent to the expression x+y. The function names are those
7
+ used for special methods; variants without leading and trailing
8
+ '__' are also provided for convenience.
9
+ """
10
+
1
11
  import sys
2
12
  from _typeshed import SupportsGetItem
3
13
  from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
@@ -42,58 +52,159 @@ class _SupportsPos(Protocol[_T_co]):
42
52
  def __pos__(self) -> _T_co: ...
43
53
 
44
54
  # All four comparison functions must have the same signature, or we get false-positive errors
45
- def lt(a: _SupportsComparison, b: _SupportsComparison, /) -> Any: ...
46
- def le(a: _SupportsComparison, b: _SupportsComparison, /) -> Any: ...
47
- def eq(a: object, b: object, /) -> Any: ...
48
- def ne(a: object, b: object, /) -> Any: ...
49
- def ge(a: _SupportsComparison, b: _SupportsComparison, /) -> Any: ...
50
- def gt(a: _SupportsComparison, b: _SupportsComparison, /) -> Any: ...
51
- def not_(a: object, /) -> bool: ...
52
- def truth(a: object, /) -> bool: ...
53
- def is_(a: object, b: object, /) -> bool: ...
54
- def is_not(a: object, b: object, /) -> bool: ...
55
- def abs(a: SupportsAbs[_T], /) -> _T: ...
56
- def add(a: Any, b: Any, /) -> Any: ...
57
- def and_(a: Any, b: Any, /) -> Any: ...
58
- def floordiv(a: Any, b: Any, /) -> Any: ...
59
- def index(a: SupportsIndex, /) -> int: ...
60
- def inv(a: _SupportsInversion[_T_co], /) -> _T_co: ...
61
- def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ...
62
- def lshift(a: Any, b: Any, /) -> Any: ...
63
- def mod(a: Any, b: Any, /) -> Any: ...
64
- def mul(a: Any, b: Any, /) -> Any: ...
65
- def matmul(a: Any, b: Any, /) -> Any: ...
66
- def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ...
67
- def or_(a: Any, b: Any, /) -> Any: ...
68
- def pos(a: _SupportsPos[_T_co], /) -> _T_co: ...
69
- def pow(a: Any, b: Any, /) -> Any: ...
70
- def rshift(a: Any, b: Any, /) -> Any: ...
71
- def sub(a: Any, b: Any, /) -> Any: ...
72
- def truediv(a: Any, b: Any, /) -> Any: ...
73
- def xor(a: Any, b: Any, /) -> Any: ...
74
- def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ...
75
- def contains(a: Container[object], b: object, /) -> bool: ...
76
- def countOf(a: Iterable[object], b: object, /) -> int: ...
55
+ def lt(a: _SupportsComparison, b: _SupportsComparison, /) -> Any:
56
+ """Same as a < b."""
57
+ ...
58
+ def le(a: _SupportsComparison, b: _SupportsComparison, /) -> Any:
59
+ """Same as a <= b."""
60
+ ...
61
+ def eq(a: object, b: object, /) -> Any:
62
+ """Same as a == b."""
63
+ ...
64
+ def ne(a: object, b: object, /) -> Any:
65
+ """Same as a != b."""
66
+ ...
67
+ def ge(a: _SupportsComparison, b: _SupportsComparison, /) -> Any:
68
+ """Same as a >= b."""
69
+ ...
70
+ def gt(a: _SupportsComparison, b: _SupportsComparison, /) -> Any:
71
+ """Same as a > b."""
72
+ ...
73
+ def not_(a: object, /) -> bool:
74
+ """Same as not a."""
75
+ ...
76
+ def truth(a: object, /) -> bool:
77
+ """Return True if a is true, False otherwise."""
78
+ ...
79
+ def is_(a: object, b: object, /) -> bool:
80
+ """Same as a is b."""
81
+ ...
82
+ def is_not(a: object, b: object, /) -> bool:
83
+ """Same as a is not b."""
84
+ ...
85
+ def abs(a: SupportsAbs[_T], /) -> _T:
86
+ """Same as abs(a)."""
87
+ ...
88
+ def add(a: Any, b: Any, /) -> Any:
89
+ """Same as a + b."""
90
+ ...
91
+ def and_(a: Any, b: Any, /) -> Any:
92
+ """Same as a & b."""
93
+ ...
94
+ def floordiv(a: Any, b: Any, /) -> Any:
95
+ """Same as a // b."""
96
+ ...
97
+ def index(a: SupportsIndex, /) -> int:
98
+ """Same as a.__index__()"""
99
+ ...
100
+ def inv(a: _SupportsInversion[_T_co], /) -> _T_co:
101
+ """Same as ~a."""
102
+ ...
103
+ def invert(a: _SupportsInversion[_T_co], /) -> _T_co:
104
+ """Same as ~a."""
105
+ ...
106
+ def lshift(a: Any, b: Any, /) -> Any:
107
+ """Same as a << b."""
108
+ ...
109
+ def mod(a: Any, b: Any, /) -> Any:
110
+ """Same as a % b."""
111
+ ...
112
+ def mul(a: Any, b: Any, /) -> Any:
113
+ """Same as a * b."""
114
+ ...
115
+ def matmul(a: Any, b: Any, /) -> Any:
116
+ """Same as a @ b."""
117
+ ...
118
+ def neg(a: _SupportsNeg[_T_co], /) -> _T_co:
119
+ """Same as -a."""
120
+ ...
121
+ def or_(a: Any, b: Any, /) -> Any:
122
+ """Same as a | b."""
123
+ ...
124
+ def pos(a: _SupportsPos[_T_co], /) -> _T_co:
125
+ """Same as +a."""
126
+ ...
127
+ def pow(a: Any, b: Any, /) -> Any:
128
+ """Same as a ** b."""
129
+ ...
130
+ def rshift(a: Any, b: Any, /) -> Any:
131
+ """Same as a >> b."""
132
+ ...
133
+ def sub(a: Any, b: Any, /) -> Any:
134
+ """Same as a - b."""
135
+ ...
136
+ def truediv(a: Any, b: Any, /) -> Any:
137
+ """Same as a / b."""
138
+ ...
139
+ def xor(a: Any, b: Any, /) -> Any:
140
+ """Same as a ^ b."""
141
+ ...
142
+ def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]:
143
+ """Same as a + b, for a and b sequences."""
144
+ ...
145
+ def contains(a: Container[object], b: object, /) -> bool:
146
+ """Same as b in a (note reversed operands)."""
147
+ ...
148
+ def countOf(a: Iterable[object], b: object, /) -> int:
149
+ """Return the number of times b occurs in a."""
150
+ ...
77
151
  @overload
78
- def delitem(a: MutableSequence[Any], b: SupportsIndex, /) -> None: ...
152
+ def delitem(a: MutableSequence[Any], b: SupportsIndex, /) -> None:
153
+ """Same as del a[b]."""
154
+ ...
79
155
  @overload
80
- def delitem(a: MutableSequence[Any], b: slice, /) -> None: ...
156
+ def delitem(a: MutableSequence[Any], b: slice, /) -> None:
157
+ """Same as del a[b]."""
158
+ ...
81
159
  @overload
82
- def delitem(a: MutableMapping[_K, Any], b: _K, /) -> None: ...
160
+ def delitem(a: MutableMapping[_K, Any], b: _K, /) -> None:
161
+ """Same as del a[b]."""
162
+ ...
83
163
  @overload
84
- def getitem(a: Sequence[_T], b: slice, /) -> Sequence[_T]: ...
164
+ def getitem(a: Sequence[_T], b: slice, /) -> Sequence[_T]:
165
+ """Same as a[b]."""
166
+ ...
85
167
  @overload
86
- def getitem(a: SupportsGetItem[_K, _V], b: _K, /) -> _V: ...
87
- def indexOf(a: Iterable[_T], b: _T, /) -> int: ...
168
+ def getitem(a: SupportsGetItem[_K, _V], b: _K, /) -> _V:
169
+ """Same as a[b]."""
170
+ ...
171
+ def indexOf(a: Iterable[_T], b: _T, /) -> int:
172
+ """Return the first index of b in a."""
173
+ ...
88
174
  @overload
89
- def setitem(a: MutableSequence[_T], b: SupportsIndex, c: _T, /) -> None: ...
175
+ def setitem(a: MutableSequence[_T], b: SupportsIndex, c: _T, /) -> None:
176
+ """Same as a[b] = c."""
177
+ ...
90
178
  @overload
91
- def setitem(a: MutableSequence[_T], b: slice, c: Sequence[_T], /) -> None: ...
179
+ def setitem(a: MutableSequence[_T], b: slice, c: Sequence[_T], /) -> None:
180
+ """Same as a[b] = c."""
181
+ ...
92
182
  @overload
93
- def setitem(a: MutableMapping[_K, _V], b: _K, c: _V, /) -> None: ...
94
- def length_hint(obj: object, default: int = 0, /) -> int: ...
183
+ def setitem(a: MutableMapping[_K, _V], b: _K, c: _V, /) -> None:
184
+ """Same as a[b] = c."""
185
+ ...
186
+ def length_hint(obj: object, default: int = 0, /) -> int:
187
+ """
188
+ Return an estimate of the number of items in obj.
189
+
190
+ This is useful for presizing containers when building from an iterable.
191
+
192
+ If the object supports len(), the result will be exact.
193
+ Otherwise, it may over- or under-estimate by an arbitrary amount.
194
+ The result will be an integer >= 0.
195
+ """
196
+ ...
95
197
  @final
96
198
  class attrgetter(Generic[_T_co]):
199
+ """
200
+ attrgetter(attr, ...) --> attrgetter object
201
+
202
+ Return a callable object that fetches the given attribute(s) from its operand.
203
+ After f = attrgetter('name'), the call f(r) returns r.name.
204
+ After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).
205
+ After h = attrgetter('name.first', 'name.last'), the call h(r) returns
206
+ (r.name.first, r.name.last).
207
+ """
97
208
  @overload
98
209
  def __new__(cls, attr: str, /) -> attrgetter[Any]: ...
99
210
  @overload
@@ -104,10 +215,19 @@ class attrgetter(Generic[_T_co]):
104
215
  def __new__(cls, attr: str, attr2: str, attr3: str, attr4: str, /) -> attrgetter[tuple[Any, Any, Any, Any]]: ...
105
216
  @overload
106
217
  def __new__(cls, attr: str, /, *attrs: str) -> attrgetter[tuple[Any, ...]]: ...
107
- def __call__(self, obj: Any, /) -> _T_co: ...
218
+ def __call__(self, obj: Any, /) -> _T_co:
219
+ """Call self as a function."""
220
+ ...
108
221
 
109
222
  @final
110
223
  class itemgetter(Generic[_T_co]):
224
+ """
225
+ itemgetter(item, ...) --> itemgetter object
226
+
227
+ Return a callable object that fetches the given item(s) from its operand.
228
+ After f = itemgetter(2), the call f(r) returns r[2].
229
+ After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])
230
+ """
111
231
  @overload
112
232
  def __new__(cls, item: _T, /) -> itemgetter[_T]: ...
113
233
  @overload
@@ -119,29 +239,85 @@ class itemgetter(Generic[_T_co]):
119
239
  #
120
240
  # A suspected mypy issue prevents using [..., _T] instead of [..., Any] here.
121
241
  # https://github.com/python/mypy/issues/14032
122
- def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any: ...
242
+ def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any:
243
+ """Call self as a function."""
244
+ ...
123
245
 
124
246
  @final
125
247
  class methodcaller:
248
+ """
249
+ methodcaller(name, ...) --> methodcaller object
250
+
251
+ Return a callable object that calls the given method on its operand.
252
+ After f = methodcaller('name'), the call f(r) returns r.name().
253
+ After g = methodcaller('name', 'date', foo=1), the call g(r) returns
254
+ r.name('date', foo=1).
255
+ """
126
256
  def __init__(self, name: str, /, *args: Any, **kwargs: Any) -> None: ...
127
- def __call__(self, obj: Any) -> Any: ...
128
-
129
- def iadd(a: Any, b: Any, /) -> Any: ...
130
- def iand(a: Any, b: Any, /) -> Any: ...
131
- def iconcat(a: Any, b: Any, /) -> Any: ...
132
- def ifloordiv(a: Any, b: Any, /) -> Any: ...
133
- def ilshift(a: Any, b: Any, /) -> Any: ...
134
- def imod(a: Any, b: Any, /) -> Any: ...
135
- def imul(a: Any, b: Any, /) -> Any: ...
136
- def imatmul(a: Any, b: Any, /) -> Any: ...
137
- def ior(a: Any, b: Any, /) -> Any: ...
138
- def ipow(a: Any, b: Any, /) -> Any: ...
139
- def irshift(a: Any, b: Any, /) -> Any: ...
140
- def isub(a: Any, b: Any, /) -> Any: ...
141
- def itruediv(a: Any, b: Any, /) -> Any: ...
142
- def ixor(a: Any, b: Any, /) -> Any: ...
257
+ def __call__(self, obj: Any) -> Any:
258
+ """Call self as a function."""
259
+ ...
260
+
261
+ def iadd(a: Any, b: Any, /) -> Any:
262
+ """Same as a += b."""
263
+ ...
264
+ def iand(a: Any, b: Any, /) -> Any:
265
+ """Same as a &= b."""
266
+ ...
267
+ def iconcat(a: Any, b: Any, /) -> Any:
268
+ """Same as a += b, for a and b sequences."""
269
+ ...
270
+ def ifloordiv(a: Any, b: Any, /) -> Any:
271
+ """Same as a //= b."""
272
+ ...
273
+ def ilshift(a: Any, b: Any, /) -> Any:
274
+ """Same as a <<= b."""
275
+ ...
276
+ def imod(a: Any, b: Any, /) -> Any:
277
+ """Same as a %= b."""
278
+ ...
279
+ def imul(a: Any, b: Any, /) -> Any:
280
+ """Same as a *= b."""
281
+ ...
282
+ def imatmul(a: Any, b: Any, /) -> Any:
283
+ """Same as a @= b."""
284
+ ...
285
+ def ior(a: Any, b: Any, /) -> Any:
286
+ """Same as a |= b."""
287
+ ...
288
+ def ipow(a: Any, b: Any, /) -> Any:
289
+ """Same as a **= b."""
290
+ ...
291
+ def irshift(a: Any, b: Any, /) -> Any:
292
+ """Same as a >>= b."""
293
+ ...
294
+ def isub(a: Any, b: Any, /) -> Any:
295
+ """Same as a -= b."""
296
+ ...
297
+ def itruediv(a: Any, b: Any, /) -> Any:
298
+ """Same as a /= b."""
299
+ ...
300
+ def ixor(a: Any, b: Any, /) -> Any:
301
+ """Same as a ^= b."""
302
+ ...
143
303
 
144
304
  if sys.version_info >= (3, 11):
145
- def call(obj: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
305
+ def call(obj: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R:
306
+ """Same as obj(*args, **kwargs)."""
307
+ ...
308
+
309
+ def _compare_digest(a: AnyStr, b: AnyStr, /) -> bool:
310
+ """
311
+ Return 'a == b'.
312
+
313
+ This function uses an approach designed to prevent
314
+ timing analysis, making it appropriate for cryptography.
315
+
316
+ a and b must both be of the same type: either str (ASCII only),
317
+ or any bytes-like object.
146
318
 
147
- def _compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ...
319
+ Note: If a and b are of different lengths, or if an error occurs,
320
+ a timing attack could theoretically reveal information about the
321
+ types and lengths of a and b--but not their values.
322
+ """
323
+ ...
@@ -1,3 +1,5 @@
1
+ """A POSIX helper for the subprocess module."""
2
+
1
3
  import sys
2
4
  from _typeshed import StrOrBytesPath
3
5
  from collections.abc import Callable, Sequence
@@ -30,4 +32,26 @@ if sys.platform != "win32":
30
32
  preexec_fn: Callable[[], None],
31
33
  allow_vfork: bool,
32
34
  /,
33
- ) -> int: ...
35
+ ) -> int:
36
+ """
37
+ fork_exec(args, executable_list, close_fds, cwd, env,
38
+ p2cread, p2cwrite, c2pread, c2pwrite,
39
+ errread, errwrite, errpipe_read, errpipe_write,
40
+ restore_signals, call_setsid, preexec_fn)
41
+
42
+ Forks a child process, closes parent file descriptors as appropriate in the
43
+ child and dups the few that are needed before calling exec() in the child
44
+ process.
45
+
46
+ The preexec_fn, if supplied, will be called immediately before exec.
47
+ WARNING: preexec_fn is NOT SAFE if your application uses threads.
48
+ It may trigger infrequent, difficult to debug deadlocks.
49
+
50
+ If an error occurs in the child process before the exec, it is
51
+ serialized and written to the errpipe_write fd per subprocess.py.
52
+
53
+ Returns: the child process's PID.
54
+
55
+ Raises: Only on an error in the parent process.
56
+ """
57
+ ...
@@ -1,12 +1,30 @@
1
+ """Module implements the Mersenne Twister random number generator."""
2
+
1
3
  from typing_extensions import TypeAlias
2
4
 
3
5
  # Actually Tuple[(int,) * 625]
4
6
  _State: TypeAlias = tuple[int, ...]
5
7
 
6
8
  class Random:
9
+ """Random() -> create a random number generator with its own internal state."""
7
10
  def __init__(self, seed: object = ...) -> None: ...
8
- def seed(self, n: object = None, /) -> None: ...
9
- def getstate(self) -> _State: ...
10
- def setstate(self, state: _State, /) -> None: ...
11
- def random(self) -> float: ...
12
- def getrandbits(self, k: int, /) -> int: ...
11
+ def seed(self, n: object = None, /) -> None:
12
+ """
13
+ seed([n]) -> None.
14
+
15
+ Defaults to use urandom and falls back to a combination
16
+ of the current time and the process identifier.
17
+ """
18
+ ...
19
+ def getstate(self) -> _State:
20
+ """getstate() -> tuple containing the current state."""
21
+ ...
22
+ def setstate(self, state: _State, /) -> None:
23
+ """setstate(state) -> None. Restores generator state."""
24
+ ...
25
+ def random(self) -> float:
26
+ """random() -> x in the interval [0, 1)."""
27
+ ...
28
+ def getrandbits(self, k: int, /) -> int:
29
+ """getrandbits(k) -> x. Generates an int with k random bits."""
30
+ ...