basedpyright 1.13.2 → 1.13.3
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-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 +42 -279
- package/dist/typeshed-fallback/stdlib/_bisect.pyi +221 -221
- package/dist/typeshed-fallback/stdlib/_bootlocale.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/_collections_abc.pyi +15 -5
- package/dist/typeshed-fallback/stdlib/_csv.pyi +213 -213
- package/dist/typeshed-fallback/stdlib/_decimal.pyi +0 -18
- package/dist/typeshed-fallback/stdlib/_dummy_thread.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/_dummy_threading.pyi +180 -164
- package/dist/typeshed-fallback/stdlib/_heapq.pyi +67 -67
- package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +16 -0
- package/dist/typeshed-fallback/stdlib/_interpreters.pyi +50 -0
- package/dist/typeshed-fallback/stdlib/_json.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_lsprof.pyi +92 -92
- package/dist/typeshed-fallback/stdlib/_msi.pyi +94 -92
- package/dist/typeshed-fallback/stdlib/_operator.pyi +0 -24
- package/dist/typeshed-fallback/stdlib/_random.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/_tkinter.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/_weakrefset.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/abc.pyi +12 -4
- package/dist/typeshed-fallback/stdlib/argparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/array.pyi +281 -281
- package/dist/typeshed-fallback/stdlib/asynchat.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/asyncio/events.pyi +35 -4
- package/dist/typeshed-fallback/stdlib/asyncio/futures.pyi +107 -15
- package/dist/typeshed-fallback/stdlib/asyncio/locks.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/asyncio/queues.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/asyncio/sslproto.pyi +23 -4
- package/dist/typeshed-fallback/stdlib/asyncio/tasks.pyi +107 -12
- package/dist/typeshed-fallback/stdlib/asyncio/windows_events.pyi +86 -86
- package/dist/typeshed-fallback/stdlib/asyncio/windows_utils.pyi +49 -49
- package/dist/typeshed-fallback/stdlib/asyncore.pyi +90 -90
- package/dist/typeshed-fallback/stdlib/audioop.pyi +95 -95
- package/dist/typeshed-fallback/stdlib/binascii.pyi +123 -123
- package/dist/typeshed-fallback/stdlib/binhex.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/builtins.pyi +0 -1
- package/dist/typeshed-fallback/stdlib/bz2.pyi +59 -6
- package/dist/typeshed-fallback/stdlib/cmath.pyi +112 -112
- package/dist/typeshed-fallback/stdlib/codecs.pyi +18 -6
- package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +200 -56
- package/dist/typeshed-fallback/stdlib/concurrent/futures/__init__.pyi +33 -14
- package/dist/typeshed-fallback/stdlib/concurrent/futures/_base.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/concurrent/futures/thread.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/contextvars.pyi +99 -16
- package/dist/typeshed-fallback/stdlib/csv.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/ctypes/__init__.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/ctypes/_endian.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/curses/panel.pyi +16 -4
- package/dist/typeshed-fallback/stdlib/dataclasses.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/datetime.pyi +346 -104
- package/dist/typeshed-fallback/stdlib/dbm/gnu.pyi +52 -2
- package/dist/typeshed-fallback/stdlib/dbm/ndbm.pyi +26 -2
- package/dist/typeshed-fallback/stdlib/difflib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/distutils/__init__.pyi +5 -5
- package/dist/typeshed-fallback/stdlib/distutils/archive_util.pyi +35 -35
- package/dist/typeshed-fallback/stdlib/distutils/bcppcompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/ccompiler.pyi +173 -173
- package/dist/typeshed-fallback/stdlib/distutils/cmd.pyi +99 -99
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_dumb.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_msi.pyi +45 -45
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_rpm.pyi +52 -52
- package/dist/typeshed-fallback/stdlib/distutils/command/bdist_wininst.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/build.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/command/build_clib.pyi +27 -27
- package/dist/typeshed-fallback/stdlib/distutils/command/build_ext.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/command/build_py.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/build_scripts.pyi +24 -24
- package/dist/typeshed-fallback/stdlib/distutils/command/check.pyi +39 -39
- package/dist/typeshed-fallback/stdlib/distutils/command/clean.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/command/config.pyi +84 -84
- package/dist/typeshed-fallback/stdlib/distutils/command/install.pyi +65 -65
- package/dist/typeshed-fallback/stdlib/distutils/command/install_data.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/command/install_egg_info.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/install_headers.pyi +16 -16
- package/dist/typeshed-fallback/stdlib/distutils/command/install_lib.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/command/install_scripts.pyi +18 -18
- package/dist/typeshed-fallback/stdlib/distutils/command/register.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/command/sdist.pyi +44 -44
- package/dist/typeshed-fallback/stdlib/distutils/command/upload.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/config.pyi +17 -17
- package/dist/typeshed-fallback/stdlib/distutils/core.pyi +57 -57
- package/dist/typeshed-fallback/stdlib/distutils/cygwinccompiler.pyi +20 -20
- package/dist/typeshed-fallback/stdlib/distutils/debug.pyi +1 -1
- package/dist/typeshed-fallback/stdlib/distutils/dep_util.pyi +14 -14
- package/dist/typeshed-fallback/stdlib/distutils/dir_util.pyi +23 -23
- package/dist/typeshed-fallback/stdlib/distutils/dist.pyi +149 -149
- package/dist/typeshed-fallback/stdlib/distutils/errors.pyi +19 -19
- package/dist/typeshed-fallback/stdlib/distutils/extension.pyi +36 -36
- package/dist/typeshed-fallback/stdlib/distutils/fancy_getopt.pyi +34 -34
- package/dist/typeshed-fallback/stdlib/distutils/file_util.pyi +38 -38
- package/dist/typeshed-fallback/stdlib/distutils/filelist.pyi +58 -58
- package/dist/typeshed-fallback/stdlib/distutils/log.pyi +25 -25
- package/dist/typeshed-fallback/stdlib/distutils/msvccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/spawn.pyi +6 -6
- package/dist/typeshed-fallback/stdlib/distutils/sysconfig.pyi +33 -33
- package/dist/typeshed-fallback/stdlib/distutils/text_file.pyi +21 -21
- package/dist/typeshed-fallback/stdlib/distutils/unixccompiler.pyi +3 -3
- package/dist/typeshed-fallback/stdlib/distutils/util.pyi +50 -50
- package/dist/typeshed-fallback/stdlib/distutils/version.pyi +38 -36
- package/dist/typeshed-fallback/stdlib/dummy_threading.pyi +2 -2
- package/dist/typeshed-fallback/stdlib/email/_header_value_parser.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/charset.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/header.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/email/headerregistry.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/enum.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/filecmp.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/fileinput.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/formatter.pyi +88 -88
- package/dist/typeshed-fallback/stdlib/fractions.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/functools.pyi +65 -13
- package/dist/typeshed-fallback/stdlib/graphlib.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/gzip.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hashlib.pyi +42 -14
- package/dist/typeshed-fallback/stdlib/heapq.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/hmac.pyi +30 -2
- package/dist/typeshed-fallback/stdlib/http/cookies.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/imp.pyi +62 -62
- package/dist/typeshed-fallback/stdlib/importlib/abc.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/machinery.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +79 -15
- package/dist/typeshed-fallback/stdlib/importlib/metadata/_meta.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/importlib/resources/simple.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/io.pyi +428 -44
- package/dist/typeshed-fallback/stdlib/ipaddress.pyi +153 -28
- package/dist/typeshed-fallback/stdlib/itertools.pyi +5 -1
- package/dist/typeshed-fallback/stdlib/json/encoder.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/keyword.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/lib2to3/pytree.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/logging/__init__.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/lzma.pyi +107 -9
- package/dist/typeshed-fallback/stdlib/mailbox.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/math.pyi +424 -424
- package/dist/typeshed-fallback/stdlib/mmap.pyi +160 -160
- package/dist/typeshed-fallback/stdlib/msilib/__init__.pyi +177 -177
- package/dist/typeshed-fallback/stdlib/msilib/schema.pyi +94 -94
- package/dist/typeshed-fallback/stdlib/msilib/sequence.pyi +13 -13
- package/dist/typeshed-fallback/stdlib/msilib/text.pyi +7 -7
- package/dist/typeshed-fallback/stdlib/multiprocessing/connection.pyi +9 -3
- package/dist/typeshed-fallback/stdlib/multiprocessing/context.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/dummy/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/managers.pyi +10 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/pool.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/multiprocessing/popen_spawn_win32.pyi +30 -30
- package/dist/typeshed-fallback/stdlib/multiprocessing/process.pyi +15 -4
- package/dist/typeshed-fallback/stdlib/multiprocessing/queues.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/multiprocessing/shared_memory.pyi +19 -5
- package/dist/typeshed-fallback/stdlib/nis.pyi +31 -4
- package/dist/typeshed-fallback/stdlib/numbers.pyi +26 -6
- package/dist/typeshed-fallback/stdlib/opcode.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/optparse.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/os/__init__.pyi +1447 -217
- package/dist/typeshed-fallback/stdlib/pathlib.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/pickle.pyi +200 -12
- package/dist/typeshed-fallback/stdlib/posixpath.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/pyexpat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/pyexpat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/queue.pyi +57 -9
- package/dist/typeshed-fallback/stdlib/re.pyi +219 -57
- package/dist/typeshed-fallback/stdlib/sched.pyi +8 -1
- package/dist/typeshed-fallback/stdlib/signal.pyi +95 -19
- package/dist/typeshed-fallback/stdlib/smtpd.pyi +91 -91
- package/dist/typeshed-fallback/stdlib/socket.pyi +12 -2
- package/dist/typeshed-fallback/stdlib/sqlite3/dbapi2.pyi +417 -83
- package/dist/typeshed-fallback/stdlib/ssl.pyi +133 -22
- package/dist/typeshed-fallback/stdlib/statistics.pyi +20 -5
- package/dist/typeshed-fallback/stdlib/struct.pyi +114 -13
- package/dist/typeshed-fallback/stdlib/subprocess.pyi +14 -2
- package/dist/typeshed-fallback/stdlib/symbol.pyi +93 -93
- package/dist/typeshed-fallback/stdlib/symtable.pyi +30 -1
- package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +7 -3
- package/dist/typeshed-fallback/stdlib/tarfile.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/tempfile.pyi +17 -3
- package/dist/typeshed-fallback/stdlib/threading.pyi +68 -7
- package/dist/typeshed-fallback/stdlib/tkinter/__init__.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/turtle.pyi +11 -3
- package/dist/typeshed-fallback/stdlib/types.pyi +306 -79
- package/dist/typeshed-fallback/stdlib/typing.pyi +310 -31
- package/dist/typeshed-fallback/stdlib/typing_extensions.pyi +42 -11
- package/dist/typeshed-fallback/stdlib/unittest/__init__.pyi +6 -1
- package/dist/typeshed-fallback/stdlib/unittest/case.pyi +7 -1
- package/dist/typeshed-fallback/stdlib/unittest/mock.pyi +3 -1
- package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +51 -3
- package/dist/typeshed-fallback/stdlib/weakref.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/winsound.pyi +44 -28
- package/dist/typeshed-fallback/stdlib/xml/dom/minicompat.pyi +6 -2
- package/dist/typeshed-fallback/stdlib/xml/dom/minidom.pyi +33 -11
- package/dist/typeshed-fallback/stdlib/xml/etree/ElementTree.pyi +30 -10
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/errors.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xml/parsers/expat/model.pyi +2 -0
- package/dist/typeshed-fallback/stdlib/xxlimited.pyi +19 -4
- package/dist/typeshed-fallback/stdlib/zipimport.pyi +31 -0
- package/dist/typeshed-fallback/stdlib/zlib.pyi +157 -157
- package/dist/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +18 -6
- package/dist/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +2 -2
- package/dist/typeshed-fallback/stubs/docker/docker/_types.pyi +18 -1
- package/dist/typeshed-fallback/stubs/docker/docker/api/container.pyi +5 -19
- package/dist/typeshed-fallback/stubs/docker/docker/api/daemon.pyi +2 -1
- package/dist/typeshed-fallback/stubs/docker/docker/models/containers.pyi +268 -6
- package/dist/typeshed-fallback/stubs/docker/docker/types/containers.pyi +3 -7
- package/dist/typeshed-fallback/stubs/docker/docker/types/daemon.pyi +10 -4
- package/dist/typeshed-fallback/stubs/docutils/docutils/parsers/rst/states.pyi +47 -0
- package/dist/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +1 -1
- package/dist/typeshed-fallback/stubs/networkx/networkx/algorithms/shortest_paths/generic.pyi +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +0 -2
- package/dist/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +2 -1
- package/dist/typeshed-fallback/stubs/pygit2/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi +2 -2
- package/dist/typeshed-fallback/stubs/python-crontab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +23 -11
- package/dist/typeshed-fallback/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +6 -0
- package/dist/typeshed-fallback/stubs/setuptools/METADATA.toml +1 -1
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/archive_util.pyi +8 -8
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +11 -17
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +11 -11
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/build_py.pyi +1 -2
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/filelist.pyi +4 -12
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +2 -4
- package/dist/typeshed-fallback/stubs/setuptools/setuptools/_distutils/util.pyi +5 -8
- package/dist/typeshed-fallback/stubs/str2bool/METADATA.toml +2 -0
- package/dist/typeshed-fallback/stubs/str2bool/str2bool/__init__.pyi +7 -0
- package/package.json +1 -1
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from _typeshed import FileDescriptorLike, ReadableBuffer
|
|
3
|
-
from socket import socket
|
|
4
|
-
from typing import Any, overload
|
|
5
|
-
from typing_extensions import TypeAlias
|
|
6
|
-
|
|
7
|
-
# cyclic dependence with asynchat
|
|
8
|
-
_MapType: TypeAlias = dict[int, Any]
|
|
9
|
-
_Socket: TypeAlias = socket
|
|
10
|
-
|
|
11
|
-
socket_map: _MapType # undocumented
|
|
12
|
-
|
|
13
|
-
class ExitNow(Exception): ...
|
|
14
|
-
|
|
15
|
-
def read(obj: Any) -> None: ...
|
|
16
|
-
def write(obj: Any) -> None: ...
|
|
17
|
-
def readwrite(obj: Any, flags: int) -> None: ...
|
|
18
|
-
def poll(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
|
|
19
|
-
def poll2(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
|
|
20
|
-
|
|
21
|
-
poll3 = poll2
|
|
22
|
-
|
|
23
|
-
def loop(timeout: float = 30.0, use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ...
|
|
24
|
-
|
|
25
|
-
# Not really subclass of socket.socket; it's only delegation.
|
|
26
|
-
# It is not covariant to it.
|
|
27
|
-
class dispatcher:
|
|
28
|
-
debug: bool
|
|
29
|
-
connected: bool
|
|
30
|
-
accepting: bool
|
|
31
|
-
connecting: bool
|
|
32
|
-
closing: bool
|
|
33
|
-
ignore_log_types: frozenset[str]
|
|
34
|
-
socket: _Socket | None
|
|
35
|
-
def __init__(self, sock: _Socket | None = None, map: _MapType | None = None) -> None: ...
|
|
36
|
-
def add_channel(self, map: _MapType | None = None) -> None: ...
|
|
37
|
-
def del_channel(self, map: _MapType | None = None) -> None: ...
|
|
38
|
-
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
|
|
39
|
-
def set_socket(self, sock: _Socket, map: _MapType | None = None) -> None: ...
|
|
40
|
-
def set_reuse_addr(self) -> None: ...
|
|
41
|
-
def readable(self) -> bool: ...
|
|
42
|
-
def writable(self) -> bool: ...
|
|
43
|
-
def listen(self, num: int) -> None: ...
|
|
44
|
-
def bind(self, addr: tuple[Any, ...] | str) -> None: ...
|
|
45
|
-
def connect(self, address: tuple[Any, ...] | str) -> None: ...
|
|
46
|
-
def accept(self) -> tuple[_Socket, Any] | None: ...
|
|
47
|
-
def send(self, data: ReadableBuffer) -> int: ...
|
|
48
|
-
def recv(self, buffer_size: int) -> bytes: ...
|
|
49
|
-
def close(self) -> None: ...
|
|
50
|
-
def log(self, message: Any) -> None: ...
|
|
51
|
-
def log_info(self, message: Any, type: str = "info") -> None: ...
|
|
52
|
-
def handle_read_event(self) -> None: ...
|
|
53
|
-
def handle_connect_event(self) -> None: ...
|
|
54
|
-
def handle_write_event(self) -> None: ...
|
|
55
|
-
def handle_expt_event(self) -> None: ...
|
|
56
|
-
def handle_error(self) -> None: ...
|
|
57
|
-
def handle_expt(self) -> None: ...
|
|
58
|
-
def handle_read(self) -> None: ...
|
|
59
|
-
def handle_write(self) -> None: ...
|
|
60
|
-
def handle_connect(self) -> None: ...
|
|
61
|
-
def handle_accept(self) -> None: ...
|
|
62
|
-
def handle_close(self) -> None: ...
|
|
63
|
-
|
|
64
|
-
class dispatcher_with_send(dispatcher):
|
|
65
|
-
def initiate_send(self) -> None: ...
|
|
66
|
-
# incompatible signature:
|
|
67
|
-
# def send(self, data: bytes) -> int | None: ...
|
|
68
|
-
|
|
69
|
-
def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ...
|
|
70
|
-
def close_all(map: _MapType | None = None, ignore_all: bool = False) -> None: ...
|
|
71
|
-
|
|
72
|
-
if sys.platform != "win32":
|
|
73
|
-
class file_wrapper:
|
|
74
|
-
fd: int
|
|
75
|
-
def __init__(self, fd: int) -> None: ...
|
|
76
|
-
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
|
77
|
-
def send(self, data: bytes, flags: int = ...) -> int: ...
|
|
78
|
-
@overload
|
|
79
|
-
def getsockopt(self, level: int, optname: int, buflen: None = None) -> int: ...
|
|
80
|
-
@overload
|
|
81
|
-
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
|
|
82
|
-
def read(self, bufsize: int, flags: int = ...) -> bytes: ...
|
|
83
|
-
def write(self, data: bytes, flags: int = ...) -> int: ...
|
|
84
|
-
def close(self) -> None: ...
|
|
85
|
-
def fileno(self) -> int: ...
|
|
86
|
-
def __del__(self) -> None: ...
|
|
87
|
-
|
|
88
|
-
class file_dispatcher(dispatcher):
|
|
89
|
-
def __init__(self, fd: FileDescriptorLike, map: _MapType | None = None) -> None: ...
|
|
90
|
-
def set_file(self, fd: int) -> None: ...
|
|
1
|
+
import sys
|
|
2
|
+
from _typeshed import FileDescriptorLike, ReadableBuffer
|
|
3
|
+
from socket import socket
|
|
4
|
+
from typing import Any, overload
|
|
5
|
+
from typing_extensions import TypeAlias
|
|
6
|
+
|
|
7
|
+
# cyclic dependence with asynchat
|
|
8
|
+
_MapType: TypeAlias = dict[int, Any]
|
|
9
|
+
_Socket: TypeAlias = socket
|
|
10
|
+
|
|
11
|
+
socket_map: _MapType # undocumented
|
|
12
|
+
|
|
13
|
+
class ExitNow(Exception): ...
|
|
14
|
+
|
|
15
|
+
def read(obj: Any) -> None: ...
|
|
16
|
+
def write(obj: Any) -> None: ...
|
|
17
|
+
def readwrite(obj: Any, flags: int) -> None: ...
|
|
18
|
+
def poll(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
|
|
19
|
+
def poll2(timeout: float = 0.0, map: _MapType | None = None) -> None: ...
|
|
20
|
+
|
|
21
|
+
poll3 = poll2
|
|
22
|
+
|
|
23
|
+
def loop(timeout: float = 30.0, use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ...
|
|
24
|
+
|
|
25
|
+
# Not really subclass of socket.socket; it's only delegation.
|
|
26
|
+
# It is not covariant to it.
|
|
27
|
+
class dispatcher:
|
|
28
|
+
debug: bool
|
|
29
|
+
connected: bool
|
|
30
|
+
accepting: bool
|
|
31
|
+
connecting: bool
|
|
32
|
+
closing: bool
|
|
33
|
+
ignore_log_types: frozenset[str]
|
|
34
|
+
socket: _Socket | None
|
|
35
|
+
def __init__(self, sock: _Socket | None = None, map: _MapType | None = None) -> None: ...
|
|
36
|
+
def add_channel(self, map: _MapType | None = None) -> None: ...
|
|
37
|
+
def del_channel(self, map: _MapType | None = None) -> None: ...
|
|
38
|
+
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
|
|
39
|
+
def set_socket(self, sock: _Socket, map: _MapType | None = None) -> None: ...
|
|
40
|
+
def set_reuse_addr(self) -> None: ...
|
|
41
|
+
def readable(self) -> bool: ...
|
|
42
|
+
def writable(self) -> bool: ...
|
|
43
|
+
def listen(self, num: int) -> None: ...
|
|
44
|
+
def bind(self, addr: tuple[Any, ...] | str) -> None: ...
|
|
45
|
+
def connect(self, address: tuple[Any, ...] | str) -> None: ...
|
|
46
|
+
def accept(self) -> tuple[_Socket, Any] | None: ...
|
|
47
|
+
def send(self, data: ReadableBuffer) -> int: ...
|
|
48
|
+
def recv(self, buffer_size: int) -> bytes: ...
|
|
49
|
+
def close(self) -> None: ...
|
|
50
|
+
def log(self, message: Any) -> None: ...
|
|
51
|
+
def log_info(self, message: Any, type: str = "info") -> None: ...
|
|
52
|
+
def handle_read_event(self) -> None: ...
|
|
53
|
+
def handle_connect_event(self) -> None: ...
|
|
54
|
+
def handle_write_event(self) -> None: ...
|
|
55
|
+
def handle_expt_event(self) -> None: ...
|
|
56
|
+
def handle_error(self) -> None: ...
|
|
57
|
+
def handle_expt(self) -> None: ...
|
|
58
|
+
def handle_read(self) -> None: ...
|
|
59
|
+
def handle_write(self) -> None: ...
|
|
60
|
+
def handle_connect(self) -> None: ...
|
|
61
|
+
def handle_accept(self) -> None: ...
|
|
62
|
+
def handle_close(self) -> None: ...
|
|
63
|
+
|
|
64
|
+
class dispatcher_with_send(dispatcher):
|
|
65
|
+
def initiate_send(self) -> None: ...
|
|
66
|
+
# incompatible signature:
|
|
67
|
+
# def send(self, data: bytes) -> int | None: ...
|
|
68
|
+
|
|
69
|
+
def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ...
|
|
70
|
+
def close_all(map: _MapType | None = None, ignore_all: bool = False) -> None: ...
|
|
71
|
+
|
|
72
|
+
if sys.platform != "win32":
|
|
73
|
+
class file_wrapper:
|
|
74
|
+
fd: int
|
|
75
|
+
def __init__(self, fd: int) -> None: ...
|
|
76
|
+
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
|
77
|
+
def send(self, data: bytes, flags: int = ...) -> int: ...
|
|
78
|
+
@overload
|
|
79
|
+
def getsockopt(self, level: int, optname: int, buflen: None = None) -> int: ...
|
|
80
|
+
@overload
|
|
81
|
+
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
|
|
82
|
+
def read(self, bufsize: int, flags: int = ...) -> bytes: ...
|
|
83
|
+
def write(self, data: bytes, flags: int = ...) -> int: ...
|
|
84
|
+
def close(self) -> None: ...
|
|
85
|
+
def fileno(self) -> int: ...
|
|
86
|
+
def __del__(self) -> None: ...
|
|
87
|
+
|
|
88
|
+
class file_dispatcher(dispatcher):
|
|
89
|
+
def __init__(self, fd: FileDescriptorLike, map: _MapType | None = None) -> None: ...
|
|
90
|
+
def set_file(self, fd: int) -> None: ...
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
from typing_extensions import Buffer, TypeAlias
|
|
2
|
-
|
|
3
|
-
_AdpcmState: TypeAlias = tuple[int, int]
|
|
4
|
-
_RatecvState: TypeAlias = tuple[int, tuple[tuple[int, int], ...]]
|
|
5
|
-
|
|
6
|
-
class error(Exception): ...
|
|
7
|
-
|
|
8
|
-
def add(fragment1: Buffer, fragment2: Buffer, width: int, /) -> bytes:
|
|
9
|
-
"""Return a fragment which is the addition of the two samples passed as parameters."""
|
|
10
|
-
...
|
|
11
|
-
def adpcm2lin(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]:
|
|
12
|
-
"""Decode an Intel/DVI ADPCM coded fragment to a linear fragment."""
|
|
13
|
-
...
|
|
14
|
-
def alaw2lin(fragment: Buffer, width: int, /) -> bytes:
|
|
15
|
-
"""Convert sound fragments in a-LAW encoding to linearly encoded sound fragments."""
|
|
16
|
-
...
|
|
17
|
-
def avg(fragment: Buffer, width: int, /) -> int:
|
|
18
|
-
"""Return the average over all samples in the fragment."""
|
|
19
|
-
...
|
|
20
|
-
def avgpp(fragment: Buffer, width: int, /) -> int:
|
|
21
|
-
"""Return the average peak-peak value over all samples in the fragment."""
|
|
22
|
-
...
|
|
23
|
-
def bias(fragment: Buffer, width: int, bias: int, /) -> bytes:
|
|
24
|
-
"""Return a fragment that is the original fragment with a bias added to each sample."""
|
|
25
|
-
...
|
|
26
|
-
def byteswap(fragment: Buffer, width: int, /) -> bytes:
|
|
27
|
-
"""Convert big-endian samples to little-endian and vice versa."""
|
|
28
|
-
...
|
|
29
|
-
def cross(fragment: Buffer, width: int, /) -> int:
|
|
30
|
-
"""Return the number of zero crossings in the fragment passed as an argument."""
|
|
31
|
-
...
|
|
32
|
-
def findfactor(fragment: Buffer, reference: Buffer, /) -> float:
|
|
33
|
-
"""Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal."""
|
|
34
|
-
...
|
|
35
|
-
def findfit(fragment: Buffer, reference: Buffer, /) -> tuple[int, float]:
|
|
36
|
-
"""Try to match reference as well as possible to a portion of fragment."""
|
|
37
|
-
...
|
|
38
|
-
def findmax(fragment: Buffer, length: int, /) -> int:
|
|
39
|
-
"""Search fragment for a slice of specified number of samples with maximum energy."""
|
|
40
|
-
...
|
|
41
|
-
def getsample(fragment: Buffer, width: int, index: int, /) -> int:
|
|
42
|
-
"""Return the value of sample index from the fragment."""
|
|
43
|
-
...
|
|
44
|
-
def lin2adpcm(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]:
|
|
45
|
-
"""Convert samples to 4 bit Intel/DVI ADPCM encoding."""
|
|
46
|
-
...
|
|
47
|
-
def lin2alaw(fragment: Buffer, width: int, /) -> bytes:
|
|
48
|
-
"""Convert samples in the audio fragment to a-LAW encoding."""
|
|
49
|
-
...
|
|
50
|
-
def lin2lin(fragment: Buffer, width: int, newwidth: int, /) -> bytes:
|
|
51
|
-
"""Convert samples between 1-, 2-, 3- and 4-byte formats."""
|
|
52
|
-
...
|
|
53
|
-
def lin2ulaw(fragment: Buffer, width: int, /) -> bytes:
|
|
54
|
-
"""Convert samples in the audio fragment to u-LAW encoding."""
|
|
55
|
-
...
|
|
56
|
-
def max(fragment: Buffer, width: int, /) -> int:
|
|
57
|
-
"""Return the maximum of the absolute value of all samples in a fragment."""
|
|
58
|
-
...
|
|
59
|
-
def maxpp(fragment: Buffer, width: int, /) -> int:
|
|
60
|
-
"""Return the maximum peak-peak value in the sound fragment."""
|
|
61
|
-
...
|
|
62
|
-
def minmax(fragment: Buffer, width: int, /) -> tuple[int, int]:
|
|
63
|
-
"""Return the minimum and maximum values of all samples in the sound fragment."""
|
|
64
|
-
...
|
|
65
|
-
def mul(fragment: Buffer, width: int, factor: float, /) -> bytes:
|
|
66
|
-
"""Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor."""
|
|
67
|
-
...
|
|
68
|
-
def ratecv(
|
|
69
|
-
fragment: Buffer,
|
|
70
|
-
width: int,
|
|
71
|
-
nchannels: int,
|
|
72
|
-
inrate: int,
|
|
73
|
-
outrate: int,
|
|
74
|
-
state: _RatecvState | None,
|
|
75
|
-
weightA: int = 1,
|
|
76
|
-
weightB: int = 0,
|
|
77
|
-
/,
|
|
78
|
-
) -> tuple[bytes, _RatecvState]:
|
|
79
|
-
"""Convert the frame rate of the input fragment."""
|
|
80
|
-
...
|
|
81
|
-
def reverse(fragment: Buffer, width: int, /) -> bytes:
|
|
82
|
-
"""Reverse the samples in a fragment and returns the modified fragment."""
|
|
83
|
-
...
|
|
84
|
-
def rms(fragment: Buffer, width: int, /) -> int:
|
|
85
|
-
"""Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n)."""
|
|
86
|
-
...
|
|
87
|
-
def tomono(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes:
|
|
88
|
-
"""Convert a stereo fragment to a mono fragment."""
|
|
89
|
-
...
|
|
90
|
-
def tostereo(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes:
|
|
91
|
-
"""Generate a stereo fragment from a mono fragment."""
|
|
92
|
-
...
|
|
93
|
-
def ulaw2lin(fragment: Buffer, width: int, /) -> bytes:
|
|
94
|
-
"""Convert sound fragments in u-LAW encoding to linearly encoded sound fragments."""
|
|
95
|
-
...
|
|
1
|
+
from typing_extensions import Buffer, TypeAlias
|
|
2
|
+
|
|
3
|
+
_AdpcmState: TypeAlias = tuple[int, int]
|
|
4
|
+
_RatecvState: TypeAlias = tuple[int, tuple[tuple[int, int], ...]]
|
|
5
|
+
|
|
6
|
+
class error(Exception): ...
|
|
7
|
+
|
|
8
|
+
def add(fragment1: Buffer, fragment2: Buffer, width: int, /) -> bytes:
|
|
9
|
+
"""Return a fragment which is the addition of the two samples passed as parameters."""
|
|
10
|
+
...
|
|
11
|
+
def adpcm2lin(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]:
|
|
12
|
+
"""Decode an Intel/DVI ADPCM coded fragment to a linear fragment."""
|
|
13
|
+
...
|
|
14
|
+
def alaw2lin(fragment: Buffer, width: int, /) -> bytes:
|
|
15
|
+
"""Convert sound fragments in a-LAW encoding to linearly encoded sound fragments."""
|
|
16
|
+
...
|
|
17
|
+
def avg(fragment: Buffer, width: int, /) -> int:
|
|
18
|
+
"""Return the average over all samples in the fragment."""
|
|
19
|
+
...
|
|
20
|
+
def avgpp(fragment: Buffer, width: int, /) -> int:
|
|
21
|
+
"""Return the average peak-peak value over all samples in the fragment."""
|
|
22
|
+
...
|
|
23
|
+
def bias(fragment: Buffer, width: int, bias: int, /) -> bytes:
|
|
24
|
+
"""Return a fragment that is the original fragment with a bias added to each sample."""
|
|
25
|
+
...
|
|
26
|
+
def byteswap(fragment: Buffer, width: int, /) -> bytes:
|
|
27
|
+
"""Convert big-endian samples to little-endian and vice versa."""
|
|
28
|
+
...
|
|
29
|
+
def cross(fragment: Buffer, width: int, /) -> int:
|
|
30
|
+
"""Return the number of zero crossings in the fragment passed as an argument."""
|
|
31
|
+
...
|
|
32
|
+
def findfactor(fragment: Buffer, reference: Buffer, /) -> float:
|
|
33
|
+
"""Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal."""
|
|
34
|
+
...
|
|
35
|
+
def findfit(fragment: Buffer, reference: Buffer, /) -> tuple[int, float]:
|
|
36
|
+
"""Try to match reference as well as possible to a portion of fragment."""
|
|
37
|
+
...
|
|
38
|
+
def findmax(fragment: Buffer, length: int, /) -> int:
|
|
39
|
+
"""Search fragment for a slice of specified number of samples with maximum energy."""
|
|
40
|
+
...
|
|
41
|
+
def getsample(fragment: Buffer, width: int, index: int, /) -> int:
|
|
42
|
+
"""Return the value of sample index from the fragment."""
|
|
43
|
+
...
|
|
44
|
+
def lin2adpcm(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]:
|
|
45
|
+
"""Convert samples to 4 bit Intel/DVI ADPCM encoding."""
|
|
46
|
+
...
|
|
47
|
+
def lin2alaw(fragment: Buffer, width: int, /) -> bytes:
|
|
48
|
+
"""Convert samples in the audio fragment to a-LAW encoding."""
|
|
49
|
+
...
|
|
50
|
+
def lin2lin(fragment: Buffer, width: int, newwidth: int, /) -> bytes:
|
|
51
|
+
"""Convert samples between 1-, 2-, 3- and 4-byte formats."""
|
|
52
|
+
...
|
|
53
|
+
def lin2ulaw(fragment: Buffer, width: int, /) -> bytes:
|
|
54
|
+
"""Convert samples in the audio fragment to u-LAW encoding."""
|
|
55
|
+
...
|
|
56
|
+
def max(fragment: Buffer, width: int, /) -> int:
|
|
57
|
+
"""Return the maximum of the absolute value of all samples in a fragment."""
|
|
58
|
+
...
|
|
59
|
+
def maxpp(fragment: Buffer, width: int, /) -> int:
|
|
60
|
+
"""Return the maximum peak-peak value in the sound fragment."""
|
|
61
|
+
...
|
|
62
|
+
def minmax(fragment: Buffer, width: int, /) -> tuple[int, int]:
|
|
63
|
+
"""Return the minimum and maximum values of all samples in the sound fragment."""
|
|
64
|
+
...
|
|
65
|
+
def mul(fragment: Buffer, width: int, factor: float, /) -> bytes:
|
|
66
|
+
"""Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor."""
|
|
67
|
+
...
|
|
68
|
+
def ratecv(
|
|
69
|
+
fragment: Buffer,
|
|
70
|
+
width: int,
|
|
71
|
+
nchannels: int,
|
|
72
|
+
inrate: int,
|
|
73
|
+
outrate: int,
|
|
74
|
+
state: _RatecvState | None,
|
|
75
|
+
weightA: int = 1,
|
|
76
|
+
weightB: int = 0,
|
|
77
|
+
/,
|
|
78
|
+
) -> tuple[bytes, _RatecvState]:
|
|
79
|
+
"""Convert the frame rate of the input fragment."""
|
|
80
|
+
...
|
|
81
|
+
def reverse(fragment: Buffer, width: int, /) -> bytes:
|
|
82
|
+
"""Reverse the samples in a fragment and returns the modified fragment."""
|
|
83
|
+
...
|
|
84
|
+
def rms(fragment: Buffer, width: int, /) -> int:
|
|
85
|
+
"""Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n)."""
|
|
86
|
+
...
|
|
87
|
+
def tomono(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes:
|
|
88
|
+
"""Convert a stereo fragment to a mono fragment."""
|
|
89
|
+
...
|
|
90
|
+
def tostereo(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes:
|
|
91
|
+
"""Generate a stereo fragment from a mono fragment."""
|
|
92
|
+
...
|
|
93
|
+
def ulaw2lin(fragment: Buffer, width: int, /) -> bytes:
|
|
94
|
+
"""Convert sound fragments in u-LAW encoding to linearly encoded sound fragments."""
|
|
95
|
+
...
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
"""Conversion between binary data and ASCII"""
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from _typeshed import ReadableBuffer
|
|
5
|
-
from typing_extensions import TypeAlias
|
|
6
|
-
|
|
7
|
-
# Many functions in binascii accept buffer objects
|
|
8
|
-
# or ASCII-only strings.
|
|
9
|
-
_AsciiBuffer: TypeAlias = str | ReadableBuffer
|
|
10
|
-
|
|
11
|
-
def a2b_uu(data: _AsciiBuffer, /) -> bytes:
|
|
12
|
-
"""Decode a line of uuencoded data."""
|
|
13
|
-
...
|
|
14
|
-
def b2a_uu(data: ReadableBuffer, /, *, backtick: bool = False) -> bytes:
|
|
15
|
-
"""Uuencode line of data."""
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
if sys.version_info >= (3, 11):
|
|
19
|
-
def a2b_base64(data: _AsciiBuffer, /, *, strict_mode: bool = False) -> bytes:
|
|
20
|
-
"""
|
|
21
|
-
Decode a line of base64 data.
|
|
22
|
-
|
|
23
|
-
strict_mode
|
|
24
|
-
When set to True, bytes that are not part of the base64 standard are not allowed.
|
|
25
|
-
The same applies to excess data after padding (= / ==).
|
|
26
|
-
"""
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
else:
|
|
30
|
-
def a2b_base64(data: _AsciiBuffer, /) -> bytes:
|
|
31
|
-
"""Decode a line of base64 data."""
|
|
32
|
-
...
|
|
33
|
-
|
|
34
|
-
def b2a_base64(data: ReadableBuffer, /, *, newline: bool = True) -> bytes:
|
|
35
|
-
"""Base64-code line of data."""
|
|
36
|
-
...
|
|
37
|
-
def a2b_qp(data: _AsciiBuffer, header: bool = False) -> bytes:
|
|
38
|
-
"""Decode a string of qp-encoded data."""
|
|
39
|
-
...
|
|
40
|
-
def b2a_qp(data: ReadableBuffer, quotetabs: bool = False, istext: bool = True, header: bool = False) -> bytes:
|
|
41
|
-
r"""
|
|
42
|
-
Encode a string using quoted-printable encoding.
|
|
43
|
-
|
|
44
|
-
On encoding, when istext is set, newlines are not encoded, and white
|
|
45
|
-
space at end of lines is. When istext is not set, \r and \n (CR/LF)
|
|
46
|
-
are both encoded. When quotetabs is set, space and tabs are encoded.
|
|
47
|
-
"""
|
|
48
|
-
...
|
|
49
|
-
|
|
50
|
-
if sys.version_info < (3, 11):
|
|
51
|
-
def a2b_hqx(data: _AsciiBuffer, /) -> bytes:
|
|
52
|
-
"""Decode .hqx coding."""
|
|
53
|
-
...
|
|
54
|
-
def rledecode_hqx(data: ReadableBuffer, /) -> bytes:
|
|
55
|
-
"""Decode hexbin RLE-coded string."""
|
|
56
|
-
...
|
|
57
|
-
def rlecode_hqx(data: ReadableBuffer, /) -> bytes:
|
|
58
|
-
"""Binhex RLE-code binary data."""
|
|
59
|
-
...
|
|
60
|
-
def b2a_hqx(data: ReadableBuffer, /) -> bytes:
|
|
61
|
-
"""Encode .hqx data."""
|
|
62
|
-
...
|
|
63
|
-
|
|
64
|
-
def crc_hqx(data: ReadableBuffer, crc: int, /) -> int:
|
|
65
|
-
"""Compute CRC-CCITT incrementally."""
|
|
66
|
-
...
|
|
67
|
-
def crc32(data: ReadableBuffer, crc: int = 0, /) -> int:
|
|
68
|
-
"""Compute CRC-32 incrementally."""
|
|
69
|
-
...
|
|
70
|
-
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes:
|
|
71
|
-
r"""
|
|
72
|
-
Hexadecimal representation of binary data.
|
|
73
|
-
|
|
74
|
-
sep
|
|
75
|
-
An optional single character or byte to separate hex bytes.
|
|
76
|
-
bytes_per_sep
|
|
77
|
-
How many bytes between separators. Positive values count from the
|
|
78
|
-
right, negative values count from the left.
|
|
79
|
-
|
|
80
|
-
The return value is a bytes object. This function is also
|
|
81
|
-
available as "hexlify()".
|
|
82
|
-
|
|
83
|
-
Example:
|
|
84
|
-
>>> binascii.b2a_hex(b'\xb9\x01\xef')
|
|
85
|
-
b'b901ef'
|
|
86
|
-
>>> binascii.hexlify(b'\xb9\x01\xef', ':')
|
|
87
|
-
b'b9:01:ef'
|
|
88
|
-
>>> binascii.b2a_hex(b'\xb9\x01\xef', b'_', 2)
|
|
89
|
-
b'b9_01ef'
|
|
90
|
-
"""
|
|
91
|
-
...
|
|
92
|
-
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes:
|
|
93
|
-
"""
|
|
94
|
-
Hexadecimal representation of binary data.
|
|
95
|
-
|
|
96
|
-
sep
|
|
97
|
-
An optional single character or byte to separate hex bytes.
|
|
98
|
-
bytes_per_sep
|
|
99
|
-
How many bytes between separators. Positive values count from the
|
|
100
|
-
right, negative values count from the left.
|
|
101
|
-
|
|
102
|
-
The return value is a bytes object. This function is also
|
|
103
|
-
available as "b2a_hex()".
|
|
104
|
-
"""
|
|
105
|
-
...
|
|
106
|
-
def a2b_hex(hexstr: _AsciiBuffer, /) -> bytes:
|
|
107
|
-
"""
|
|
108
|
-
Binary data of hexadecimal representation.
|
|
109
|
-
|
|
110
|
-
hexstr must contain an even number of hex digits (upper or lower case).
|
|
111
|
-
This function is also available as "unhexlify()".
|
|
112
|
-
"""
|
|
113
|
-
...
|
|
114
|
-
def unhexlify(hexstr: _AsciiBuffer, /) -> bytes:
|
|
115
|
-
"""
|
|
116
|
-
Binary data of hexadecimal representation.
|
|
117
|
-
|
|
118
|
-
hexstr must contain an even number of hex digits (upper or lower case).
|
|
119
|
-
"""
|
|
120
|
-
...
|
|
121
|
-
|
|
122
|
-
class Error(ValueError): ...
|
|
123
|
-
class Incomplete(Exception): ...
|
|
1
|
+
"""Conversion between binary data and ASCII"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from _typeshed import ReadableBuffer
|
|
5
|
+
from typing_extensions import TypeAlias
|
|
6
|
+
|
|
7
|
+
# Many functions in binascii accept buffer objects
|
|
8
|
+
# or ASCII-only strings.
|
|
9
|
+
_AsciiBuffer: TypeAlias = str | ReadableBuffer
|
|
10
|
+
|
|
11
|
+
def a2b_uu(data: _AsciiBuffer, /) -> bytes:
|
|
12
|
+
"""Decode a line of uuencoded data."""
|
|
13
|
+
...
|
|
14
|
+
def b2a_uu(data: ReadableBuffer, /, *, backtick: bool = False) -> bytes:
|
|
15
|
+
"""Uuencode line of data."""
|
|
16
|
+
...
|
|
17
|
+
|
|
18
|
+
if sys.version_info >= (3, 11):
|
|
19
|
+
def a2b_base64(data: _AsciiBuffer, /, *, strict_mode: bool = False) -> bytes:
|
|
20
|
+
"""
|
|
21
|
+
Decode a line of base64 data.
|
|
22
|
+
|
|
23
|
+
strict_mode
|
|
24
|
+
When set to True, bytes that are not part of the base64 standard are not allowed.
|
|
25
|
+
The same applies to excess data after padding (= / ==).
|
|
26
|
+
"""
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
else:
|
|
30
|
+
def a2b_base64(data: _AsciiBuffer, /) -> bytes:
|
|
31
|
+
"""Decode a line of base64 data."""
|
|
32
|
+
...
|
|
33
|
+
|
|
34
|
+
def b2a_base64(data: ReadableBuffer, /, *, newline: bool = True) -> bytes:
|
|
35
|
+
"""Base64-code line of data."""
|
|
36
|
+
...
|
|
37
|
+
def a2b_qp(data: _AsciiBuffer, header: bool = False) -> bytes:
|
|
38
|
+
"""Decode a string of qp-encoded data."""
|
|
39
|
+
...
|
|
40
|
+
def b2a_qp(data: ReadableBuffer, quotetabs: bool = False, istext: bool = True, header: bool = False) -> bytes:
|
|
41
|
+
r"""
|
|
42
|
+
Encode a string using quoted-printable encoding.
|
|
43
|
+
|
|
44
|
+
On encoding, when istext is set, newlines are not encoded, and white
|
|
45
|
+
space at end of lines is. When istext is not set, \r and \n (CR/LF)
|
|
46
|
+
are both encoded. When quotetabs is set, space and tabs are encoded.
|
|
47
|
+
"""
|
|
48
|
+
...
|
|
49
|
+
|
|
50
|
+
if sys.version_info < (3, 11):
|
|
51
|
+
def a2b_hqx(data: _AsciiBuffer, /) -> bytes:
|
|
52
|
+
"""Decode .hqx coding."""
|
|
53
|
+
...
|
|
54
|
+
def rledecode_hqx(data: ReadableBuffer, /) -> bytes:
|
|
55
|
+
"""Decode hexbin RLE-coded string."""
|
|
56
|
+
...
|
|
57
|
+
def rlecode_hqx(data: ReadableBuffer, /) -> bytes:
|
|
58
|
+
"""Binhex RLE-code binary data."""
|
|
59
|
+
...
|
|
60
|
+
def b2a_hqx(data: ReadableBuffer, /) -> bytes:
|
|
61
|
+
"""Encode .hqx data."""
|
|
62
|
+
...
|
|
63
|
+
|
|
64
|
+
def crc_hqx(data: ReadableBuffer, crc: int, /) -> int:
|
|
65
|
+
"""Compute CRC-CCITT incrementally."""
|
|
66
|
+
...
|
|
67
|
+
def crc32(data: ReadableBuffer, crc: int = 0, /) -> int:
|
|
68
|
+
"""Compute CRC-32 incrementally."""
|
|
69
|
+
...
|
|
70
|
+
def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes:
|
|
71
|
+
r"""
|
|
72
|
+
Hexadecimal representation of binary data.
|
|
73
|
+
|
|
74
|
+
sep
|
|
75
|
+
An optional single character or byte to separate hex bytes.
|
|
76
|
+
bytes_per_sep
|
|
77
|
+
How many bytes between separators. Positive values count from the
|
|
78
|
+
right, negative values count from the left.
|
|
79
|
+
|
|
80
|
+
The return value is a bytes object. This function is also
|
|
81
|
+
available as "hexlify()".
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
>>> binascii.b2a_hex(b'\xb9\x01\xef')
|
|
85
|
+
b'b901ef'
|
|
86
|
+
>>> binascii.hexlify(b'\xb9\x01\xef', ':')
|
|
87
|
+
b'b9:01:ef'
|
|
88
|
+
>>> binascii.b2a_hex(b'\xb9\x01\xef', b'_', 2)
|
|
89
|
+
b'b9_01ef'
|
|
90
|
+
"""
|
|
91
|
+
...
|
|
92
|
+
def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = ...) -> bytes:
|
|
93
|
+
"""
|
|
94
|
+
Hexadecimal representation of binary data.
|
|
95
|
+
|
|
96
|
+
sep
|
|
97
|
+
An optional single character or byte to separate hex bytes.
|
|
98
|
+
bytes_per_sep
|
|
99
|
+
How many bytes between separators. Positive values count from the
|
|
100
|
+
right, negative values count from the left.
|
|
101
|
+
|
|
102
|
+
The return value is a bytes object. This function is also
|
|
103
|
+
available as "b2a_hex()".
|
|
104
|
+
"""
|
|
105
|
+
...
|
|
106
|
+
def a2b_hex(hexstr: _AsciiBuffer, /) -> bytes:
|
|
107
|
+
"""
|
|
108
|
+
Binary data of hexadecimal representation.
|
|
109
|
+
|
|
110
|
+
hexstr must contain an even number of hex digits (upper or lower case).
|
|
111
|
+
This function is also available as "unhexlify()".
|
|
112
|
+
"""
|
|
113
|
+
...
|
|
114
|
+
def unhexlify(hexstr: _AsciiBuffer, /) -> bytes:
|
|
115
|
+
"""
|
|
116
|
+
Binary data of hexadecimal representation.
|
|
117
|
+
|
|
118
|
+
hexstr must contain an even number of hex digits (upper or lower case).
|
|
119
|
+
"""
|
|
120
|
+
...
|
|
121
|
+
|
|
122
|
+
class Error(ValueError): ...
|
|
123
|
+
class Incomplete(Exception): ...
|