basedpyright 1.18.3 → 1.18.4
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/README.md +3 -3
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/typeshed-fallback/commit.txt +1 -1
- package/dist/typeshed-fallback/stdlib/VERSIONS +2 -0
- package/dist/typeshed-fallback/stdlib/_ast.pyi +140 -1667
- package/dist/typeshed-fallback/stdlib/_csv.pyi +14 -3
- package/dist/typeshed-fallback/stdlib/_curses.pyi +857 -65
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +29 -820
- package/dist/typeshed-fallback/stdlib/_socket.pyi +4 -12
- package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +387 -0
- package/dist/typeshed-fallback/stdlib/_ssl.pyi +406 -0
- package/dist/typeshed-fallback/stdlib/_weakref.pyi +2 -41
- package/dist/typeshed-fallback/stdlib/ast.pyi +1843 -172
- package/dist/typeshed-fallback/stdlib/builtins.pyi +5 -0
- package/dist/typeshed-fallback/stdlib/cProfile.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/calendar.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/concurrent/futures/process.pyi +3 -2
- package/dist/typeshed-fallback/stdlib/contextlib.pyi +6 -8
- package/dist/typeshed-fallback/stdlib/csv.pyi +4 -3
- package/dist/typeshed-fallback/stdlib/curses/__init__.pyi +7 -2
- package/dist/typeshed-fallback/stdlib/curses/panel.pyi +4 -4
- package/dist/typeshed-fallback/stdlib/curses/textpad.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/decimal.pyi +840 -2
- package/dist/typeshed-fallback/stdlib/email/_policybase.pyi +27 -18
- package/dist/typeshed-fallback/stdlib/email/feedparser.pyi +5 -5
- package/dist/typeshed-fallback/stdlib/email/generator.pyi +46 -9
- package/dist/typeshed-fallback/stdlib/email/message.pyi +8 -6
- package/dist/typeshed-fallback/stdlib/email/parser.pyi +6 -4
- package/dist/typeshed-fallback/stdlib/email/policy.pyi +28 -10
- package/dist/typeshed-fallback/stdlib/http/client.pyi +3 -2
- package/dist/typeshed-fallback/stdlib/io.pyi +6 -22
- package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +27 -19
- package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +5 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +4 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/reduction.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/profile.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +1 -5
- package/dist/typeshed-fallback/stdlib/re.pyi +10 -1
- package/dist/typeshed-fallback/stdlib/socket.pyi +12 -4
- package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +739 -1
- package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +220 -884
- package/dist/typeshed-fallback/stdlib/sre_constants.pyi +1 -8
- package/dist/typeshed-fallback/stdlib/ssl.pyi +40 -128
- package/dist/typeshed-fallback/stdlib/tarfile.pyi +111 -6
- package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +127 -21
- package/dist/typeshed-fallback/stdlib/tokenize.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/typing.pyi +7 -7
- package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/weakref.pyi +49 -14
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/__init__.pyi +6 -0
- package/dist/typeshed-fallback/stdlib/xmlrpc/client.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/xmlrpc/server.pyi +3 -2
- package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +41 -44
- package/dist/typeshed-fallback/stdlib/zoneinfo/_common.pyi +13 -0
- package/dist/typeshed-fallback/stdlib/zoneinfo/_tzpath.pyi +13 -0
- package/dist/typeshed-fallback/stubs/Flask-SocketIO/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/braintree/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/braintree/braintree/error_codes.pyi +1 -0
- package/dist/typeshed-fallback/stubs/docutils/docutils/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stubs/docutils/docutils/frontend.pyi +1 -2
- package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/directives/admonitions.pyi +15 -2
- package/dist/typeshed-fallback/stubs/docutils/docutils/readers/doctree.pyi +1 -1
- package/dist/typeshed-fallback/stubs/docutils/docutils/writers/__init__.pyi +21 -2
- package/dist/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi +4 -4
- package/dist/typeshed-fallback/stubs/greenlet/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/hdbcli/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/icalendar/METADATA.toml +5 -2
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/__init__.pyi +49 -5
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/cal.pyi +32 -6
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/caselessdict.pyi +2 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/parser.pyi +25 -1
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/parser_tools.pyi +7 -3
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/prop.pyi +112 -72
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/__init__.pyi +8 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/provider.pyi +29 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/pytz.pyi +22 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi +30 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone/zoneinfo.pyi +33 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/tools.pyi +2 -0
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/version.pyi +8 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/METADATA.toml +3 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/common.pyi +48 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwa.pyi +35 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwe.pyi +51 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwk.pyi +115 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jws.pyi +52 -0
- package/dist/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwt.pyi +78 -0
- package/dist/typeshed-fallback/stubs/m3u8/METADATA.toml +2 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/__init__.pyi +74 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/httpclient.pyi +19 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/mixins.pyi +25 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/model.pyi +406 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/parser.pyi +14 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/protocol.pyi +41 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/version_matching.pyi +5 -0
- package/dist/typeshed-fallback/stubs/m3u8/m3u8/version_matching_rules.pyi +24 -0
- package/dist/typeshed-fallback/stubs/paramiko/paramiko/transport.pyi +2 -1
- package/dist/typeshed-fallback/stubs/protobuf/METADATA.toml +2 -2
- package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +4 -3
- package/dist/typeshed-fallback/stubs/protobuf/google/protobuf/internal/well_known_types.pyi +0 -1
- package/dist/typeshed-fallback/stubs/pytz/pytz/__init__.pyi +4 -4
- package/dist/typeshed-fallback/stubs/pytz/pytz/tzinfo.pyi +1 -1
- package/dist/typeshed-fallback/stubs/qrcode/METADATA.toml +3 -2
- package/dist/typeshed-fallback/stubs/redis/redis/client.pyi +18 -0
- package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/graphics/renderPDF.pyi +2 -2
- package/dist/typeshed-fallback/stubs/seaborn/METADATA.toml +9 -1
- package/dist/typeshed-fallback/stubs/vobject/vobject/__init__.pyi +4 -0
- package/dist/typeshed-fallback/stubs/vobject/vobject/base.pyi +11 -2
- package/dist/typeshed-fallback/stubs/vobject/vobject/behavior.pyi +1 -1
- package/dist/typeshed-fallback/stubs/vobject/vobject/change_tz.pyi +4 -0
- package/dist/typeshed-fallback/stubs/vobject/vobject/ics_diff.pyi +0 -3
- package/dist/typeshed-fallback/stubs/vobject/vobject/vcard.pyi +1 -1
- package/dist/typeshed-fallback/stubs/waitress/waitress/__init__.pyi +2 -2
- package/package.json +1 -1
- package/dist/typeshed-fallback/stubs/Pillow/METADATA.toml +0 -8
- package/dist/typeshed-fallback/stubs/Pillow/PIL/BdfFontFile.pyi +0 -11
- package/dist/typeshed-fallback/stubs/Pillow/PIL/BlpImagePlugin.pyi +0 -39
- package/dist/typeshed-fallback/stubs/Pillow/PIL/BmpImagePlugin.pyi +0 -25
- package/dist/typeshed-fallback/stubs/Pillow/PIL/BufrStubImagePlugin.pyi +0 -9
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ContainerIO.pyi +0 -14
- package/dist/typeshed-fallback/stubs/Pillow/PIL/CurImagePlugin.pyi +0 -6
- package/dist/typeshed-fallback/stubs/Pillow/PIL/DcxImagePlugin.pyi +0 -13
- package/dist/typeshed-fallback/stubs/Pillow/PIL/DdsImagePlugin.pyi +0 -314
- package/dist/typeshed-fallback/stubs/Pillow/PIL/EpsImagePlugin.pyi +0 -34
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ExifTags.pyi +0 -347
- package/dist/typeshed-fallback/stubs/Pillow/PIL/FitsImagePlugin.pyi +0 -7
- package/dist/typeshed-fallback/stubs/Pillow/PIL/FliImagePlugin.pyi +0 -9
- package/dist/typeshed-fallback/stubs/Pillow/PIL/FontFile.pyi +0 -16
- package/dist/typeshed-fallback/stubs/Pillow/PIL/FpxImagePlugin.pyi +0 -23
- package/dist/typeshed-fallback/stubs/Pillow/PIL/FtexImagePlugin.pyi +0 -15
- package/dist/typeshed-fallback/stubs/Pillow/PIL/GbrImagePlugin.pyi +0 -11
- package/dist/typeshed-fallback/stubs/Pillow/PIL/GdImageFile.pyi +0 -9
- package/dist/typeshed-fallback/stubs/Pillow/PIL/GifImagePlugin.pyi +0 -31
- package/dist/typeshed-fallback/stubs/Pillow/PIL/GimpGradientFile.pyi +0 -19
- package/dist/typeshed-fallback/stubs/Pillow/PIL/GimpPaletteFile.pyi +0 -7
- package/dist/typeshed-fallback/stubs/Pillow/PIL/GribStubImagePlugin.pyi +0 -9
- package/dist/typeshed-fallback/stubs/Pillow/PIL/Hdf5StubImagePlugin.pyi +0 -9
- package/dist/typeshed-fallback/stubs/Pillow/PIL/IcnsImagePlugin.pyi +0 -36
- package/dist/typeshed-fallback/stubs/Pillow/PIL/IcoImagePlugin.pyi +0 -26
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImImagePlugin.pyi +0 -34
- package/dist/typeshed-fallback/stubs/Pillow/PIL/Image.pyi +0 -342
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageChops.pyi +0 -23
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageCms.pyi +0 -84
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageColor.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageDraw.pyi +0 -155
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageDraw2.pyi +0 -37
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageEnhance.pyi +0 -25
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFile.pyi +0 -89
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFilter.pyi +0 -136
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageFont.pyi +0 -114
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageGrab.pyi +0 -36
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageMath.pyi +0 -49
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageMode.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageMorph.pyi +0 -26
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageOps.pyi +0 -53
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImagePalette.pyi +0 -26
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImagePath.pyi +0 -3
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageQt.pyi +0 -26
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageSequence.pyi +0 -14
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageShow.pyi +0 -58
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageStat.pyi +0 -14
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageTk.pyi +0 -51
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageTransform.pyi +0 -21
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImageWin.pyi +0 -38
- package/dist/typeshed-fallback/stubs/Pillow/PIL/ImtImagePlugin.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/IptcImagePlugin.pyi +0 -23
- package/dist/typeshed-fallback/stubs/Pillow/PIL/Jpeg2KImagePlugin.pyi +0 -23
- package/dist/typeshed-fallback/stubs/Pillow/PIL/JpegImagePlugin.pyi +0 -30
- package/dist/typeshed-fallback/stubs/Pillow/PIL/JpegPresets.pyi +0 -3
- package/dist/typeshed-fallback/stubs/Pillow/PIL/McIdasImagePlugin.pyi +0 -7
- package/dist/typeshed-fallback/stubs/Pillow/PIL/MicImagePlugin.pyi +0 -18
- package/dist/typeshed-fallback/stubs/Pillow/PIL/MpegImagePlugin.pyi +0 -18
- package/dist/typeshed-fallback/stubs/Pillow/PIL/MpoImagePlugin.pyi +0 -15
- package/dist/typeshed-fallback/stubs/Pillow/PIL/MspImagePlugin.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PSDraw.pyi +0 -19
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PaletteFile.pyi +0 -7
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PalmImagePlugin.pyi +0 -5
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PcdImagePlugin.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PcfFontFile.pyi +0 -25
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PcxImagePlugin.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PdfParser.pyi +0 -167
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PixarImagePlugin.pyi +0 -7
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PngImagePlugin.pyi +0 -115
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PpmImagePlugin.pyi +0 -17
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PsdImagePlugin.pyi +0 -17
- package/dist/typeshed-fallback/stubs/Pillow/PIL/PyAccess.pyi +0 -69
- package/dist/typeshed-fallback/stubs/Pillow/PIL/QoiImagePlugin.pyi +0 -11
- package/dist/typeshed-fallback/stubs/Pillow/PIL/SgiImagePlugin.pyi +0 -13
- package/dist/typeshed-fallback/stubs/Pillow/PIL/SpiderImagePlugin.pyi +0 -28
- package/dist/typeshed-fallback/stubs/Pillow/PIL/SunImagePlugin.pyi +0 -7
- package/dist/typeshed-fallback/stubs/Pillow/PIL/TarIO.pyi +0 -12
- package/dist/typeshed-fallback/stubs/Pillow/PIL/TgaImagePlugin.pyi +0 -12
- package/dist/typeshed-fallback/stubs/Pillow/PIL/TiffImagePlugin.pyi +0 -295
- package/dist/typeshed-fallback/stubs/Pillow/PIL/TiffTags.pyi +0 -46
- package/dist/typeshed-fallback/stubs/Pillow/PIL/WalImageFile.pyi +0 -14
- package/dist/typeshed-fallback/stubs/Pillow/PIL/WebPImagePlugin.pyi +0 -18
- package/dist/typeshed-fallback/stubs/Pillow/PIL/WmfImagePlugin.pyi +0 -19
- package/dist/typeshed-fallback/stubs/Pillow/PIL/XVThumbImagePlugin.pyi +0 -9
- package/dist/typeshed-fallback/stubs/Pillow/PIL/XbmImagePlugin.pyi +0 -10
- package/dist/typeshed-fallback/stubs/Pillow/PIL/XpmImagePlugin.pyi +0 -11
- package/dist/typeshed-fallback/stubs/Pillow/PIL/__init__.pyi +0 -3
- package/dist/typeshed-fallback/stubs/Pillow/PIL/_binary.pyi +0 -13
- package/dist/typeshed-fallback/stubs/Pillow/PIL/_imaging.pyi +0 -29
- package/dist/typeshed-fallback/stubs/Pillow/PIL/_tkinter_finder.pyi +0 -2
- package/dist/typeshed-fallback/stubs/Pillow/PIL/_version.pyi +0 -1
- package/dist/typeshed-fallback/stubs/Pillow/PIL/features.pyi +0 -23
- package/dist/typeshed-fallback/stubs/icalendar/icalendar/timezone_cache.pyi +0 -0
- /package/dist/typeshed-fallback/stubs/icalendar/icalendar/{windows_to_olson.pyi → timezone/windows_to_olson.pyi} +0 -0
- /package/dist/typeshed-fallback/stubs/{Pillow/PIL/PdfImagePlugin.pyi → jwcrypto/jwcrypto/__init__.pyi} +0 -0
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
from abc import ABCMeta, abstractmethod
|
|
2
|
-
from collections.abc import Callable
|
|
3
2
|
from email.errors import MessageDefect
|
|
4
3
|
from email.header import Header
|
|
5
4
|
from email.message import Message
|
|
5
|
+
from typing import Generic, Protocol, TypeVar, type_check_only
|
|
6
6
|
from typing_extensions import Self
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
_MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
|
9
|
+
|
|
10
|
+
@type_check_only
|
|
11
|
+
class _MessageFactory(Protocol[_MessageT]):
|
|
12
|
+
def __call__(self, policy: Policy[_MessageT]) -> _MessageT: ...
|
|
13
|
+
|
|
14
|
+
# Policy below is the only known direct subclass of _PolicyBase. We therefore
|
|
15
|
+
# assume that the __init__ arguments and attributes of _PolicyBase are
|
|
16
|
+
# the same as those of Policy.
|
|
17
|
+
class _PolicyBase(Generic[_MessageT]):
|
|
18
|
+
max_line_length: int | None
|
|
19
|
+
linesep: str
|
|
20
|
+
cte_type: str
|
|
21
|
+
raise_on_defect: bool
|
|
22
|
+
mangle_from_: bool
|
|
23
|
+
message_factory: _MessageFactory[_MessageT] | None
|
|
24
|
+
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
|
25
|
+
verify_generated_headers: bool
|
|
26
|
+
|
|
9
27
|
def __init__(
|
|
10
28
|
self,
|
|
11
29
|
*,
|
|
@@ -14,7 +32,7 @@ class _PolicyBase:
|
|
|
14
32
|
cte_type: str = "8bit",
|
|
15
33
|
raise_on_defect: bool = False,
|
|
16
34
|
mangle_from_: bool = ..., # default depends on sub-class
|
|
17
|
-
message_factory:
|
|
35
|
+
message_factory: _MessageFactory[_MessageT] | None = None,
|
|
18
36
|
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
|
19
37
|
verify_generated_headers: bool = True,
|
|
20
38
|
) -> None: ...
|
|
@@ -26,24 +44,15 @@ class _PolicyBase:
|
|
|
26
44
|
cte_type: str = ...,
|
|
27
45
|
raise_on_defect: bool = ...,
|
|
28
46
|
mangle_from_: bool = ...,
|
|
29
|
-
message_factory:
|
|
47
|
+
message_factory: _MessageFactory[_MessageT] | None = ...,
|
|
30
48
|
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
|
31
49
|
verify_generated_headers: bool = ...,
|
|
32
50
|
) -> Self: ...
|
|
33
51
|
def __add__(self, other: Policy) -> Self: ...
|
|
34
52
|
|
|
35
|
-
class Policy(_PolicyBase, metaclass=ABCMeta):
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cte_type: str
|
|
39
|
-
raise_on_defect: bool
|
|
40
|
-
mangle_from_: bool
|
|
41
|
-
message_factory: Callable[[Policy], Message] | None
|
|
42
|
-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
|
|
43
|
-
verify_generated_headers: bool
|
|
44
|
-
|
|
45
|
-
def handle_defect(self, obj: Message, defect: MessageDefect) -> None: ...
|
|
46
|
-
def register_defect(self, obj: Message, defect: MessageDefect) -> None: ...
|
|
53
|
+
class Policy(_PolicyBase[_MessageT], metaclass=ABCMeta):
|
|
54
|
+
def handle_defect(self, obj: _MessageT, defect: MessageDefect) -> None: ...
|
|
55
|
+
def register_defect(self, obj: _MessageT, defect: MessageDefect) -> None: ...
|
|
47
56
|
def header_max_count(self, name: str) -> int | None: ...
|
|
48
57
|
@abstractmethod
|
|
49
58
|
def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ...
|
|
@@ -56,11 +65,11 @@ class Policy(_PolicyBase, metaclass=ABCMeta):
|
|
|
56
65
|
@abstractmethod
|
|
57
66
|
def fold_binary(self, name: str, value: str) -> bytes: ...
|
|
58
67
|
|
|
59
|
-
class Compat32(Policy):
|
|
68
|
+
class Compat32(Policy[_MessageT]):
|
|
60
69
|
def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ...
|
|
61
70
|
def header_store_parse(self, name: str, value: str) -> tuple[str, str]: ...
|
|
62
71
|
def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore[override]
|
|
63
72
|
def fold(self, name: str, value: str) -> str: ...
|
|
64
73
|
def fold_binary(self, name: str, value: str) -> bytes: ...
|
|
65
74
|
|
|
66
|
-
compat32: Compat32
|
|
75
|
+
compat32: Compat32[Message]
|
|
@@ -5,19 +5,19 @@ from typing import Generic, TypeVar, overload
|
|
|
5
5
|
|
|
6
6
|
__all__ = ["FeedParser", "BytesFeedParser"]
|
|
7
7
|
|
|
8
|
-
_MessageT = TypeVar("_MessageT", bound=Message)
|
|
8
|
+
_MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
|
9
9
|
|
|
10
10
|
class FeedParser(Generic[_MessageT]):
|
|
11
11
|
@overload
|
|
12
|
-
def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ...
|
|
12
|
+
def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy[Message] = ...) -> None: ...
|
|
13
13
|
@overload
|
|
14
|
-
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
|
14
|
+
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ...
|
|
15
15
|
def feed(self, data: str) -> None: ...
|
|
16
16
|
def close(self) -> _MessageT: ...
|
|
17
17
|
|
|
18
18
|
class BytesFeedParser(FeedParser[_MessageT]):
|
|
19
19
|
@overload
|
|
20
|
-
def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ...
|
|
20
|
+
def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy[Message] = ...) -> None: ...
|
|
21
21
|
@overload
|
|
22
|
-
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
|
22
|
+
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ...
|
|
23
23
|
def feed(self, data: bytes | bytearray) -> None: ... # type: ignore[override]
|
|
@@ -1,34 +1,71 @@
|
|
|
1
1
|
from _typeshed import SupportsWrite
|
|
2
2
|
from email.message import Message
|
|
3
3
|
from email.policy import Policy
|
|
4
|
+
from typing import Any, Generic, TypeVar, overload
|
|
4
5
|
from typing_extensions import Self
|
|
5
6
|
|
|
6
7
|
__all__ = ["Generator", "DecodedGenerator", "BytesGenerator"]
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
# By default, generators do not have a message policy.
|
|
10
|
+
_MessageT = TypeVar("_MessageT", bound=Message, default=Any)
|
|
11
|
+
|
|
12
|
+
class Generator(Generic[_MessageT]):
|
|
13
|
+
maxheaderlen: int | None
|
|
14
|
+
policy: Policy[_MessageT] | None
|
|
15
|
+
@overload
|
|
16
|
+
def __init__(
|
|
17
|
+
self: Generator[Any], # The Policy of the message is used.
|
|
18
|
+
outfp: SupportsWrite[str],
|
|
19
|
+
mangle_from_: bool | None = None,
|
|
20
|
+
maxheaderlen: int | None = None,
|
|
21
|
+
*,
|
|
22
|
+
policy: None = None,
|
|
23
|
+
) -> None: ...
|
|
24
|
+
@overload
|
|
11
25
|
def __init__(
|
|
12
26
|
self,
|
|
13
27
|
outfp: SupportsWrite[str],
|
|
14
28
|
mangle_from_: bool | None = None,
|
|
15
29
|
maxheaderlen: int | None = None,
|
|
16
30
|
*,
|
|
17
|
-
policy: Policy
|
|
31
|
+
policy: Policy[_MessageT],
|
|
18
32
|
) -> None: ...
|
|
19
|
-
def
|
|
33
|
+
def write(self, s: str) -> None: ...
|
|
34
|
+
def flatten(self, msg: _MessageT, unixfrom: bool = False, linesep: str | None = None) -> None: ...
|
|
35
|
+
def clone(self, fp: SupportsWrite[str]) -> Self: ...
|
|
20
36
|
|
|
21
|
-
class BytesGenerator(Generator):
|
|
37
|
+
class BytesGenerator(Generator[_MessageT]):
|
|
38
|
+
@overload
|
|
39
|
+
def __init__(
|
|
40
|
+
self: BytesGenerator[Any], # The Policy of the message is used.
|
|
41
|
+
outfp: SupportsWrite[bytes],
|
|
42
|
+
mangle_from_: bool | None = None,
|
|
43
|
+
maxheaderlen: int | None = None,
|
|
44
|
+
*,
|
|
45
|
+
policy: None = None,
|
|
46
|
+
) -> None: ...
|
|
47
|
+
@overload
|
|
22
48
|
def __init__(
|
|
23
49
|
self,
|
|
24
50
|
outfp: SupportsWrite[bytes],
|
|
25
51
|
mangle_from_: bool | None = None,
|
|
26
52
|
maxheaderlen: int | None = None,
|
|
27
53
|
*,
|
|
28
|
-
policy: Policy
|
|
54
|
+
policy: Policy[_MessageT],
|
|
29
55
|
) -> None: ...
|
|
30
56
|
|
|
31
|
-
class DecodedGenerator(Generator):
|
|
57
|
+
class DecodedGenerator(Generator[_MessageT]):
|
|
58
|
+
@overload
|
|
59
|
+
def __init__(
|
|
60
|
+
self: DecodedGenerator[Any], # The Policy of the message is used.
|
|
61
|
+
outfp: SupportsWrite[str],
|
|
62
|
+
mangle_from_: bool | None = None,
|
|
63
|
+
maxheaderlen: int | None = None,
|
|
64
|
+
fmt: str | None = None,
|
|
65
|
+
*,
|
|
66
|
+
policy: None = None,
|
|
67
|
+
) -> None: ...
|
|
68
|
+
@overload
|
|
32
69
|
def __init__(
|
|
33
70
|
self,
|
|
34
71
|
outfp: SupportsWrite[str],
|
|
@@ -36,5 +73,5 @@ class DecodedGenerator(Generator):
|
|
|
36
73
|
maxheaderlen: int | None = None,
|
|
37
74
|
fmt: str | None = None,
|
|
38
75
|
*,
|
|
39
|
-
policy: Policy
|
|
76
|
+
policy: Policy[_MessageT],
|
|
40
77
|
) -> None: ...
|
|
@@ -30,10 +30,13 @@ class _SupportsDecodeToPayload(Protocol):
|
|
|
30
30
|
def decode(self, encoding: str, errors: str, /) -> _PayloadType | _MultipartPayloadType: ...
|
|
31
31
|
|
|
32
32
|
class Message(Generic[_HeaderT, _HeaderParamT]):
|
|
33
|
-
policy
|
|
33
|
+
# The policy attributes and arguments in this class and its subclasses
|
|
34
|
+
# would ideally use Policy[Self], but this is not possible.
|
|
35
|
+
policy: Policy[Any] # undocumented
|
|
34
36
|
preamble: str | None
|
|
35
37
|
epilogue: str | None
|
|
36
38
|
defects: list[MessageDefect]
|
|
39
|
+
def __init__(self, policy: Policy[Any] = ...) -> None: ...
|
|
37
40
|
def is_multipart(self) -> bool: ...
|
|
38
41
|
def set_unixfrom(self, unixfrom: str) -> None: ...
|
|
39
42
|
def get_unixfrom(self) -> str | None: ...
|
|
@@ -126,8 +129,8 @@ class Message(Generic[_HeaderT, _HeaderParamT]):
|
|
|
126
129
|
def get_charsets(self, failobj: _T) -> list[str | _T]: ...
|
|
127
130
|
def walk(self) -> Generator[Self, None, None]: ...
|
|
128
131
|
def get_content_disposition(self) -> str | None: ...
|
|
129
|
-
def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy | None = None) -> str: ...
|
|
130
|
-
def as_bytes(self, unixfrom: bool = False, policy: Policy | None = None) -> bytes: ...
|
|
132
|
+
def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy[Any] | None = None) -> str: ...
|
|
133
|
+
def as_bytes(self, unixfrom: bool = False, policy: Policy[Any] | None = None) -> bytes: ...
|
|
131
134
|
def __bytes__(self) -> bytes: ...
|
|
132
135
|
def set_param(
|
|
133
136
|
self,
|
|
@@ -139,13 +142,12 @@ class Message(Generic[_HeaderT, _HeaderParamT]):
|
|
|
139
142
|
language: str = "",
|
|
140
143
|
replace: bool = False,
|
|
141
144
|
) -> None: ...
|
|
142
|
-
def __init__(self, policy: Policy = ...) -> None: ...
|
|
143
145
|
# The following two methods are undocumented, but a source code comment states that they are public API
|
|
144
146
|
def set_raw(self, name: str, value: _HeaderParamT) -> None: ...
|
|
145
147
|
def raw_items(self) -> Iterator[tuple[str, _HeaderT]]: ...
|
|
146
148
|
|
|
147
149
|
class MIMEPart(Message[_HeaderRegistryT, _HeaderRegistryParamT]):
|
|
148
|
-
def __init__(self, policy: Policy | None = None) -> None: ...
|
|
150
|
+
def __init__(self, policy: Policy[Any] | None = None) -> None: ...
|
|
149
151
|
def get_body(self, preferencelist: Sequence[str] = ("related", "html", "plain")) -> MIMEPart[_HeaderRegistryT] | None: ...
|
|
150
152
|
def attach(self, payload: Self) -> None: ... # type: ignore[override]
|
|
151
153
|
# The attachments are created via type(self) in the attach method. It's theoretically
|
|
@@ -163,7 +165,7 @@ class MIMEPart(Message[_HeaderRegistryT, _HeaderRegistryParamT]):
|
|
|
163
165
|
def add_attachment(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ...
|
|
164
166
|
def clear(self) -> None: ...
|
|
165
167
|
def clear_content(self) -> None: ...
|
|
166
|
-
def as_string(self, unixfrom: bool = False, maxheaderlen: int | None = None, policy: Policy | None = None) -> str: ...
|
|
168
|
+
def as_string(self, unixfrom: bool = False, maxheaderlen: int | None = None, policy: Policy[Any] | None = None) -> str: ...
|
|
167
169
|
def is_attachment(self) -> bool: ...
|
|
168
170
|
|
|
169
171
|
class EmailMessage(MIMEPart): ...
|
|
@@ -12,9 +12,9 @@ _MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
|
|
12
12
|
|
|
13
13
|
class Parser(Generic[_MessageT]):
|
|
14
14
|
@overload
|
|
15
|
-
def __init__(self: Parser[Message[str, str]], _class: None = None, *, policy: Policy = ...) -> None: ...
|
|
15
|
+
def __init__(self: Parser[Message[str, str]], _class: None = None, *, policy: Policy[Message[str, str]] = ...) -> None: ...
|
|
16
16
|
@overload
|
|
17
|
-
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
|
17
|
+
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ...
|
|
18
18
|
def parse(self, fp: SupportsRead[str], headersonly: bool = False) -> _MessageT: ...
|
|
19
19
|
def parsestr(self, text: str, headersonly: bool = False) -> _MessageT: ...
|
|
20
20
|
|
|
@@ -25,9 +25,11 @@ class HeaderParser(Parser[_MessageT]):
|
|
|
25
25
|
class BytesParser(Generic[_MessageT]):
|
|
26
26
|
parser: Parser[_MessageT]
|
|
27
27
|
@overload
|
|
28
|
-
def __init__(
|
|
28
|
+
def __init__(
|
|
29
|
+
self: BytesParser[Message[str, str]], _class: None = None, *, policy: Policy[Message[str, str]] = ...
|
|
30
|
+
) -> None: ...
|
|
29
31
|
@overload
|
|
30
|
-
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
|
32
|
+
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ...
|
|
31
33
|
def parse(self, fp: _WrappedBuffer, headersonly: bool = False) -> _MessageT: ...
|
|
32
34
|
def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> _MessageT: ...
|
|
33
35
|
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
-
from email._policybase import Compat32 as Compat32, Policy as Policy, compat32 as compat32
|
|
2
|
+
from email._policybase import Compat32 as Compat32, Policy as Policy, _MessageFactory, compat32 as compat32
|
|
3
3
|
from email.contentmanager import ContentManager
|
|
4
|
-
from email.message import Message
|
|
5
|
-
from typing import Any
|
|
4
|
+
from email.message import EmailMessage, Message
|
|
5
|
+
from typing import Any, TypeVar, overload
|
|
6
6
|
|
|
7
7
|
__all__ = ["Compat32", "compat32", "Policy", "EmailPolicy", "default", "strict", "SMTP", "HTTP"]
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
_MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
|
10
|
+
|
|
11
|
+
class EmailPolicy(Policy[_MessageT]):
|
|
10
12
|
utf8: bool
|
|
11
13
|
refold_source: str
|
|
12
14
|
header_factory: Callable[[str, Any], Any]
|
|
13
15
|
content_manager: ContentManager
|
|
16
|
+
@overload
|
|
17
|
+
def __init__(
|
|
18
|
+
self: EmailPolicy[EmailMessage],
|
|
19
|
+
*,
|
|
20
|
+
max_line_length: int | None = ...,
|
|
21
|
+
linesep: str = ...,
|
|
22
|
+
cte_type: str = ...,
|
|
23
|
+
raise_on_defect: bool = ...,
|
|
24
|
+
mangle_from_: bool = ...,
|
|
25
|
+
message_factory: None = None,
|
|
26
|
+
utf8: bool = ...,
|
|
27
|
+
refold_source: str = ...,
|
|
28
|
+
header_factory: Callable[[str, str], str] = ...,
|
|
29
|
+
content_manager: ContentManager = ...,
|
|
30
|
+
) -> None: ...
|
|
31
|
+
@overload
|
|
14
32
|
def __init__(
|
|
15
33
|
self,
|
|
16
34
|
*,
|
|
@@ -19,7 +37,7 @@ class EmailPolicy(Policy):
|
|
|
19
37
|
cte_type: str = ...,
|
|
20
38
|
raise_on_defect: bool = ...,
|
|
21
39
|
mangle_from_: bool = ...,
|
|
22
|
-
message_factory:
|
|
40
|
+
message_factory: _MessageFactory[_MessageT] | None = ...,
|
|
23
41
|
utf8: bool = ...,
|
|
24
42
|
refold_source: str = ...,
|
|
25
43
|
header_factory: Callable[[str, str], str] = ...,
|
|
@@ -31,8 +49,8 @@ class EmailPolicy(Policy):
|
|
|
31
49
|
def fold(self, name: str, value: str) -> Any: ...
|
|
32
50
|
def fold_binary(self, name: str, value: str) -> bytes: ...
|
|
33
51
|
|
|
34
|
-
default: EmailPolicy
|
|
35
|
-
SMTP: EmailPolicy
|
|
36
|
-
SMTPUTF8: EmailPolicy
|
|
37
|
-
HTTP: EmailPolicy
|
|
38
|
-
strict: EmailPolicy
|
|
52
|
+
default: EmailPolicy[EmailMessage]
|
|
53
|
+
SMTP: EmailPolicy[EmailMessage]
|
|
54
|
+
SMTPUTF8: EmailPolicy[EmailMessage]
|
|
55
|
+
HTTP: EmailPolicy[EmailMessage]
|
|
56
|
+
strict: EmailPolicy[EmailMessage]
|
|
@@ -34,6 +34,7 @@ __all__ = [
|
|
|
34
34
|
_DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | ReadableBuffer
|
|
35
35
|
_T = TypeVar("_T")
|
|
36
36
|
_MessageT = TypeVar("_MessageT", bound=email.message.Message)
|
|
37
|
+
_HeaderValue: TypeAlias = ReadableBuffer | str | int
|
|
37
38
|
|
|
38
39
|
HTTP_PORT: int
|
|
39
40
|
HTTPS_PORT: int
|
|
@@ -167,7 +168,7 @@ class HTTPConnection:
|
|
|
167
168
|
method: str,
|
|
168
169
|
url: str,
|
|
169
170
|
body: _DataType | str | None = None,
|
|
170
|
-
headers: Mapping[str,
|
|
171
|
+
headers: Mapping[str, _HeaderValue] = {},
|
|
171
172
|
*,
|
|
172
173
|
encode_chunked: bool = False,
|
|
173
174
|
) -> None: ...
|
|
@@ -180,7 +181,7 @@ class HTTPConnection:
|
|
|
180
181
|
def connect(self) -> None: ...
|
|
181
182
|
def close(self) -> None: ...
|
|
182
183
|
def putrequest(self, method: str, url: str, skip_host: bool = False, skip_accept_encoding: bool = False) -> None: ...
|
|
183
|
-
def putheader(self, header: str | bytes, *
|
|
184
|
+
def putheader(self, header: str | bytes, *values: _HeaderValue) -> None: ...
|
|
184
185
|
def endheaders(self, message_body: _DataType | None = None, *, encode_chunked: bool = False) -> None: ...
|
|
185
186
|
def send(self, data: _DataType | str) -> None: ...
|
|
186
187
|
|
|
@@ -2,7 +2,7 @@ import abc
|
|
|
2
2
|
import builtins
|
|
3
3
|
import codecs
|
|
4
4
|
import sys
|
|
5
|
-
from _typeshed import FileDescriptorOrPath, ReadableBuffer, WriteableBuffer
|
|
5
|
+
from _typeshed import FileDescriptorOrPath, MaybeNone, ReadableBuffer, WriteableBuffer
|
|
6
6
|
from collections.abc import Callable, Iterable, Iterator
|
|
7
7
|
from os import _Opener
|
|
8
8
|
from types import TracebackType
|
|
@@ -187,9 +187,11 @@ class RawIOBase(IOBase):
|
|
|
187
187
|
def readall(self) -> bytes:
|
|
188
188
|
"""Read until EOF, using multiple read() call."""
|
|
189
189
|
...
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
def
|
|
190
|
+
# The following methods can return None if the file is in non-blocking mode
|
|
191
|
+
# and no data is available.
|
|
192
|
+
def readinto(self, buffer: WriteableBuffer, /) -> int | MaybeNone: ...
|
|
193
|
+
def write(self, b: ReadableBuffer, /) -> int | MaybeNone: ...
|
|
194
|
+
def read(self, size: int = -1, /) -> bytes | MaybeNone: ...
|
|
193
195
|
|
|
194
196
|
class BufferedIOBase(IOBase):
|
|
195
197
|
def detach(self) -> RawIOBase:
|
|
@@ -270,24 +272,6 @@ class FileIO(RawIOBase, BinaryIO): # type: ignore[misc] # incompatible definit
|
|
|
270
272
|
def closefd(self) -> bool:
|
|
271
273
|
"""True if the file descriptor will be closed by close()."""
|
|
272
274
|
...
|
|
273
|
-
def write(self, b: ReadableBuffer, /) -> int:
|
|
274
|
-
"""
|
|
275
|
-
Write buffer b to file, return number of bytes written.
|
|
276
|
-
|
|
277
|
-
Only makes one system call, so not all of the data may be written.
|
|
278
|
-
The number of bytes actually written is returned. In non-blocking mode,
|
|
279
|
-
returns None if the write would block.
|
|
280
|
-
"""
|
|
281
|
-
...
|
|
282
|
-
def read(self, size: int = -1, /) -> bytes:
|
|
283
|
-
"""
|
|
284
|
-
Read at most size bytes, returned as bytes.
|
|
285
|
-
|
|
286
|
-
Only makes one system call, so less data may be returned than requested.
|
|
287
|
-
In non-blocking mode, returns None if no data is available.
|
|
288
|
-
Return an empty bytes object at EOF.
|
|
289
|
-
"""
|
|
290
|
-
...
|
|
291
275
|
def __enter__(self) -> Self: ...
|
|
292
276
|
|
|
293
277
|
class BytesIO(BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import socket
|
|
2
2
|
import sys
|
|
3
|
-
import
|
|
4
|
-
from _typeshed import ReadableBuffer
|
|
3
|
+
from _typeshed import Incomplete, ReadableBuffer
|
|
5
4
|
from collections.abc import Iterable
|
|
6
|
-
from
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
from typing import Any, Generic, SupportsIndex, TypeVar
|
|
7
7
|
from typing_extensions import Self, TypeAlias
|
|
8
8
|
|
|
9
9
|
__all__ = ["Client", "Listener", "Pipe", "wait"]
|
|
@@ -11,7 +11,11 @@ __all__ = ["Client", "Listener", "Pipe", "wait"]
|
|
|
11
11
|
# https://docs.python.org/3/library/multiprocessing.html#address-formats
|
|
12
12
|
_Address: TypeAlias = str | tuple[str, int]
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# Defaulting to Any to avoid forcing generics on a lot of pre-existing code
|
|
15
|
+
_SendT = TypeVar("_SendT", contravariant=True, default=Any)
|
|
16
|
+
_RecvT = TypeVar("_RecvT", covariant=True, default=Any)
|
|
17
|
+
|
|
18
|
+
class _ConnectionBase(Generic[_SendT, _RecvT]):
|
|
15
19
|
def __init__(self, handle: SupportsIndex, readable: bool = True, writable: bool = True) -> None: ...
|
|
16
20
|
@property
|
|
17
21
|
def closed(self) -> bool:
|
|
@@ -28,27 +32,27 @@ class _ConnectionBase:
|
|
|
28
32
|
def fileno(self) -> int: ...
|
|
29
33
|
def close(self) -> None: ...
|
|
30
34
|
def send_bytes(self, buf: ReadableBuffer, offset: int = 0, size: int | None = None) -> None: ...
|
|
31
|
-
def send(self, obj:
|
|
35
|
+
def send(self, obj: _SendT) -> None: ...
|
|
32
36
|
def recv_bytes(self, maxlength: int | None = None) -> bytes: ...
|
|
33
37
|
def recv_bytes_into(self, buf: Any, offset: int = 0) -> int: ...
|
|
34
|
-
def recv(self) ->
|
|
38
|
+
def recv(self) -> _RecvT: ...
|
|
35
39
|
def poll(self, timeout: float | None = 0.0) -> bool: ...
|
|
36
40
|
def __enter__(self) -> Self: ...
|
|
37
41
|
def __exit__(
|
|
38
|
-
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb:
|
|
42
|
+
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None
|
|
39
43
|
) -> None: ...
|
|
40
44
|
def __del__(self) -> None: ...
|
|
41
45
|
|
|
42
|
-
class Connection(_ConnectionBase): ...
|
|
46
|
+
class Connection(_ConnectionBase[_SendT, _RecvT]): ...
|
|
43
47
|
|
|
44
48
|
if sys.platform == "win32":
|
|
45
|
-
class PipeConnection(_ConnectionBase): ...
|
|
49
|
+
class PipeConnection(_ConnectionBase[_SendT, _RecvT]): ...
|
|
46
50
|
|
|
47
51
|
class Listener:
|
|
48
52
|
def __init__(
|
|
49
53
|
self, address: _Address | None = None, family: str | None = None, backlog: int = 1, authkey: bytes | None = None
|
|
50
54
|
) -> None: ...
|
|
51
|
-
def accept(self) -> Connection: ...
|
|
55
|
+
def accept(self) -> Connection[Incomplete, Incomplete]: ...
|
|
52
56
|
def close(self) -> None: ...
|
|
53
57
|
@property
|
|
54
58
|
def address(self) -> _Address: ...
|
|
@@ -56,26 +60,30 @@ class Listener:
|
|
|
56
60
|
def last_accepted(self) -> _Address | None: ...
|
|
57
61
|
def __enter__(self) -> Self: ...
|
|
58
62
|
def __exit__(
|
|
59
|
-
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb:
|
|
63
|
+
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None
|
|
60
64
|
) -> None: ...
|
|
61
65
|
|
|
66
|
+
# Any: send and recv methods unused
|
|
62
67
|
if sys.version_info >= (3, 12):
|
|
63
|
-
def deliver_challenge(connection: Connection, authkey: bytes, digest_name: str = "sha256") -> None: ...
|
|
68
|
+
def deliver_challenge(connection: Connection[Any, Any], authkey: bytes, digest_name: str = "sha256") -> None: ...
|
|
64
69
|
|
|
65
70
|
else:
|
|
66
|
-
def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
|
|
71
|
+
def deliver_challenge(connection: Connection[Any, Any], authkey: bytes) -> None: ...
|
|
67
72
|
|
|
68
|
-
def answer_challenge(connection: Connection, authkey: bytes) -> None: ...
|
|
73
|
+
def answer_challenge(connection: Connection[Any, Any], authkey: bytes) -> None: ...
|
|
69
74
|
def wait(
|
|
70
|
-
object_list: Iterable[Connection | socket.socket | int], timeout: float | None = None
|
|
71
|
-
) -> list[Connection | socket.socket | int]: ...
|
|
72
|
-
def Client(address: _Address, family: str | None = None, authkey: bytes | None = None) -> Connection: ...
|
|
75
|
+
object_list: Iterable[Connection[_SendT, _RecvT] | socket.socket | int], timeout: float | None = None
|
|
76
|
+
) -> list[Connection[_SendT, _RecvT] | socket.socket | int]: ...
|
|
77
|
+
def Client(address: _Address, family: str | None = None, authkey: bytes | None = None) -> Connection[Any, Any]: ...
|
|
73
78
|
|
|
74
79
|
# N.B. Keep this in sync with multiprocessing.context.BaseContext.Pipe.
|
|
75
80
|
# _ConnectionBase is the common base class of Connection and PipeConnection
|
|
76
81
|
# and can be used in cross-platform code.
|
|
82
|
+
#
|
|
83
|
+
# The two connections should have the same generic types but inverted (Connection[_T1, _T2], Connection[_T2, _T1]).
|
|
84
|
+
# However, TypeVars scoped entirely within a return annotation is unspecified in the spec.
|
|
77
85
|
if sys.platform != "win32":
|
|
78
|
-
def Pipe(duplex: bool = True) -> tuple[Connection, Connection]: ...
|
|
86
|
+
def Pipe(duplex: bool = True) -> tuple[Connection[Any, Any], Connection[Any, Any]]: ...
|
|
79
87
|
|
|
80
88
|
else:
|
|
81
|
-
def Pipe(duplex: bool = True) -> tuple[PipeConnection, PipeConnection]: ...
|
|
89
|
+
def Pipe(duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]: ...
|
|
@@ -47,10 +47,13 @@ class BaseContext:
|
|
|
47
47
|
# N.B. Keep this in sync with multiprocessing.connection.Pipe.
|
|
48
48
|
# _ConnectionBase is the common base class of Connection and PipeConnection
|
|
49
49
|
# and can be used in cross-platform code.
|
|
50
|
+
#
|
|
51
|
+
# The two connections should have the same generic types but inverted (Connection[_T1, _T2], Connection[_T2, _T1]).
|
|
52
|
+
# However, TypeVars scoped entirely within a return annotation is unspecified in the spec.
|
|
50
53
|
if sys.platform != "win32":
|
|
51
|
-
def Pipe(self, duplex: bool = True) -> tuple[Connection, Connection]: ...
|
|
54
|
+
def Pipe(self, duplex: bool = True) -> tuple[Connection[Any, Any], Connection[Any, Any]]: ...
|
|
52
55
|
else:
|
|
53
|
-
def Pipe(self, duplex: bool = True) -> tuple[PipeConnection, PipeConnection]: ...
|
|
56
|
+
def Pipe(self, duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]: ...
|
|
54
57
|
|
|
55
58
|
def Barrier(
|
|
56
59
|
self, parties: int, action: Callable[..., object] | None = None, timeout: float | None = None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import queue
|
|
2
2
|
import sys
|
|
3
3
|
import threading
|
|
4
|
-
from _typeshed import SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
|
4
|
+
from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
|
5
5
|
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence
|
|
6
6
|
from types import TracebackType
|
|
7
7
|
from typing import Any, AnyStr, ClassVar, Generic, SupportsIndex, TypeVar, overload
|
|
@@ -137,7 +137,9 @@ class Server:
|
|
|
137
137
|
self, registry: dict[str, tuple[Callable[..., Any], Any, Any, Any]], address: Any, authkey: bytes, serializer: str
|
|
138
138
|
) -> None: ...
|
|
139
139
|
def serve_forever(self) -> None: ...
|
|
140
|
-
def accept_connection(
|
|
140
|
+
def accept_connection(
|
|
141
|
+
self, c: Connection[tuple[str, str | None], tuple[str, str, Iterable[Incomplete], Mapping[str, Incomplete]]], name: str
|
|
142
|
+
) -> None: ...
|
|
141
143
|
|
|
142
144
|
class BaseManager:
|
|
143
145
|
if sys.version_info >= (3, 11):
|
|
@@ -35,8 +35,8 @@ if sys.platform == "win32":
|
|
|
35
35
|
handle: int, target_process: int | None = None, inheritable: bool = False, *, source_process: int | None = None
|
|
36
36
|
) -> int: ...
|
|
37
37
|
def steal_handle(source_pid: int, handle: int) -> int: ...
|
|
38
|
-
def send_handle(conn: connection.PipeConnection, handle: int, destination_pid: int) -> None: ...
|
|
39
|
-
def recv_handle(conn: connection.PipeConnection) -> int: ...
|
|
38
|
+
def send_handle(conn: connection.PipeConnection[DupHandle, Any], handle: int, destination_pid: int) -> None: ...
|
|
39
|
+
def recv_handle(conn: connection.PipeConnection[Any, DupHandle]) -> int: ...
|
|
40
40
|
|
|
41
41
|
class DupHandle:
|
|
42
42
|
def __init__(self, handle: int, access: int, pid: int | None = None) -> None: ...
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from _typeshed import StrOrBytesPath
|
|
2
|
-
from collections.abc import Callable
|
|
2
|
+
from collections.abc import Callable, Mapping
|
|
3
3
|
from typing import Any, TypeVar
|
|
4
4
|
from typing_extensions import ParamSpec, Self, TypeAlias
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ __all__ = ["run", "runctx", "Profile"]
|
|
|
7
7
|
|
|
8
8
|
def run(statement: str, filename: str | None = None, sort: str | int = -1) -> None: ...
|
|
9
9
|
def runctx(
|
|
10
|
-
statement: str, globals: dict[str, Any], locals:
|
|
10
|
+
statement: str, globals: dict[str, Any], locals: Mapping[str, Any], filename: str | None = None, sort: str | int = -1
|
|
11
11
|
) -> None: ...
|
|
12
12
|
|
|
13
13
|
_T = TypeVar("_T")
|
|
@@ -26,6 +26,6 @@ class Profile:
|
|
|
26
26
|
def create_stats(self) -> None: ...
|
|
27
27
|
def snapshot_stats(self) -> None: ...
|
|
28
28
|
def run(self, cmd: str) -> Self: ...
|
|
29
|
-
def runctx(self, cmd: str, globals: dict[str, Any], locals:
|
|
29
|
+
def runctx(self, cmd: str, globals: dict[str, Any], locals: Mapping[str, Any]) -> Self: ...
|
|
30
30
|
def runcall(self, func: Callable[_P, _T], /, *args: _P.args, **kw: _P.kwargs) -> _T: ...
|
|
31
31
|
def calibrate(self, m: int, verbose: int = 0) -> float: ...
|
|
@@ -5,17 +5,13 @@ from collections.abc import Callable
|
|
|
5
5
|
from pyexpat import errors as errors, model as model
|
|
6
6
|
from typing import Any, Final, final
|
|
7
7
|
from typing_extensions import TypeAlias
|
|
8
|
+
from xml.parsers.expat import ExpatError as ExpatError
|
|
8
9
|
|
|
9
10
|
EXPAT_VERSION: Final[str] # undocumented
|
|
10
11
|
version_info: tuple[int, int, int] # undocumented
|
|
11
12
|
native_encoding: str # undocumented
|
|
12
13
|
features: list[tuple[str, int]] # undocumented
|
|
13
14
|
|
|
14
|
-
class ExpatError(Exception):
|
|
15
|
-
code: int
|
|
16
|
-
lineno: int
|
|
17
|
-
offset: int
|
|
18
|
-
|
|
19
15
|
error = ExpatError
|
|
20
16
|
XML_PARAM_ENTITY_PARSING_NEVER: Final = 0
|
|
21
17
|
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: Final = 1
|
|
@@ -4,7 +4,6 @@ import sre_constants
|
|
|
4
4
|
import sys
|
|
5
5
|
from _typeshed import ReadableBuffer
|
|
6
6
|
from collections.abc import Callable, Iterator, Mapping
|
|
7
|
-
from sre_constants import error as error
|
|
8
7
|
from typing import Any, AnyStr, Generic, Literal, TypeVar, final, overload
|
|
9
8
|
from typing_extensions import TypeAlias
|
|
10
9
|
|
|
@@ -54,6 +53,16 @@ if sys.version_info >= (3, 13):
|
|
|
54
53
|
|
|
55
54
|
_T = TypeVar("_T")
|
|
56
55
|
|
|
56
|
+
# The implementation defines this in re._constants (version_info >= 3, 11) or
|
|
57
|
+
# sre_constants. Typeshed has it here because its __module__ attribute is set to "re".
|
|
58
|
+
class error(Exception):
|
|
59
|
+
msg: str
|
|
60
|
+
pattern: str | bytes | None
|
|
61
|
+
pos: int | None
|
|
62
|
+
lineno: int
|
|
63
|
+
colno: int
|
|
64
|
+
def __init__(self, msg: str, pattern: str | bytes | None = None, pos: int | None = None) -> None: ...
|
|
65
|
+
|
|
57
66
|
@final
|
|
58
67
|
class Match(Generic[AnyStr]):
|
|
59
68
|
@property
|