basedpyright 1.40.1 → 1.40.2
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.
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright.js +1 -1
- package/dist/typeshed-fallback/stdlib/_blake2.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_curses.pyi +81 -54
- package/dist/typeshed-fallback/stdlib/_curses_panel.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +9 -6
- package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +24 -36
- package/dist/typeshed-fallback/stdlib/_interpreters.pyi +26 -71
- package/dist/typeshed-fallback/stdlib/_json.pyi +15 -11
- package/dist/typeshed-fallback/stdlib/_remote_debugging.pyi +355 -72
- package/dist/typeshed-fallback/stdlib/_socket.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +0 -15
- package/dist/typeshed-fallback/stdlib/_struct.pyi +39 -42
- package/dist/typeshed-fallback/stdlib/_thread.pyi +18 -14
- package/dist/typeshed-fallback/stdlib/array.pyi +8 -4
- package/dist/typeshed-fallback/stdlib/ast.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/binascii.pyi +113 -10
- package/dist/typeshed-fallback/stdlib/builtins.pyi +260 -43
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +12 -4
- package/dist/typeshed-fallback/stdlib/dataclasses.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/datetime.pyi +93 -25
- package/dist/typeshed-fallback/stdlib/decimal.pyi +272 -208
- package/dist/typeshed-fallback/stdlib/faulthandler.pyi +29 -4
- package/dist/typeshed-fallback/stdlib/fcntl.pyi +6 -12
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/json/encoder.pyi +2 -10
- package/dist/typeshed-fallback/stdlib/marshal.pyi +33 -2
- package/dist/typeshed-fallback/stdlib/math/__init__.pyi +15 -7
- package/dist/typeshed-fallback/stdlib/math/integer.pyi +43 -8
- package/dist/typeshed-fallback/stdlib/mmap.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +60 -4
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/profiling/__init__.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/profiling/sampling/__init__.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/profiling/sampling/collector.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/profiling/sampling/gecko_collector.pyi +111 -111
- package/dist/typeshed-fallback/stdlib/profiling/sampling/heatmap_collector.pyi +24 -24
- package/dist/typeshed-fallback/stdlib/profiling/sampling/jsonl_collector.pyi +15 -15
- package/dist/typeshed-fallback/stdlib/profiling/sampling/pstats_collector.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/profiling/sampling/stack_collector.pyi +39 -39
- package/dist/typeshed-fallback/stdlib/profiling/sampling/string_table.pyi +5 -5
- package/dist/typeshed-fallback/stdlib/profiling/tracing.pyi +9 -9
- package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +24 -18
- package/dist/typeshed-fallback/stdlib/re.pyi +18 -3
- package/dist/typeshed-fallback/stdlib/select.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/signal.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +28 -5
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +42 -4
- package/dist/typeshed-fallback/stdlib/types.pyi +44 -14
- package/dist/typeshed-fallback/stdlib/unicodedata.pyi +27 -9
- package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +132 -6
- package/dist/typeshed-fallback/stdlib/winreg.pyi +5 -0
- package/dist/typeshed-fallback/stdlib/xml/utils.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/zlib.pyi +34 -2
- package/package.json +1 -1
|
@@ -910,10 +910,11 @@ def typeahead(fd: int, /) -> None:
|
|
|
910
910
|
...
|
|
911
911
|
def unctrl(ch: _ChType, /) -> bytes:
|
|
912
912
|
"""
|
|
913
|
-
Return a
|
|
913
|
+
Return a bytes object which is a printable representation of ch.
|
|
914
914
|
|
|
915
|
-
Control characters are displayed as a caret followed by the
|
|
916
|
-
for example as ^C. Printing characters are left as they
|
|
915
|
+
Control characters are displayed as a caret followed by the
|
|
916
|
+
character, for example as ^C. Printing characters are left as they
|
|
917
|
+
are. Any attributes and color pair are ignored.
|
|
917
918
|
"""
|
|
918
919
|
...
|
|
919
920
|
def unget_wch(ch: int | str, /) -> None:
|
|
@@ -954,10 +955,18 @@ def use_env(flag: bool, /) -> None:
|
|
|
954
955
|
"""
|
|
955
956
|
...
|
|
956
957
|
|
|
957
|
-
class error(Exception):
|
|
958
|
+
class error(Exception):
|
|
959
|
+
"""Exception raised when a curses library function returns an error."""
|
|
960
|
+
...
|
|
958
961
|
|
|
959
962
|
@final
|
|
960
963
|
class window: # undocumented
|
|
964
|
+
"""
|
|
965
|
+
A curses window.
|
|
966
|
+
|
|
967
|
+
Window objects are returned by initscr() and newwin(), and by the
|
|
968
|
+
methods that create subwindows and pads.
|
|
969
|
+
"""
|
|
961
970
|
encoding: str
|
|
962
971
|
|
|
963
972
|
@overload
|
|
@@ -1412,34 +1421,48 @@ class window: # undocumented
|
|
|
1412
1421
|
def getch(self) -> int:
|
|
1413
1422
|
"""
|
|
1414
1423
|
getch([y, x])
|
|
1415
|
-
|
|
1424
|
+
Read a key press and return it as an integer.
|
|
1416
1425
|
|
|
1417
1426
|
y
|
|
1418
1427
|
Y-coordinate.
|
|
1419
1428
|
x
|
|
1420
1429
|
X-coordinate.
|
|
1421
1430
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1431
|
+
Wait until a key is pressed, or return -1 if the read is
|
|
1432
|
+
non-blocking or times out.
|
|
1433
|
+
|
|
1434
|
+
An ordinary key is returned as the code of a single byte of its
|
|
1435
|
+
encoding in the current locale, so a character encoded with several
|
|
1436
|
+
bytes takes several calls. Use get_wch() to read it as a single
|
|
1437
|
+
character.
|
|
1438
|
+
|
|
1439
|
+
In keypad mode function keys and other special keys are returned as
|
|
1440
|
+
one of the KEY_* constants, which cannot be mistaken for an ordinary
|
|
1441
|
+
key. Otherwise their bytes are returned one at a time.
|
|
1426
1442
|
"""
|
|
1427
1443
|
...
|
|
1428
1444
|
@overload
|
|
1429
1445
|
def getch(self, y: int, x: int) -> int:
|
|
1430
1446
|
"""
|
|
1431
1447
|
getch([y, x])
|
|
1432
|
-
|
|
1448
|
+
Read a key press and return it as an integer.
|
|
1433
1449
|
|
|
1434
1450
|
y
|
|
1435
1451
|
Y-coordinate.
|
|
1436
1452
|
x
|
|
1437
1453
|
X-coordinate.
|
|
1438
1454
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1455
|
+
Wait until a key is pressed, or return -1 if the read is
|
|
1456
|
+
non-blocking or times out.
|
|
1457
|
+
|
|
1458
|
+
An ordinary key is returned as the code of a single byte of its
|
|
1459
|
+
encoding in the current locale, so a character encoded with several
|
|
1460
|
+
bytes takes several calls. Use get_wch() to read it as a single
|
|
1461
|
+
character.
|
|
1462
|
+
|
|
1463
|
+
In keypad mode function keys and other special keys are returned as
|
|
1464
|
+
one of the KEY_* constants, which cannot be mistaken for an ordinary
|
|
1465
|
+
key. Otherwise their bytes are returned one at a time.
|
|
1443
1466
|
"""
|
|
1444
1467
|
...
|
|
1445
1468
|
|
|
@@ -1447,30 +1470,38 @@ class window: # undocumented
|
|
|
1447
1470
|
def get_wch(self) -> int | str:
|
|
1448
1471
|
"""
|
|
1449
1472
|
get_wch([y, x])
|
|
1450
|
-
|
|
1473
|
+
Read a key press and return it as a one-character str.
|
|
1451
1474
|
|
|
1452
1475
|
y
|
|
1453
1476
|
Y-coordinate.
|
|
1454
1477
|
x
|
|
1455
1478
|
X-coordinate.
|
|
1456
1479
|
|
|
1457
|
-
|
|
1458
|
-
|
|
1480
|
+
Wait until a key is pressed, or raise curses.error if the read is
|
|
1481
|
+
non-blocking or times out.
|
|
1482
|
+
|
|
1483
|
+
In keypad mode function keys and other special keys are returned as
|
|
1484
|
+
one of the KEY_* constants, an integer. Otherwise their characters
|
|
1485
|
+
are returned one at a time.
|
|
1459
1486
|
"""
|
|
1460
1487
|
...
|
|
1461
1488
|
@overload
|
|
1462
1489
|
def get_wch(self, y: int, x: int) -> int | str:
|
|
1463
1490
|
"""
|
|
1464
1491
|
get_wch([y, x])
|
|
1465
|
-
|
|
1492
|
+
Read a key press and return it as a one-character str.
|
|
1466
1493
|
|
|
1467
1494
|
y
|
|
1468
1495
|
Y-coordinate.
|
|
1469
1496
|
x
|
|
1470
1497
|
X-coordinate.
|
|
1471
1498
|
|
|
1472
|
-
|
|
1473
|
-
|
|
1499
|
+
Wait until a key is pressed, or raise curses.error if the read is
|
|
1500
|
+
non-blocking or times out.
|
|
1501
|
+
|
|
1502
|
+
In keypad mode function keys and other special keys are returned as
|
|
1503
|
+
one of the KEY_* constants, an integer. Otherwise their characters
|
|
1504
|
+
are returned one at a time.
|
|
1474
1505
|
"""
|
|
1475
1506
|
...
|
|
1476
1507
|
|
|
@@ -1478,34 +1509,34 @@ class window: # undocumented
|
|
|
1478
1509
|
def getkey(self) -> str:
|
|
1479
1510
|
"""
|
|
1480
1511
|
getkey([y, x])
|
|
1481
|
-
|
|
1512
|
+
Read a key press and return it as a str.
|
|
1482
1513
|
|
|
1483
1514
|
y
|
|
1484
1515
|
Y-coordinate.
|
|
1485
1516
|
x
|
|
1486
1517
|
X-coordinate.
|
|
1487
1518
|
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1519
|
+
Read as getch() does, but return an ordinary key as a one-character
|
|
1520
|
+
string, the byte decoded as Latin-1, and a special key as its name,
|
|
1521
|
+
such as 'KEY_UP'. Raise curses.error instead of returning -1 if
|
|
1522
|
+
there is no input.
|
|
1492
1523
|
"""
|
|
1493
1524
|
...
|
|
1494
1525
|
@overload
|
|
1495
1526
|
def getkey(self, y: int, x: int) -> str:
|
|
1496
1527
|
"""
|
|
1497
1528
|
getkey([y, x])
|
|
1498
|
-
|
|
1529
|
+
Read a key press and return it as a str.
|
|
1499
1530
|
|
|
1500
1531
|
y
|
|
1501
1532
|
Y-coordinate.
|
|
1502
1533
|
x
|
|
1503
1534
|
X-coordinate.
|
|
1504
1535
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1536
|
+
Read as getch() does, but return an ordinary key as a one-character
|
|
1537
|
+
string, the byte decoded as Latin-1, and a special key as its name,
|
|
1538
|
+
such as 'KEY_UP'. Raise curses.error instead of returning -1 if
|
|
1539
|
+
there is no input.
|
|
1509
1540
|
"""
|
|
1510
1541
|
...
|
|
1511
1542
|
|
|
@@ -1520,56 +1551,56 @@ class window: # undocumented
|
|
|
1520
1551
|
def getstr(self) -> bytes:
|
|
1521
1552
|
"""
|
|
1522
1553
|
getstr([[y, x,] n=2047])
|
|
1523
|
-
Read a
|
|
1554
|
+
Read a line of input and return it as a bytes object.
|
|
1524
1555
|
|
|
1525
1556
|
y
|
|
1526
1557
|
Y-coordinate.
|
|
1527
1558
|
x
|
|
1528
1559
|
X-coordinate.
|
|
1529
1560
|
n
|
|
1530
|
-
Maximal number of
|
|
1561
|
+
Maximal number of bytes.
|
|
1531
1562
|
"""
|
|
1532
1563
|
...
|
|
1533
1564
|
@overload
|
|
1534
1565
|
def getstr(self, n: int) -> bytes:
|
|
1535
1566
|
"""
|
|
1536
1567
|
getstr([[y, x,] n=2047])
|
|
1537
|
-
Read a
|
|
1568
|
+
Read a line of input and return it as a bytes object.
|
|
1538
1569
|
|
|
1539
1570
|
y
|
|
1540
1571
|
Y-coordinate.
|
|
1541
1572
|
x
|
|
1542
1573
|
X-coordinate.
|
|
1543
1574
|
n
|
|
1544
|
-
Maximal number of
|
|
1575
|
+
Maximal number of bytes.
|
|
1545
1576
|
"""
|
|
1546
1577
|
...
|
|
1547
1578
|
@overload
|
|
1548
1579
|
def getstr(self, y: int, x: int) -> bytes:
|
|
1549
1580
|
"""
|
|
1550
1581
|
getstr([[y, x,] n=2047])
|
|
1551
|
-
Read a
|
|
1582
|
+
Read a line of input and return it as a bytes object.
|
|
1552
1583
|
|
|
1553
1584
|
y
|
|
1554
1585
|
Y-coordinate.
|
|
1555
1586
|
x
|
|
1556
1587
|
X-coordinate.
|
|
1557
1588
|
n
|
|
1558
|
-
Maximal number of
|
|
1589
|
+
Maximal number of bytes.
|
|
1559
1590
|
"""
|
|
1560
1591
|
...
|
|
1561
1592
|
@overload
|
|
1562
1593
|
def getstr(self, y: int, x: int, n: int) -> bytes:
|
|
1563
1594
|
"""
|
|
1564
1595
|
getstr([[y, x,] n=2047])
|
|
1565
|
-
Read a
|
|
1596
|
+
Read a line of input and return it as a bytes object.
|
|
1566
1597
|
|
|
1567
1598
|
y
|
|
1568
1599
|
Y-coordinate.
|
|
1569
1600
|
x
|
|
1570
1601
|
X-coordinate.
|
|
1571
1602
|
n
|
|
1572
|
-
Maximal number of
|
|
1603
|
+
Maximal number of bytes.
|
|
1573
1604
|
"""
|
|
1574
1605
|
...
|
|
1575
1606
|
|
|
@@ -1801,42 +1832,38 @@ class window: # undocumented
|
|
|
1801
1832
|
def instr(self, n: int = 2047) -> bytes:
|
|
1802
1833
|
"""
|
|
1803
1834
|
instr([y, x,] n=2047)
|
|
1804
|
-
Return
|
|
1835
|
+
Return the text of the window as a bytes object.
|
|
1805
1836
|
|
|
1806
1837
|
y
|
|
1807
1838
|
Y-coordinate.
|
|
1808
1839
|
x
|
|
1809
1840
|
X-coordinate.
|
|
1810
1841
|
n
|
|
1811
|
-
Maximal number of
|
|
1842
|
+
Maximal number of bytes.
|
|
1812
1843
|
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
instr() returns a string at most n characters long (exclusive of
|
|
1818
|
-
the trailing NUL).
|
|
1844
|
+
Read from the current cursor position, or from y, x if specified, to
|
|
1845
|
+
the end of the line, and return the text in the encoding of the
|
|
1846
|
+
current locale, with attributes and color pairs stripped. At most n
|
|
1847
|
+
bytes are read.
|
|
1819
1848
|
"""
|
|
1820
1849
|
...
|
|
1821
1850
|
@overload
|
|
1822
1851
|
def instr(self, y: int, x: int, n: int = 2047) -> bytes:
|
|
1823
1852
|
"""
|
|
1824
1853
|
instr([y, x,] n=2047)
|
|
1825
|
-
Return
|
|
1854
|
+
Return the text of the window as a bytes object.
|
|
1826
1855
|
|
|
1827
1856
|
y
|
|
1828
1857
|
Y-coordinate.
|
|
1829
1858
|
x
|
|
1830
1859
|
X-coordinate.
|
|
1831
1860
|
n
|
|
1832
|
-
Maximal number of
|
|
1861
|
+
Maximal number of bytes.
|
|
1833
1862
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
instr() returns a string at most n characters long (exclusive of
|
|
1839
|
-
the trailing NUL).
|
|
1863
|
+
Read from the current cursor position, or from y, x if specified, to
|
|
1864
|
+
the end of the line, and return the text in the encoding of the
|
|
1865
|
+
current locale, with attributes and color pairs stripped. At most n
|
|
1866
|
+
bytes are read.
|
|
1840
1867
|
"""
|
|
1841
1868
|
...
|
|
1842
1869
|
|
|
@@ -4,10 +4,17 @@ from typing import Final, final
|
|
|
4
4
|
__version__: Final[str]
|
|
5
5
|
version: Final[str]
|
|
6
6
|
|
|
7
|
-
class error(Exception):
|
|
7
|
+
class error(Exception):
|
|
8
|
+
"""Exception raised when a curses panel library function returns an error."""
|
|
9
|
+
...
|
|
8
10
|
|
|
9
11
|
@final
|
|
10
12
|
class panel:
|
|
13
|
+
"""
|
|
14
|
+
A curses panel.
|
|
15
|
+
|
|
16
|
+
Panel objects are returned by new_panel().
|
|
17
|
+
"""
|
|
11
18
|
def above(self) -> panel:
|
|
12
19
|
"""Return the panel above the current panel."""
|
|
13
20
|
...
|
|
@@ -68,9 +68,11 @@ if sys.version_info >= (3, 11):
|
|
|
68
68
|
flags: dict[_TrapType, bool] | None = None,
|
|
69
69
|
) -> _ContextManager:
|
|
70
70
|
"""
|
|
71
|
-
Return a context manager
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
Return a context manager for a copy of the supplied context.
|
|
72
|
+
|
|
73
|
+
That will set the default context to a copy of ctx on entry to the
|
|
74
|
+
with-statement and restore the previous default context when exiting
|
|
75
|
+
the with-statement. If no context is specified, a copy of the current
|
|
74
76
|
default context is used.
|
|
75
77
|
"""
|
|
76
78
|
...
|
|
@@ -88,9 +90,10 @@ else:
|
|
|
88
90
|
if sys.version_info >= (3, 14):
|
|
89
91
|
def IEEEContext(bits: int, /) -> Context:
|
|
90
92
|
"""
|
|
91
|
-
Return a context
|
|
92
|
-
|
|
93
|
-
than
|
|
93
|
+
Return a context, initialized as one of the IEEE interchange formats.
|
|
94
|
+
|
|
95
|
+
The argument must be a multiple of 32 and less than
|
|
96
|
+
IEEE_CONTEXT_MAX_BITS.
|
|
94
97
|
"""
|
|
95
98
|
...
|
|
96
99
|
|
|
@@ -15,15 +15,22 @@ class QueueNotFoundError(QueueError): ...
|
|
|
15
15
|
|
|
16
16
|
def bind(qid: SupportsIndex) -> None:
|
|
17
17
|
"""
|
|
18
|
-
bind(qid)
|
|
19
|
-
|
|
20
18
|
Take a reference to the identified queue.
|
|
19
|
+
|
|
21
20
|
The queue is not destroyed until there are no references left.
|
|
22
21
|
"""
|
|
23
22
|
...
|
|
24
23
|
|
|
25
24
|
if sys.version_info >= (3, 15):
|
|
26
|
-
def create(maxsize: SupportsIndex, unboundop: SupportsIndex = -1, fallback: SupportsIndex = -1) -> int:
|
|
25
|
+
def create(maxsize: SupportsIndex, unboundop: SupportsIndex = -1, fallback: SupportsIndex = -1) -> int:
|
|
26
|
+
"""
|
|
27
|
+
Create a new cross-interpreter queue and return its unique generated ID.
|
|
28
|
+
|
|
29
|
+
It is a new reference as though bind() had been called on the queue.
|
|
30
|
+
The caller is responsible for calling destroy() for the new queue
|
|
31
|
+
before the runtime is finalized.
|
|
32
|
+
"""
|
|
33
|
+
...
|
|
27
34
|
|
|
28
35
|
else:
|
|
29
36
|
def create(maxsize: SupportsIndex, fmt: SupportsIndex, unboundop: _UnboundOp) -> int:
|
|
@@ -40,61 +47,43 @@ else:
|
|
|
40
47
|
|
|
41
48
|
def destroy(qid: SupportsIndex) -> None:
|
|
42
49
|
"""
|
|
43
|
-
destroy
|
|
50
|
+
Clear and destroy the queue.
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
Afterward attempts to use the queue will behave as though it never
|
|
53
|
+
existed.
|
|
47
54
|
"""
|
|
48
55
|
...
|
|
49
56
|
def get(qid: SupportsIndex) -> tuple[Any, int, _UnboundOp | None]:
|
|
50
57
|
"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Return a new object from the data at the front of the queue.
|
|
54
|
-
The unbound op is also returned.
|
|
58
|
+
Return the (object, unbound op) from the front of the queue.
|
|
55
59
|
|
|
56
60
|
If there is nothing to receive then raise QueueEmpty.
|
|
57
61
|
"""
|
|
58
62
|
...
|
|
59
63
|
def get_count(qid: SupportsIndex) -> int:
|
|
60
|
-
"""
|
|
61
|
-
get_count(qid)
|
|
62
|
-
|
|
63
|
-
Return the number of items in the queue.
|
|
64
|
-
"""
|
|
64
|
+
"""Return the number of items in the queue."""
|
|
65
65
|
...
|
|
66
66
|
def get_maxsize(qid: SupportsIndex) -> int:
|
|
67
|
-
"""
|
|
68
|
-
get_maxsize(qid)
|
|
69
|
-
|
|
70
|
-
Return the maximum number of items in the queue.
|
|
71
|
-
"""
|
|
67
|
+
"""Return the maximum number of items in the queue."""
|
|
72
68
|
...
|
|
73
69
|
def get_queue_defaults(qid: SupportsIndex) -> tuple[int, _UnboundOp]:
|
|
74
|
-
"""
|
|
75
|
-
get_queue_defaults(qid)
|
|
76
|
-
|
|
77
|
-
Return the queue's default values, set when it was created.
|
|
78
|
-
"""
|
|
70
|
+
"""Return the queue's default values, set when it was created."""
|
|
79
71
|
...
|
|
80
72
|
def is_full(qid: SupportsIndex) -> bool:
|
|
81
|
-
"""
|
|
82
|
-
is_full(qid)
|
|
83
|
-
|
|
84
|
-
Return true if the queue has a maxsize and has reached it.
|
|
85
|
-
"""
|
|
73
|
+
"""Return true if the queue has a maxsize and has reached it."""
|
|
86
74
|
...
|
|
87
75
|
def list_all() -> list[tuple[int, int, _UnboundOp]]:
|
|
88
76
|
"""
|
|
89
|
-
|
|
77
|
+
Return the list of ID triples for all queues.
|
|
90
78
|
|
|
91
|
-
|
|
92
|
-
Each corresponding default unbound op and fallback is also included.
|
|
79
|
+
Each ID triple consists of (ID, default unbound op, default fallback).
|
|
93
80
|
"""
|
|
94
81
|
...
|
|
95
82
|
|
|
96
83
|
if sys.version_info >= (3, 15):
|
|
97
|
-
def put(qid: SupportsIndex, obj: Any, unboundop: SupportsIndex = -1, fallback: SupportsIndex = -1) -> None:
|
|
84
|
+
def put(qid: SupportsIndex, obj: Any, unboundop: SupportsIndex = -1, fallback: SupportsIndex = -1) -> None:
|
|
85
|
+
"""Add the object's data to the queue."""
|
|
86
|
+
...
|
|
98
87
|
|
|
99
88
|
else:
|
|
100
89
|
def put(qid: SupportsIndex, obj: Any, fmt: SupportsIndex, unboundop: _UnboundOp) -> None:
|
|
@@ -107,9 +96,8 @@ else:
|
|
|
107
96
|
|
|
108
97
|
def release(qid: SupportsIndex) -> None:
|
|
109
98
|
"""
|
|
110
|
-
release(qid)
|
|
111
|
-
|
|
112
99
|
Release a reference to the queue.
|
|
100
|
+
|
|
113
101
|
The queue is destroyed once there are no references left.
|
|
114
102
|
"""
|
|
115
103
|
...
|
|
@@ -29,8 +29,6 @@ class CrossInterpreterBufferView:
|
|
|
29
29
|
|
|
30
30
|
def new_config(name: _Configs = "isolated", /, **overides: object) -> types.SimpleNamespace:
|
|
31
31
|
"""
|
|
32
|
-
new_config(name='isolated', /, **overrides) -> type.SimpleNamespace
|
|
33
|
-
|
|
34
32
|
Return a representation of a new PyInterpreterConfig.
|
|
35
33
|
|
|
36
34
|
The name determines the initial values of the config. Supported named
|
|
@@ -42,24 +40,20 @@ def new_config(name: _Configs = "isolated", /, **overides: object) -> types.Simp
|
|
|
42
40
|
...
|
|
43
41
|
def create(config: types.SimpleNamespace | _Configs | None = "isolated", *, reqrefs: bool = False) -> int:
|
|
44
42
|
"""
|
|
45
|
-
create([config], *, reqrefs=False) -> ID
|
|
46
|
-
|
|
47
43
|
Create a new interpreter and return a unique generated ID.
|
|
48
44
|
|
|
49
45
|
The caller is responsible for destroying the interpreter before exiting,
|
|
50
|
-
typically by using _interpreters.destroy(). This can be managed
|
|
46
|
+
typically by using _interpreters.destroy(). This can be managed
|
|
51
47
|
automatically by passing "reqrefs=True" and then using _incref() and
|
|
52
48
|
_decref() appropriately.
|
|
53
49
|
|
|
54
50
|
"config" must be a valid interpreter config or the name of a
|
|
55
|
-
predefined config (
|
|
56
|
-
is
|
|
51
|
+
predefined config ('isolated' or 'legacy'). The default
|
|
52
|
+
is 'isolated'.
|
|
57
53
|
"""
|
|
58
54
|
...
|
|
59
55
|
def destroy(id: SupportsIndex, *, restrict: bool = False) -> None:
|
|
60
56
|
"""
|
|
61
|
-
destroy(id, *, restrict=False)
|
|
62
|
-
|
|
63
57
|
Destroy the identified interpreter.
|
|
64
58
|
|
|
65
59
|
Attempting to destroy the current interpreter raises InterpreterError.
|
|
@@ -67,54 +61,29 @@ def destroy(id: SupportsIndex, *, restrict: bool = False) -> None:
|
|
|
67
61
|
"""
|
|
68
62
|
...
|
|
69
63
|
def list_all(*, require_ready: bool = False) -> list[tuple[int, _Whence]]:
|
|
70
|
-
"""
|
|
71
|
-
list_all() -> [(ID, whence)]
|
|
72
|
-
|
|
73
|
-
Return a list containing the ID of every existing interpreter.
|
|
74
|
-
"""
|
|
64
|
+
"""Return a list containing the ID of every existing interpreter."""
|
|
75
65
|
...
|
|
76
66
|
def get_current() -> tuple[int, _Whence]:
|
|
77
|
-
"""
|
|
78
|
-
get_current() -> (ID, whence)
|
|
79
|
-
|
|
80
|
-
Return the ID of current interpreter.
|
|
81
|
-
"""
|
|
67
|
+
"""Return (ID, whence) of the current interpreter."""
|
|
82
68
|
...
|
|
83
69
|
def get_main() -> tuple[int, _Whence]:
|
|
84
|
-
"""
|
|
85
|
-
get_main() -> (ID, whence)
|
|
86
|
-
|
|
87
|
-
Return the ID of main interpreter.
|
|
88
|
-
"""
|
|
70
|
+
"""Return (ID, whence) of the main interpreter."""
|
|
89
71
|
...
|
|
90
72
|
def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool:
|
|
91
|
-
"""
|
|
92
|
-
is_running(id, *, restrict=False) -> bool
|
|
93
|
-
|
|
94
|
-
Return whether or not the identified interpreter is running.
|
|
95
|
-
"""
|
|
73
|
+
"""Return whether or not the identified interpreter is running."""
|
|
96
74
|
...
|
|
97
75
|
def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleNamespace:
|
|
98
|
-
"""
|
|
99
|
-
get_config(id, *, restrict=False) -> types.SimpleNamespace
|
|
100
|
-
|
|
101
|
-
Return a representation of the config used to initialize the interpreter.
|
|
102
|
-
"""
|
|
76
|
+
"""Return a representation of the config used to initialize the interpreter."""
|
|
103
77
|
...
|
|
104
78
|
def whence(id: SupportsIndex) -> _Whence:
|
|
105
|
-
"""
|
|
106
|
-
whence(id) -> int
|
|
107
|
-
|
|
108
|
-
Return an identifier for where the interpreter was created.
|
|
109
|
-
"""
|
|
79
|
+
"""Return an identifier for where the interpreter was created."""
|
|
110
80
|
...
|
|
111
81
|
def exec(
|
|
112
82
|
id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
|
|
113
83
|
) -> None | types.SimpleNamespace:
|
|
114
84
|
"""
|
|
115
|
-
exec(id, code, shared=None, *, restrict=False)
|
|
116
|
-
|
|
117
85
|
Execute the provided code in the identified interpreter.
|
|
86
|
+
|
|
118
87
|
This is equivalent to running the builtin exec() under the target
|
|
119
88
|
interpreter, using the __dict__ of its __main__ module as both
|
|
120
89
|
globals and locals.
|
|
@@ -139,9 +108,8 @@ def call(
|
|
|
139
108
|
restrict: bool = False,
|
|
140
109
|
) -> tuple[_R, types.SimpleNamespace]:
|
|
141
110
|
"""
|
|
142
|
-
call(id, callable, args=None, kwargs=None, *, restrict=False)
|
|
143
|
-
|
|
144
111
|
Call the provided object in the identified interpreter.
|
|
112
|
+
|
|
145
113
|
Pass the given args and kwargs, if possible.
|
|
146
114
|
"""
|
|
147
115
|
...
|
|
@@ -149,64 +117,51 @@ def run_string(
|
|
|
149
117
|
id: SupportsIndex, script: str | types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
|
|
150
118
|
) -> None:
|
|
151
119
|
"""
|
|
152
|
-
run_string(id, script, shared=None, *, restrict=False)
|
|
153
|
-
|
|
154
120
|
Execute the provided string in the identified interpreter.
|
|
155
121
|
|
|
156
|
-
(See _interpreters.exec().
|
|
122
|
+
(See _interpreters.exec().)
|
|
157
123
|
"""
|
|
158
124
|
...
|
|
159
125
|
def run_func(
|
|
160
126
|
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
|
|
161
127
|
) -> None:
|
|
162
128
|
"""
|
|
163
|
-
run_func(id, func, shared=None, *, restrict=False)
|
|
164
|
-
|
|
165
129
|
Execute the body of the provided function in the identified interpreter.
|
|
130
|
+
|
|
166
131
|
Code objects are also supported. In both cases, closures and args
|
|
167
|
-
are not supported. Methods and other callables are not supported
|
|
132
|
+
are not supported. Methods and other callables are not supported
|
|
133
|
+
either.
|
|
168
134
|
|
|
169
|
-
(See _interpreters.exec().
|
|
135
|
+
(See _interpreters.exec().)
|
|
170
136
|
"""
|
|
171
137
|
...
|
|
172
138
|
def set___main___attrs(id: SupportsIndex, updates: _SharedDict, *, restrict: bool = False) -> None:
|
|
173
|
-
"""
|
|
174
|
-
set___main___attrs(id, ns, *, restrict=False)
|
|
175
|
-
|
|
176
|
-
Bind the given attributes in the interpreter's __main__ module.
|
|
177
|
-
"""
|
|
139
|
+
"""Bind the given attributes in the interpreter's __main__ module."""
|
|
178
140
|
...
|
|
179
141
|
def incref(id: SupportsIndex, *, implieslink: bool = False, restrict: bool = False) -> None: ...
|
|
180
142
|
def decref(id: SupportsIndex, *, restrict: bool = False) -> None: ...
|
|
181
143
|
def is_shareable(obj: object) -> bool:
|
|
182
|
-
"""
|
|
183
|
-
is_shareable(obj) -> bool
|
|
184
|
-
|
|
185
|
-
Return True if the object's data may be shared between interpreters and
|
|
186
|
-
False otherwise.
|
|
187
|
-
"""
|
|
144
|
+
"""Return True if the object's data may be shared between interpreters and False otherwise."""
|
|
188
145
|
...
|
|
189
146
|
|
|
190
147
|
@overload
|
|
191
148
|
def capture_exception(exc: BaseException) -> types.SimpleNamespace:
|
|
192
149
|
"""
|
|
193
|
-
|
|
150
|
+
Return a snapshot of an exception.
|
|
194
151
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
The returned snapshot is the same as what _interpreters.exec() returns.
|
|
152
|
+
If "exc" is None then the current exception, if any, is used (but not
|
|
153
|
+
cleared). The returned snapshot is the same as what
|
|
154
|
+
_interpreters.exec() returns.
|
|
199
155
|
"""
|
|
200
156
|
...
|
|
201
157
|
@overload
|
|
202
158
|
def capture_exception(exc: None = None) -> types.SimpleNamespace | None:
|
|
203
159
|
"""
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
Return a snapshot of an exception. If "exc" is None
|
|
207
|
-
then the current exception, if any, is used (but not cleared).
|
|
160
|
+
Return a snapshot of an exception.
|
|
208
161
|
|
|
209
|
-
|
|
162
|
+
If "exc" is None then the current exception, if any, is used (but not
|
|
163
|
+
cleared). The returned snapshot is the same as what
|
|
164
|
+
_interpreters.exec() returns.
|
|
210
165
|
"""
|
|
211
166
|
...
|
|
212
167
|
|