From c6a123290d0cedf4870be6cefa4627bbf9e54658 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 28 Jul 2025 22:06:33 +0000 Subject: [PATCH] [ty] Sync vendored typeshed stubs (#19607) Co-authored-by: typeshedbot <> Co-authored-by: Alex Waygood --- crates/ty_ide/src/goto_type_definition.rs | 94 ++--- ...-_Test_calling_a_funct…_(3b18271a821a59b).snap | 14 +- crates/ty_vendored/vendor/typeshed/README.md | 6 +- .../vendor/typeshed/source_commit.txt | 2 +- .../vendor/typeshed/stdlib/VERSIONS | 1 + .../vendor/typeshed/stdlib/_ctypes.pyi | 2 +- .../vendor/typeshed/stdlib/_decimal.pyi | 3 + .../typeshed/stdlib/_frozen_importlib.pyi | 10 + .../stdlib/_frozen_importlib_external.pyi | 21 +- .../vendor/typeshed/stdlib/_interpreters.pyi | 11 +- .../vendor/typeshed/stdlib/_json.pyi | 2 +- .../vendor/typeshed/stdlib/_operator.pyi | 8 +- .../vendor/typeshed/stdlib/_osx_support.pyi | 3 +- .../vendor/typeshed/stdlib/_sqlite3.pyi | 15 +- .../vendor/typeshed/stdlib/_thread.pyi | 2 +- .../vendor/typeshed/stdlib/_tkinter.pyi | 8 +- .../typeshed/stdlib/_typeshed/__init__.pyi | 6 +- .../vendor/typeshed/stdlib/abc.pyi | 3 + .../vendor/typeshed/stdlib/annotationlib.pyi | 3 + .../vendor/typeshed/stdlib/argparse.pyi | 8 +- .../vendor/typeshed/stdlib/ast.pyi | 42 +- .../typeshed/stdlib/asyncio/__init__.pyi | 7 - .../typeshed/stdlib/asyncio/base_futures.pyi | 15 +- .../vendor/typeshed/stdlib/asyncio/events.pyi | 3 - .../typeshed/stdlib/asyncio/exceptions.pyi | 3 +- .../typeshed/stdlib/asyncio/futures.pyi | 15 +- .../vendor/typeshed/stdlib/asyncio/locks.pyi | 1 + .../typeshed/stdlib/asyncio/runners.pyi | 1 + .../typeshed/stdlib/asyncio/sslproto.pyi | 6 +- .../typeshed/stdlib/asyncio/staggered.pyi | 1 + .../vendor/typeshed/stdlib/asyncio/tools.pyi | 3 +- .../typeshed/stdlib/asyncio/unix_events.pyi | 4 +- .../vendor/typeshed/stdlib/base64.pyi | 14 +- .../vendor/typeshed/stdlib/bdb.pyi | 2 + .../vendor/typeshed/stdlib/builtins.pyi | 4 +- .../vendor/typeshed/stdlib/bz2.pyi | 1 + .../vendor/typeshed/stdlib/calendar.pyi | 147 +++++-- .../vendor/typeshed/stdlib/cgi.pyi | 8 +- .../vendor/typeshed/stdlib/cmd.pyi | 9 + .../vendor/typeshed/stdlib/code.pyi | 17 + .../vendor/typeshed/stdlib/codecs.pyi | 73 +++- .../typeshed/stdlib/collections/__init__.pyi | 18 + .../vendor/typeshed/stdlib/compileall.pyi | 3 +- .../stdlib/concurrent/futures/__init__.pyi | 4 +- .../stdlib/concurrent/futures/_base.pyi | 4 +- .../stdlib/concurrent/futures/interpreter.pyi | 4 +- .../stdlib/concurrent/futures/process.pyi | 7 +- .../stdlib/concurrent/futures/thread.pyi | 4 +- .../concurrent/interpreters/__init__.pyi | 142 +++++++ .../concurrent/interpreters/_crossinterp.pyi | 44 ++ .../concurrent/interpreters/_queues.pyi | 134 ++++++ .../vendor/typeshed/stdlib/configparser.pyi | 13 +- .../vendor/typeshed/stdlib/contextlib.pyi | 6 +- .../vendor/typeshed/stdlib/copy.pyi | 3 +- .../vendor/typeshed/stdlib/crypt.pyi | 2 + .../vendor/typeshed/stdlib/csv.pyi | 8 +- .../typeshed/stdlib/ctypes/__init__.pyi | 3 +- .../typeshed/stdlib/ctypes/macholib/dyld.pyi | 7 +- .../typeshed/stdlib/ctypes/macholib/dylib.pyi | 3 +- .../stdlib/ctypes/macholib/framework.pyi | 3 +- .../vendor/typeshed/stdlib/datetime.pyi | 48 +-- .../vendor/typeshed/stdlib/dbm/dumb.pyi | 2 + .../vendor/typeshed/stdlib/decimal.pyi | 61 +++ .../vendor/typeshed/stdlib/difflib.pyi | 69 +++- .../vendor/typeshed/stdlib/dis.pyi | 1 + .../stdlib/distutils/command/register.pyi | 1 + .../typeshed/stdlib/distutils/filelist.pyi | 3 +- .../vendor/typeshed/stdlib/distutils/util.pyi | 1 + .../vendor/typeshed/stdlib/doctest.pyi | 81 ++-- .../stdlib/email/_header_value_parser.pyi | 24 ++ .../typeshed/stdlib/email/_policybase.pyi | 12 + .../typeshed/stdlib/email/feedparser.pyi | 2 + .../typeshed/stdlib/email/generator.pyi | 3 + .../typeshed/stdlib/email/headerregistry.pyi | 8 + .../vendor/typeshed/stdlib/email/message.pyi | 1 + .../vendor/typeshed/stdlib/email/parser.pyi | 1 + .../vendor/typeshed/stdlib/email/policy.pyi | 7 + .../typeshed/stdlib/email/quoprimime.pyi | 1 + .../vendor/typeshed/stdlib/email/utils.pyi | 6 +- .../typeshed/stdlib/encodings/__init__.pyi | 1 + .../typeshed/stdlib/ensurepip/__init__.pyi | 7 +- .../vendor/typeshed/stdlib/enum.pyi | 149 ++++--- .../vendor/typeshed/stdlib/filecmp.pyi | 2 + .../vendor/typeshed/stdlib/fileinput.pyi | 24 +- .../vendor/typeshed/stdlib/formatter.pyi | 5 + .../vendor/typeshed/stdlib/fractions.pyi | 11 +- .../vendor/typeshed/stdlib/functools.pyi | 2 + .../vendor/typeshed/stdlib/getopt.pyi | 2 + .../vendor/typeshed/stdlib/gettext.pyi | 3 +- .../vendor/typeshed/stdlib/graphlib.pyi | 1 + .../vendor/typeshed/stdlib/gzip.pyi | 7 +- .../vendor/typeshed/stdlib/heapq.pyi | 1 + .../vendor/typeshed/stdlib/html/__init__.pyi | 6 +- .../vendor/typeshed/stdlib/html/parser.pyi | 12 +- .../vendor/typeshed/stdlib/http/client.pyi | 8 +- .../vendor/typeshed/stdlib/http/cookiejar.pyi | 22 +- .../vendor/typeshed/stdlib/http/cookies.pyi | 3 +- .../vendor/typeshed/stdlib/http/server.pyi | 18 + .../vendor/typeshed/stdlib/imghdr.pyi | 3 +- .../vendor/typeshed/stdlib/imp.pyi | 7 + .../typeshed/stdlib/importlib/__init__.pyi | 3 + .../vendor/typeshed/stdlib/importlib/_abc.pyi | 2 + .../vendor/typeshed/stdlib/importlib/abc.pyi | 56 ++- .../stdlib/importlib/metadata/__init__.pyi | 89 ++-- .../stdlib/importlib/metadata/_meta.pyi | 16 +- .../typeshed/stdlib/importlib/readers.pyi | 12 +- .../stdlib/importlib/resources/__init__.pyi | 7 +- .../stdlib/importlib/resources/_common.pyi | 23 +- .../stdlib/importlib/resources/abc.pyi | 40 +- .../stdlib/importlib/resources/simple.pyi | 29 +- .../vendor/typeshed/stdlib/importlib/util.pyi | 4 + .../vendor/typeshed/stdlib/inspect.pyi | 21 +- .../vendor/typeshed/stdlib/ipaddress.pyi | 51 ++- .../vendor/typeshed/stdlib/json/__init__.pyi | 2 + .../vendor/typeshed/stdlib/json/decoder.pyi | 4 + .../vendor/typeshed/stdlib/json/encoder.pyi | 5 + .../stdlib/lib2to3/fixes/fix_import.pyi | 4 +- .../vendor/typeshed/stdlib/lib2to3/main.pyi | 36 +- .../typeshed/stdlib/lib2to3/pgen2/grammar.pyi | 5 +- .../typeshed/stdlib/lib2to3/pgen2/parse.pyi | 3 + .../stdlib/lib2to3/pgen2/tokenize.pyi | 6 +- .../vendor/typeshed/stdlib/lib2to3/pytree.pyi | 87 ++-- .../typeshed/stdlib/lib2to3/refactor.pyi | 13 +- .../vendor/typeshed/stdlib/locale.pyi | 5 + .../typeshed/stdlib/logging/__init__.pyi | 387 ++++++++++++------ .../vendor/typeshed/stdlib/logging/config.pyi | 30 +- .../typeshed/stdlib/logging/handlers.pyi | 190 ++++++--- .../vendor/typeshed/stdlib/lzma.pyi | 1 + .../vendor/typeshed/stdlib/mailcap.pyi | 2 + .../vendor/typeshed/stdlib/math.pyi | 6 +- .../vendor/typeshed/stdlib/mimetypes.pyi | 9 +- .../stdlib/multiprocessing/connection.pyi | 38 +- .../stdlib/multiprocessing/context.pyi | 12 +- .../typeshed/stdlib/multiprocessing/heap.pyi | 4 +- .../stdlib/multiprocessing/managers.pyi | 87 +++- .../typeshed/stdlib/multiprocessing/pool.pyi | 33 +- .../multiprocessing/popen_spawn_win32.pyi | 4 +- .../stdlib/multiprocessing/process.pyi | 57 ++- .../stdlib/multiprocessing/sharedctypes.pyi | 16 +- .../typeshed/stdlib/multiprocessing/spawn.pyi | 28 +- .../typeshed/stdlib/multiprocessing/util.pyi | 28 +- .../vendor/typeshed/stdlib/numbers.pyi | 1 + .../vendor/typeshed/stdlib/optparse.pyi | 75 ++-- .../vendor/typeshed/stdlib/os/__init__.pyi | 9 +- .../typeshed/stdlib/pathlib/__init__.pyi | 206 +++++++--- .../vendor/typeshed/stdlib/pickletools.pyi | 69 ++-- .../vendor/typeshed/stdlib/pkgutil.pyi | 3 +- .../vendor/typeshed/stdlib/platform.pyi | 22 +- .../vendor/typeshed/stdlib/pprint.pyi | 72 +++- .../vendor/typeshed/stdlib/py_compile.pyi | 2 + .../vendor/typeshed/stdlib/random.pyi | 22 + .../ty_vendored/vendor/typeshed/stdlib/re.pyi | 8 +- .../vendor/typeshed/stdlib/rlcompleter.pyi | 3 + .../vendor/typeshed/stdlib/sched.pyi | 5 + .../vendor/typeshed/stdlib/secrets.pyi | 3 + .../vendor/typeshed/stdlib/shutil.pyi | 6 + .../vendor/typeshed/stdlib/signal.pyi | 4 +- .../vendor/typeshed/stdlib/site.pyi | 1 + .../vendor/typeshed/stdlib/smtpd.pyi | 1 + .../vendor/typeshed/stdlib/smtplib.pyi | 6 + .../vendor/typeshed/stdlib/socket.pyi | 3 +- .../vendor/typeshed/stdlib/socketserver.pyi | 12 + .../typeshed/stdlib/sqlite3/__init__.pyi | 28 +- .../vendor/typeshed/stdlib/ssl.pyi | 136 +++--- .../vendor/typeshed/stdlib/statistics.pyi | 22 + .../typeshed/stdlib/string/__init__.pyi | 1 + .../typeshed/stdlib/string/templatelib.pyi | 13 +- .../vendor/typeshed/stdlib/subprocess.pyi | 3 +- .../vendor/typeshed/stdlib/sysconfig.pyi | 1 + .../vendor/typeshed/stdlib/tabnanny.pyi | 3 +- .../vendor/typeshed/stdlib/tarfile.pyi | 86 ++-- .../vendor/typeshed/stdlib/telnetlib.pyi | 15 + .../vendor/typeshed/stdlib/tempfile.pyi | 7 +- .../vendor/typeshed/stdlib/textwrap.pyi | 3 +- .../vendor/typeshed/stdlib/threading.pyi | 45 +- .../typeshed/stdlib/tkinter/__init__.pyi | 4 + .../typeshed/stdlib/tkinter/filedialog.pyi | 1 + .../vendor/typeshed/stdlib/tkinter/font.pyi | 1 + .../vendor/typeshed/stdlib/tokenize.pyi | 6 +- .../vendor/typeshed/stdlib/trace.pyi | 9 +- .../vendor/typeshed/stdlib/traceback.pyi | 7 +- .../vendor/typeshed/stdlib/tracemalloc.pyi | 46 ++- .../vendor/typeshed/stdlib/turtle.pyi | 27 +- .../vendor/typeshed/stdlib/types.pyi | 1 + .../vendor/typeshed/stdlib/typing.pyi | 1 + .../typeshed/stdlib/typing_extensions.pyi | 27 +- .../vendor/typeshed/stdlib/unittest/case.pyi | 34 +- .../typeshed/stdlib/unittest/loader.pyi | 3 +- .../vendor/typeshed/stdlib/unittest/mock.pyi | 71 +++- .../vendor/typeshed/stdlib/urllib/parse.pyi | 9 +- .../vendor/typeshed/stdlib/urllib/request.pyi | 7 +- .../typeshed/stdlib/urllib/robotparser.pyi | 3 + .../vendor/typeshed/stdlib/venv/__init__.pyi | 34 +- .../vendor/typeshed/stdlib/warnings.pyi | 3 + .../vendor/typeshed/stdlib/weakref.pyi | 7 +- .../typeshed/stdlib/wsgiref/validate.pyi | 7 +- .../vendor/typeshed/stdlib/xdrlib.pyi | 1 + .../typeshed/stdlib/xml/dom/NodeFilter.pyi | 4 +- .../typeshed/stdlib/xml/dom/minidom.pyi | 1 + .../typeshed/stdlib/xml/etree/ElementTree.pyi | 22 +- .../vendor/typeshed/stdlib/xmlrpc/server.pyi | 1 + .../typeshed/stdlib/zipfile/__init__.pyi | 28 +- .../stdlib/zipfile/_path/__init__.pyi | 32 +- .../typeshed/stdlib/zipfile/_path/glob.pyi | 43 +- 204 files changed, 3265 insertions(+), 1162 deletions(-) create mode 100644 crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/__init__.pyi create mode 100644 crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_crossinterp.pyi create mode 100644 crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_queues.pyi diff --git a/crates/ty_ide/src/goto_type_definition.rs b/crates/ty_ide/src/goto_type_definition.rs index b89bc6c212..1ec3e85db3 100644 --- a/crates/ty_ide/src/goto_type_definition.rs +++ b/crates/ty_ide/src/goto_type_definition.rs @@ -199,14 +199,14 @@ mod tests { assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:890:7 + --> stdlib/builtins.pyi:892:7 | - 888 | def __getitem__(self, key: int, /) -> str | int | None: ... - 889 | - 890 | class str(Sequence[str]): + 890 | def __getitem__(self, key: int, /) -> str | int | None: ... + 891 | + 892 | class str(Sequence[str]): | ^^^ - 891 | """str(object='') -> str - 892 | str(bytes_or_buffer[, encoding[, errors]]) -> str + 893 | """str(object='') -> str + 894 | str(bytes_or_buffer[, encoding[, errors]]) -> str | info: Source --> main.py:4:13 @@ -228,14 +228,14 @@ mod tests { assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:890:7 + --> stdlib/builtins.pyi:892:7 | - 888 | def __getitem__(self, key: int, /) -> str | int | None: ... - 889 | - 890 | class str(Sequence[str]): + 890 | def __getitem__(self, key: int, /) -> str | int | None: ... + 891 | + 892 | class str(Sequence[str]): | ^^^ - 891 | """str(object='') -> str - 892 | str(bytes_or_buffer[, encoding[, errors]]) -> str + 893 | """str(object='') -> str + 894 | str(bytes_or_buffer[, encoding[, errors]]) -> str | info: Source --> main.py:2:22 @@ -344,14 +344,14 @@ mod tests { assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:890:7 + --> stdlib/builtins.pyi:892:7 | - 888 | def __getitem__(self, key: int, /) -> str | int | None: ... - 889 | - 890 | class str(Sequence[str]): + 890 | def __getitem__(self, key: int, /) -> str | int | None: ... + 891 | + 892 | class str(Sequence[str]): | ^^^ - 891 | """str(object='') -> str - 892 | str(bytes_or_buffer[, encoding[, errors]]) -> str + 893 | """str(object='') -> str + 894 | str(bytes_or_buffer[, encoding[, errors]]) -> str | info: Source --> main.py:4:18 @@ -413,14 +413,14 @@ f(**kwargs) assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:2888:7 + --> stdlib/builtins.pyi:2890:7 | - 2886 | """See PEP 585""" - 2887 | - 2888 | class dict(MutableMapping[_KT, _VT]): + 2888 | """See PEP 585""" + 2889 | + 2890 | class dict(MutableMapping[_KT, _VT]): | ^^^^ - 2889 | """dict() -> new empty dictionary - 2890 | dict(mapping) -> new dictionary initialized from a mapping object's + 2891 | """dict() -> new empty dictionary + 2892 | dict(mapping) -> new dictionary initialized from a mapping object's | info: Source --> main.py:6:5 @@ -444,14 +444,14 @@ f(**kwargs) assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:890:7 + --> stdlib/builtins.pyi:892:7 | - 888 | def __getitem__(self, key: int, /) -> str | int | None: ... - 889 | - 890 | class str(Sequence[str]): + 890 | def __getitem__(self, key: int, /) -> str | int | None: ... + 891 | + 892 | class str(Sequence[str]): | ^^^ - 891 | """str(object='') -> str - 892 | str(bytes_or_buffer[, encoding[, errors]]) -> str + 893 | """str(object='') -> str + 894 | str(bytes_or_buffer[, encoding[, errors]]) -> str | info: Source --> main.py:3:17 @@ -537,14 +537,14 @@ f(**kwargs) assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:890:7 + --> stdlib/builtins.pyi:892:7 | - 888 | def __getitem__(self, key: int, /) -> str | int | None: ... - 889 | - 890 | class str(Sequence[str]): + 890 | def __getitem__(self, key: int, /) -> str | int | None: ... + 891 | + 892 | class str(Sequence[str]): | ^^^ - 891 | """str(object='') -> str - 892 | str(bytes_or_buffer[, encoding[, errors]]) -> str + 893 | """str(object='') -> str + 894 | str(bytes_or_buffer[, encoding[, errors]]) -> str | info: Source --> main.py:4:27 @@ -568,13 +568,13 @@ f(**kwargs) assert_snapshot!(test.goto_type_definition(), @r#" info[goto-type-definition]: Type definition - --> stdlib/types.pyi:921:11 + --> stdlib/types.pyi:922:11 | - 919 | if sys.version_info >= (3, 10): - 920 | @final - 921 | class NoneType: + 920 | if sys.version_info >= (3, 10): + 921 | @final + 922 | class NoneType: | ^^^^^^^^ - 922 | """The type of the None singleton.""" + 923 | """The type of the None singleton.""" | info: Source --> main.py:3:17 @@ -585,14 +585,14 @@ f(**kwargs) | info[goto-type-definition]: Type definition - --> stdlib/builtins.pyi:890:7 + --> stdlib/builtins.pyi:892:7 | - 888 | def __getitem__(self, key: int, /) -> str | int | None: ... - 889 | - 890 | class str(Sequence[str]): + 890 | def __getitem__(self, key: int, /) -> str | int | None: ... + 891 | + 892 | class str(Sequence[str]): | ^^^ - 891 | """str(object='') -> str - 892 | str(bytes_or_buffer[, encoding[, errors]]) -> str + 893 | """str(object='') -> str + 894 | str(bytes_or_buffer[, encoding[, errors]]) -> str | info: Source --> main.py:3:17 diff --git a/crates/ty_python_semantic/resources/mdtest/snapshots/invalid_argument_typ…_-_Invalid_argument_typ…_-_Test_calling_a_funct…_(3b18271a821a59b).snap b/crates/ty_python_semantic/resources/mdtest/snapshots/invalid_argument_typ…_-_Invalid_argument_typ…_-_Test_calling_a_funct…_(3b18271a821a59b).snap index 8a842083da..60a757a4f0 100644 --- a/crates/ty_python_semantic/resources/mdtest/snapshots/invalid_argument_typ…_-_Invalid_argument_typ…_-_Test_calling_a_funct…_(3b18271a821a59b).snap +++ b/crates/ty_python_semantic/resources/mdtest/snapshots/invalid_argument_typ…_-_Invalid_argument_typ…_-_Test_calling_a_funct…_(3b18271a821a59b).snap @@ -29,16 +29,16 @@ error[invalid-argument-type]: Argument to function `loads` is incorrect | ^ Expected `str | bytes | bytearray`, found `Literal[5]` | info: Function defined here - --> stdlib/json/__init__.pyi:218:5 + --> stdlib/json/__init__.pyi:220:5 | -216 | """ -217 | -218 | def loads( +218 | """ +219 | +220 | def loads( | ^^^^^ -219 | s: str | bytes | bytearray, +221 | s: str | bytes | bytearray, | -------------------------- Parameter declared here -220 | *, -221 | cls: type[JSONDecoder] | None = None, +222 | *, +223 | cls: type[JSONDecoder] | None = None, | info: rule `invalid-argument-type` is enabled by default diff --git a/crates/ty_vendored/vendor/typeshed/README.md b/crates/ty_vendored/vendor/typeshed/README.md index ee09529b96..1467aa20b4 100644 --- a/crates/ty_vendored/vendor/typeshed/README.md +++ b/crates/ty_vendored/vendor/typeshed/README.md @@ -25,9 +25,9 @@ Typeshed supports Python versions 3.9 to 3.14. ## Using -If you're just using a type checker ([mypy](https://github.com/python/mypy/), -[pyright](https://github.com/microsoft/pyright), -[pytype](https://github.com/google/pytype/), PyCharm, ...), as opposed to +If you're just using a type checker (e.g. [mypy](https://github.com/python/mypy/), +[pyright](https://github.com/microsoft/pyright), or PyCharm's built-in type +checker), as opposed to developing it, you don't need to interact with the typeshed repo at all: a copy of standard library part of typeshed is bundled with type checkers. And type stubs for third party packages and modules you are using can diff --git a/crates/ty_vendored/vendor/typeshed/source_commit.txt b/crates/ty_vendored/vendor/typeshed/source_commit.txt index d072ae5a8c..e15e805018 100644 --- a/crates/ty_vendored/vendor/typeshed/source_commit.txt +++ b/crates/ty_vendored/vendor/typeshed/source_commit.txt @@ -1 +1 @@ -08225953c98cfd375d80bc88865e5aae77d2c07f +9ab7fde0a0cd24ed7a72837fcb21093b811b80d8 diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/VERSIONS b/crates/ty_vendored/vendor/typeshed/stdlib/VERSIONS index 8baf207ad7..6fcf016179 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/VERSIONS +++ b/crates/ty_vendored/vendor/typeshed/stdlib/VERSIONS @@ -124,6 +124,7 @@ compileall: 3.0- compression: 3.14- concurrent: 3.2- concurrent.futures.interpreter: 3.14- +concurrent.interpreters: 3.14- configparser: 3.0- contextlib: 3.0- contextvars: 3.7- diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi index b4414f2857..cce031feed 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi @@ -142,7 +142,7 @@ class _PyCPointerType(_CTypeBaseType): def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ... def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ... def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ... - def set_type(self, type: Any, /) -> None: ... + def set_type(self, type: _CTypeBaseType, /) -> None: ... if sys.version_info < (3, 13): # Inherited from CType_Type starting on 3.13 def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_decimal.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_decimal.pyi index 0e2f9003ee..549d808659 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_decimal.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_decimal.pyi @@ -69,6 +69,7 @@ if sys.version_info >= (3, 11): on entry to the with-statement and restore the previous default context when exiting the with-statement. If no context is specified, a copy of the current default context is used. + """ else: @@ -77,6 +78,7 @@ else: on entry to the with-statement and restore the previous default context when exiting the with-statement. If no context is specified, a copy of the current default context is used. + """ if sys.version_info >= (3, 14): @@ -84,6 +86,7 @@ if sys.version_info >= (3, 14): """Return a context object initialized to the proper values for one of the IEEE interchange formats. The argument must be a multiple of 32 and less than IEEE_CONTEXT_MAX_BITS. + """ DefaultContext: Context diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib.pyi index 1aacc9710d..a6f58ca3f8 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib.pyi @@ -32,6 +32,7 @@ def __import__( being imported (e.g. ``from module import ``). The 'level' argument represents the package location to import from in a relative import (e.g. ``from ..pkg import mod`` would have a 'level' of 2). + """ def spec_from_loader( @@ -80,6 +81,7 @@ class ModuleSpec: Only finders (see importlib.abc.MetaPathFinder and importlib.abc.PathEntryFinder) should modify ModuleSpec instances. + """ def __init__( @@ -109,6 +111,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader) All methods are either class or static methods to avoid the need to instantiate the class. + """ # MetaPathFinder @@ -120,6 +123,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader) If 'path' is ever specified then the search is considered a failure. This method is deprecated. Use find_spec() instead. + """ @classmethod @@ -136,6 +140,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader) """Load the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module() instead. + """ @classmethod @@ -152,6 +157,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader) """Return repr for the module. The method is deprecated. The import machinery does the job itself. + """ if sys.version_info >= (3, 10): @staticmethod @@ -175,6 +181,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): All methods are either class or static methods to avoid the need to instantiate the class. + """ # MetaPathFinder @@ -184,6 +191,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): """Find a frozen module. This method is deprecated. Use find_spec() instead. + """ @classmethod @@ -200,6 +208,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): """Load a frozen module. This method is deprecated. Use exec_module() instead. + """ @classmethod @@ -216,6 +225,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): """Return repr for the module. The method is deprecated. The import machinery does the job itself. + """ if sys.version_info >= (3, 10): @staticmethod diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi index 76a5fa41c7..7db0d7a7b0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi @@ -51,6 +51,7 @@ def cache_from_source(path: StrPath, debug_override: bool | None = None, *, opti while a False value is equivalent to setting 'optimization' to '1'. If sys.implementation.cache_tag is None then NotImplementedError is raised. + """ def source_from_cache(path: StrPath) -> str: @@ -60,6 +61,7 @@ def source_from_cache(path: StrPath) -> str: the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. + """ def decode_source(source_bytes: ReadableBuffer) -> str: @@ -83,6 +85,7 @@ def spec_from_file_location( import system. The loader must take a spec as its only __init__() arg. + """ @deprecated( @@ -98,6 +101,7 @@ class WindowsRegistryFinder(importlib.abc.MetaPathFinder): """Find module named in the registry. This method is deprecated. Use find_spec() instead. + """ @classmethod @@ -123,7 +127,8 @@ class PathFinder(importlib.abc.MetaPathFinder): if sys.version_info >= (3, 10): @staticmethod def find_distributions(context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: - """Find distributions. + """ + Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` @@ -133,7 +138,8 @@ class PathFinder(importlib.abc.MetaPathFinder): else: @classmethod def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: - """Find distributions. + """ + Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` @@ -156,6 +162,7 @@ class PathFinder(importlib.abc.MetaPathFinder): sys.path_importer_cache. This method is deprecated. Use find_spec() instead. + """ SOURCE_SUFFIXES: list[str] @@ -169,6 +176,7 @@ class FileFinder(importlib.abc.PathEntryFinder): Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. + """ path: str @@ -188,6 +196,7 @@ class FileFinder(importlib.abc.PathEntryFinder): If the path called on the closure is not a directory, ImportError is raised. + """ class _LoaderBasics: @@ -252,6 +261,7 @@ class SourceLoader(_LoaderBasics): Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. + """ class FileLoader: @@ -276,6 +286,7 @@ class FileLoader: """Load a module from a file. This method is deprecated. Use exec_module() instead. + """ if sys.version_info >= (3, 10): def get_resource_reader(self, name: str | None = None) -> importlib.readers.FileReader: ... @@ -318,6 +329,7 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics, importlib.abc.ExecutionLoad """Loader for extension modules. The constructor is designed to work with FileFinder. + """ def __init__(self, name: str, path: str) -> None: ... @@ -356,6 +368,7 @@ if sys.version_info >= (3, 11): """Load a namespace module. This method is deprecated. Use exec_module() instead. + """ def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ... @@ -366,6 +379,7 @@ if sys.version_info >= (3, 11): """Return repr for the module. The method is deprecated. The import machinery does the job itself. + """ _NamespaceLoader = NamespaceLoader @@ -386,6 +400,7 @@ else: """Load a namespace module. This method is deprecated. Use exec_module() instead. + """ if sys.version_info >= (3, 10): @staticmethod @@ -394,6 +409,7 @@ else: """Return repr for the module. The method is deprecated. The import machinery does the job itself. + """ def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ... @@ -404,6 +420,7 @@ else: """Return repr for the module. The method is deprecated. The import machinery does the job itself. + """ if sys.version_info >= (3, 13): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_interpreters.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_interpreters.pyi index 8c62b7c306..6ddd89b7ac 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_interpreters.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_interpreters.pyi @@ -4,9 +4,11 @@ The 'interpreters' module provides a more convenient interface. import types from collections.abc import Callable -from typing import Any, Final, Literal, SupportsIndex +from typing import Any, Final, Literal, SupportsIndex, TypeVar from typing_extensions import TypeAlias +_R = TypeVar("_R") + _Configs: TypeAlias = Literal["default", "isolated", "legacy", "empty", ""] _SharedDict: TypeAlias = dict[str, Any] # many objects can be shared @@ -88,7 +90,7 @@ def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleName Return a representation of the config used to initialize the interpreter. """ -def whence(id: SupportsIndex) -> int: +def whence(id: SupportsIndex) -> _Whence: """whence(id) -> int Return an identifier for where the interpreter was created. @@ -120,12 +122,12 @@ def exec( def call( id: SupportsIndex, - callable: Callable[..., object], + callable: Callable[..., _R], args: tuple[object, ...] | None = None, kwargs: dict[str, object] | None = None, *, restrict: bool = False, -) -> object: +) -> tuple[_R, types.SimpleNamespace]: """call(id, callable, args=None, kwargs=None, *, restrict=False) Call the provided object in the identified interpreter. @@ -182,6 +184,7 @@ def capture_exception(exc: BaseException | None = None) -> types.SimpleNamespace The returned snapshot is the same as what _interpreters.exec() returns. """ +_Whence: TypeAlias = Literal[0, 1, 2, 3, 4, 5] WHENCE_UNKNOWN: Final = 0 WHENCE_RUNTIME: Final = 1 WHENCE_LEGACY_CAPI: Final = 2 diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_json.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_json.pyi index 9237f7b835..c0ee227557 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_json.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_json.pyi @@ -82,7 +82,7 @@ def encode_basestring_ascii(s: str, /) -> str: Return an ASCII-only JSON representation of a Python string """ -def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]: +def scanstring(string: str, end: int, strict: bool = True) -> tuple[str, int]: """scanstring(string, end, strict=True) -> (string, end) Scan the string s for a JSON string. End is the index of the diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_operator.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_operator.pyi index 4efed1d796..ca4bbcf6d3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_operator.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_operator.pyi @@ -11,7 +11,7 @@ import sys from _typeshed import SupportsGetItem from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller -from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload +from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only from typing_extensions import ParamSpec, TypeAlias, TypeIs _R = TypeVar("_R") @@ -25,12 +25,15 @@ _P = ParamSpec("_P") # operators can be overloaded to return an arbitrary object. For example, # the numpy.array comparison dunders return another numpy.array. +@type_check_only class _SupportsDunderLT(Protocol): def __lt__(self, other: Any, /) -> Any: ... +@type_check_only class _SupportsDunderGT(Protocol): def __gt__(self, other: Any, /) -> Any: ... +@type_check_only class _SupportsDunderLE(Protocol): def __le__(self, other: Any, /) -> Any: ... @@ -39,12 +42,15 @@ class _SupportsDunderGE(Protocol): _SupportsComparison: TypeAlias = _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT +@type_check_only class _SupportsInversion(Protocol[_T_co]): def __invert__(self) -> _T_co: ... +@type_check_only class _SupportsNeg(Protocol[_T_co]): def __neg__(self) -> _T_co: ... +@type_check_only class _SupportsPos(Protocol[_T_co]): def __pos__(self) -> _T_co: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_osx_support.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_osx_support.pyi index 4d51676931..e026e5e01e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_osx_support.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_osx_support.pyi @@ -56,7 +56,8 @@ def _check_for_unavailable_sdk(_config_vars: dict[str, str]) -> dict[str, str]: """Remove references to any SDKs not available""" def compiler_fixup(compiler_so: Iterable[str], cc_args: Sequence[str]) -> list[str]: - """This function will strip '-isysroot PATH' and '-arch ARCH' from the + """ + This function will strip '-isysroot PATH' and '-arch ARCH' from the compile flags if the user has specified one them in extra_compile_flags. This is needed because '-arch ARCH' adds another architecture to the diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_sqlite3.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_sqlite3.pyi index 541fa9e751..1018c396b6 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_sqlite3.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_sqlite3.pyi @@ -16,8 +16,9 @@ from sqlite3 import ( ProgrammingError as ProgrammingError, Row as Row, Warning as Warning, + _IsolationLevel, ) -from typing import Any, Final, Literal, TypeVar, overload +from typing import Any, Final, TypeVar, overload from typing_extensions import TypeAlias if sys.version_info >= (3, 11): @@ -228,7 +229,7 @@ if sys.version_info >= (3, 12): database: StrOrBytesPath, timeout: float = 5.0, detect_types: int = 0, - isolation_level: Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None = "DEFERRED", + isolation_level: _IsolationLevel = "DEFERRED", check_same_thread: bool = True, cached_statements: int = 128, uri: bool = False, @@ -251,7 +252,7 @@ if sys.version_info >= (3, 12): database: StrOrBytesPath, timeout: float, detect_types: int, - isolation_level: Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None, + isolation_level: _IsolationLevel, check_same_thread: bool, factory: type[_ConnectionT], cached_statements: int = 128, @@ -264,7 +265,7 @@ if sys.version_info >= (3, 12): database: StrOrBytesPath, timeout: float = 5.0, detect_types: int = 0, - isolation_level: Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None = "DEFERRED", + isolation_level: _IsolationLevel = "DEFERRED", check_same_thread: bool = True, *, factory: type[_ConnectionT], @@ -279,7 +280,7 @@ else: database: StrOrBytesPath, timeout: float = 5.0, detect_types: int = 0, - isolation_level: Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None = "DEFERRED", + isolation_level: _IsolationLevel = "DEFERRED", check_same_thread: bool = True, cached_statements: int = 128, uri: bool = False, @@ -295,7 +296,7 @@ else: database: StrOrBytesPath, timeout: float, detect_types: int, - isolation_level: Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None, + isolation_level: _IsolationLevel, check_same_thread: bool, factory: type[_ConnectionT], cached_statements: int = 128, @@ -306,7 +307,7 @@ else: database: StrOrBytesPath, timeout: float = 5.0, detect_types: int = 0, - isolation_level: Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None = "DEFERRED", + isolation_level: _IsolationLevel = "DEFERRED", check_same_thread: bool = True, *, factory: type[_ConnectionT], diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_thread.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_thread.pyi index 9a09ebd893..9fafbaaf2e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_thread.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_thread.pyi @@ -253,7 +253,7 @@ def start_new(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts] def start_new(function: Callable[..., object], args: tuple[Any, ...], kwargs: dict[str, Any], /) -> int: ... if sys.version_info >= (3, 10): - def interrupt_main(signum: signal.Signals = ..., /) -> None: + def interrupt_main(signum: signal.Signals = signal.SIGINT, /) -> None: """Simulate the arrival of the given signal in the main thread, where the corresponding signal handler will be executed. If *signum* is omitted, SIGINT is assumed. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_tkinter.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_tkinter.pyi index 001054fd8b..2663e7552c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_tkinter.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_tkinter.pyi @@ -131,7 +131,9 @@ if sys.version_info >= (3, 13): use: str | None = None, /, ): - """wantTk + """ + + wantTk if false, then Tk_Init() doesn't get called sync if true, then pass -sync to wish @@ -151,7 +153,9 @@ else: use: str | None = None, /, ): - """wantTk + """ + + wantTk if false, then Tk_Init() doesn't get called sync if true, then pass -sync to wish diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/_typeshed/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/_typeshed/__init__.pyi index b5a4941e69..98a369dfc5 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/_typeshed/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/_typeshed/__init__.pyi @@ -65,10 +65,10 @@ MaybeNone: TypeAlias = Any # stable # In cases where the sentinel object is exported and can be used by user code, # a construct like this is better: # -# _SentinelType = NewType("_SentinelType", object) -# sentinel: _SentinelType +# _SentinelType = NewType("_SentinelType", object) # does not exist at runtime +# sentinel: Final[_SentinelType] # def foo(x: int | None | _SentinelType = ...) -> None: ... -sentinel: Any +sentinel: Any # stable # stable class IdentityFunction(Protocol): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/abc.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/abc.pyi index 4aca20d29e..3a03460bb0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/abc.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/abc.pyi @@ -81,6 +81,7 @@ class abstractclassmethod(classmethod[_T, _P, _R_co]): @abstractmethod def my_abstract_classmethod(cls, ...): ... + """ __isabstractmethod__: Literal[True] @@ -97,6 +98,7 @@ class abstractstaticmethod(staticmethod[_P, _R_co]): @abstractmethod def my_abstract_staticmethod(...): ... + """ __isabstractmethod__: Literal[True] @@ -113,6 +115,7 @@ class abstractproperty(property): @abstractmethod def my_abstract_property(self): ... + """ __isabstractmethod__: Literal[True] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/annotationlib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/annotationlib.pyi index 29ca093d45..31ab9be8af 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/annotationlib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/annotationlib.pyi @@ -39,6 +39,7 @@ if sys.version_info >= (3, 14): * owner: The owning object (module, class, or function). * is_argument: Does nothing, retained for compatibility. * is_class: True if the forward reference was created in class scope. + """ __forward_is_argument__: bool @@ -132,6 +133,7 @@ if sys.version_info >= (3, 14): class, or function that the __annotate__ function derives from). With the FORWARDREF format, it is used to provide better evaluation capabilities on the generated ForwardRef objects. + """ @overload @@ -231,6 +233,7 @@ if sys.version_info >= (3, 14): This is intended as a helper for tools that support the STRING format but do not have access to the code that originally produced the annotations. It uses repr() for most objects. + """ def annotations_to_string(annotations: SupportsItems[str, object]) -> dict[str, str]: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/argparse.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/argparse.pyi index 22f055eceb..6d73c8ffcd 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/argparse.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/argparse.pyi @@ -65,7 +65,7 @@ import sys from _typeshed import SupportsWrite, sentinel from collections.abc import Callable, Generator, Iterable, Sequence from re import Pattern -from typing import IO, Any, ClassVar, Final, Generic, NoReturn, Protocol, TypeVar, overload +from typing import IO, Any, ClassVar, Final, Generic, NoReturn, Protocol, TypeVar, overload, type_check_only from typing_extensions import Self, TypeAlias, deprecated __all__ = [ @@ -168,7 +168,8 @@ class _ActionsContainer: version: str = ..., **kwargs: Any, ) -> Action: - """add_argument(dest, ..., name=value, ...) + """ + add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...) """ @@ -193,6 +194,7 @@ class _ActionsContainer: def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> NoReturn: ... def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> None: ... +@type_check_only class _FormatterClass(Protocol): def __call__(self, *, prog: str) -> HelpFormatter: ... @@ -401,7 +403,7 @@ class HelpFormatter: if sys.version_info >= (3, 14): def __init__( - self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, color: bool = False + self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, color: bool = True ) -> None: ... else: def __init__( diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ast.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ast.pyi index 87290148b1..262ea22b9d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ast.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ast.pyi @@ -2170,7 +2170,8 @@ if sys.version_info >= (3, 13): feature_version: None | int | tuple[int, int] = None, optimize: Literal[-1, 0, 1, 2] = -1, ) -> Module: - """Parse the source into an AST node. + """ + Parse the source into an AST node. Equivalent to compile(source, filename, mode, PyCF_ONLY_AST). Pass type_comments=True to get back type comments where the syntax allows. """ @@ -2253,7 +2254,8 @@ else: type_comments: bool = False, feature_version: None | int | tuple[int, int] = None, ) -> Module: - """Parse the source into an AST node. + """ + Parse the source into an AST node. Equivalent to compile(source, filename, mode, PyCF_ONLY_AST). Pass type_comments=True to get back type comments where the syntax allows. """ @@ -2320,7 +2322,8 @@ else: ) -> mod: ... def literal_eval(node_or_string: str | AST) -> Any: - """Evaluate an expression node or a string containing only a Python + """ + Evaluate an expression node or a string containing only a Python expression. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None. @@ -2337,7 +2340,8 @@ if sys.version_info >= (3, 13): indent: int | str | None = None, show_empty: bool = False, ) -> str: - """Return a formatted dump of the tree in node. This is mainly useful for + """ + Return a formatted dump of the tree in node. This is mainly useful for debugging purposes. If annotate_fields is true (by default), the returned string will show the names and the values for fields. If annotate_fields is false, the result string will be more compact by @@ -2354,7 +2358,8 @@ else: def dump( node: AST, annotate_fields: bool = True, include_attributes: bool = False, *, indent: int | str | None = None ) -> str: - """Return a formatted dump of the tree in node. This is mainly useful for + """ + Return a formatted dump of the tree in node. This is mainly useful for debugging purposes. If annotate_fields is true (by default), the returned string will show the names and the values for fields. If annotate_fields is false, the result string will be more compact by @@ -2366,12 +2371,14 @@ else: """ def copy_location(new_node: _T, old_node: AST) -> _T: - """Copy source location (`lineno`, `col_offset`, `end_lineno`, and `end_col_offset` + """ + Copy source location (`lineno`, `col_offset`, `end_lineno`, and `end_col_offset` attributes) from *old_node* to *new_node* if possible, and return *new_node*. """ def fix_missing_locations(node: _T) -> _T: - """When you compile a node tree with compile(), the compiler expects lineno and + """ + When you compile a node tree with compile(), the compiler expects lineno and col_offset attributes for every node that supports them. This is rather tedious to fill in for generated nodes, so this helper adds these attributes recursively where not already set, by setting them to the values of the @@ -2379,23 +2386,27 @@ def fix_missing_locations(node: _T) -> _T: """ def increment_lineno(node: _T, n: int = 1) -> _T: - """Increment the line number and end line number of each node in the tree + """ + Increment the line number and end line number of each node in the tree starting at *node* by *n*. This is useful to "move code" to a different location in a file. """ def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: - """Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` + """ + Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` that is present on *node*. """ def iter_child_nodes(node: AST) -> Iterator[AST]: - """Yield all direct child nodes of *node*, that is, all fields that are nodes + """ + Yield all direct child nodes of *node*, that is, all fields that are nodes and all items of fields that are lists of nodes. """ def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = True) -> str | None: - """Return the docstring for the given node or None if no docstring can + """ + Return the docstring for the given node or None if no docstring can be found. If the node provided does not have docstrings a TypeError will be raised. @@ -2414,7 +2425,8 @@ def get_source_segment(source: str, node: AST, *, padded: bool = False) -> str | """ def walk(node: AST) -> Iterator[AST]: - """Recursively yield all descendant nodes in the tree starting at *node* + """ + Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context. """ @@ -2431,7 +2443,8 @@ if sys.version_info >= (3, 14): """ class NodeVisitor: - """A node visitor base class that walks the abstract syntax tree and calls a + """ + A node visitor base class that walks the abstract syntax tree and calls a visitor function for every node found. This function may return a value which is forwarded by the `visit` method. @@ -2595,7 +2608,8 @@ class NodeVisitor: def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated] class NodeTransformer(NodeVisitor): - """A :class:`NodeVisitor` subclass that walks the abstract syntax tree and + """ + A :class:`NodeVisitor` subclass that walks the abstract syntax tree and allows modification of nodes. The `NodeTransformer` will walk the AST and use the return value of the diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/__init__.pyi index 44f3abbaa1..a8732a22de 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/__init__.pyi @@ -43,14 +43,11 @@ if sys.platform == "win32": "Server", # from base_events "iscoroutinefunction", # from coroutines "iscoroutine", # from coroutines - "_AbstractEventLoopPolicy", # from events "AbstractEventLoop", # from events "AbstractServer", # from events "Handle", # from events "TimerHandle", # from events - "_get_event_loop_policy", # from events "get_event_loop_policy", # from events - "_set_event_loop_policy", # from events "set_event_loop_policy", # from events "get_event_loop", # from events "set_event_loop", # from events @@ -519,14 +516,11 @@ else: "Server", # from base_events "iscoroutinefunction", # from coroutines "iscoroutine", # from coroutines - "_AbstractEventLoopPolicy", # from events "AbstractEventLoop", # from events "AbstractServer", # from events "Handle", # from events "TimerHandle", # from events - "_get_event_loop_policy", # from events "get_event_loop_policy", # from events - "_set_event_loop_policy", # from events "set_event_loop_policy", # from events "get_event_loop", # from events "set_event_loop", # from events @@ -612,7 +606,6 @@ else: "DatagramTransport", # from transports "SubprocessTransport", # from transports "SelectorEventLoop", # from unix_events - "_DefaultEventLoopPolicy", # from unix_events "EventLoop", # from unix_events ) elif sys.version_info >= (3, 13): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/base_futures.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/base_futures.pyi index aef35ab1d6..8b1ed8ae12 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/base_futures.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/base_futures.pyi @@ -1,20 +1,25 @@ +from _asyncio import Future from collections.abc import Callable, Sequence from contextvars import Context from typing import Any, Final +from typing_extensions import TypeIs from . import futures __all__ = () -# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py -# but it leads to circular import error in pytype tool. -# That's why the import order is reversed. -from .futures import isfuture as isfuture - _PENDING: Final = "PENDING" # undocumented _CANCELLED: Final = "CANCELLED" # undocumented _FINISHED: Final = "FINISHED" # undocumented +def isfuture(obj: object) -> TypeIs[Future[Any]]: + """Check for a Future. + + This returns True when obj is a Future instance or is advertising + itself as duck-type compatible by setting _asyncio_future_blocking. + See comment in Future for more details. + """ + def _format_callbacks(cb: Sequence[tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: # undocumented """helper function for Future.__repr__""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/events.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/events.pyi index 39fab3eef5..789923832d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/events.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/events.pyi @@ -30,14 +30,11 @@ if sys.version_info < (3, 14): # Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 14): __all__ = ( - "_AbstractEventLoopPolicy", "AbstractEventLoop", "AbstractServer", "Handle", "TimerHandle", - "_get_event_loop_policy", "get_event_loop_policy", - "_set_event_loop_policy", "set_event_loop_policy", "get_event_loop", "set_event_loop", diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/exceptions.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/exceptions.pyi index 0de074fb1e..bf1330f7b1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/exceptions.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/exceptions.pyi @@ -43,7 +43,8 @@ class SendfileNotAvailableError(RuntimeError): """ class IncompleteReadError(EOFError): - """Incomplete read error. Attributes: + """ + Incomplete read error. Attributes: - partial: read bytes string before the end of stream was reached - expected: total number of expected bytes (or None if unknown) diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/futures.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/futures.pyi index b651a19a84..8acaaea444 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/futures.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/futures.pyi @@ -3,9 +3,9 @@ import sys from _asyncio import Future as Future from concurrent.futures._base import Future as _ConcurrentFuture -from typing import Any, TypeVar -from typing_extensions import TypeIs +from typing import TypeVar +from .base_futures import isfuture as isfuture from .events import AbstractEventLoop # Keep asyncio.__all__ updated with any changes to __all__ here @@ -18,16 +18,5 @@ else: _T = TypeVar("_T") -# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py -# but it leads to circular import error in pytype tool. -# That's why the import order is reversed. -def isfuture(obj: object) -> TypeIs[Future[Any]]: - """Check for a Future. - - This returns True when obj is a Future instance or is advertising - itself as duck-type compatible by setting _asyncio_future_blocking. - See comment in Future for more details. - """ - def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: """Wrap concurrent.futures.Future object.""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/locks.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/locks.pyi index 510cf840a1..d38607b410 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/locks.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/locks.pyi @@ -80,6 +80,7 @@ class Lock(_ContextManagerMixin, _LoopBoundMixin): else: # lock is acquired ... + """ _waiters: deque[Future[Any]] | None diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/runners.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/runners.pyi index f9e3956398..1b7a4d4894 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/runners.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/runners.pyi @@ -39,6 +39,7 @@ if sys.version_info >= (3, 11): unittest runners, console tools, -- everywhere when async code is called from existing sync framework and where the preferred single asyncio.run() call doesn't work. + """ def __init__(self, *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None) -> None: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/sslproto.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/sslproto.pyi index d76501c100..1a73b0cec2 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/sslproto.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/sslproto.pyi @@ -66,7 +66,8 @@ if sys.version_info < (3, 11): _handshake_cb: Callable[[BaseException | None], None] | None _shutdown_cb: Callable[[], None] | None def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = None) -> None: - """The *context* argument specifies the ssl.SSLContext to use. + """ + The *context* argument specifies the ssl.SSLContext to use. The *server_side* argument indicates whether this is a server side or client side transport. @@ -95,7 +96,8 @@ if sys.version_info < (3, 11): @property def wrapped(self) -> bool: - """Whether a security layer is currently in effect. + """ + Whether a security layer is currently in effect. Return False during handshake. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/staggered.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/staggered.pyi index b8d452e9c6..938020b3a0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/staggered.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/staggered.pyi @@ -58,4 +58,5 @@ async def staggered_race( ``len(exceptions)`` is equal to the number of coroutines actually started, and the order is the same as in ``coro_fns``. The winning coroutine's entry is ``None``. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/tools.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/tools.pyi index e2587fae4e..6fd9a3c430 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/tools.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/tools.pyi @@ -40,7 +40,8 @@ class CycleFoundException(Exception): def get_all_awaited_by(pid: SupportsIndex) -> list[_AwaitedInfo]: ... def build_async_tree(result: Iterable[_AwaitedInfo], task_emoji: str = "(T)", cor_emoji: str = "") -> list[list[str]]: - """Build a list of strings for pretty-print an async call tree. + """ + Build a list of strings for pretty-print an async call tree. The call tree is produced by `get_all_async_stacks()`, prefixing tasks with `task_emoji` and coroutine frames with `cor_emoji`. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/unix_events.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/unix_events.pyi index 269ea6794d..a03ff6cfac 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/unix_events.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/asyncio/unix_events.pyi @@ -18,7 +18,7 @@ _Ts = TypeVarTuple("_Ts") # Keep asyncio.__all__ updated with any changes to __all__ here if sys.platform != "win32": if sys.version_info >= (3, 14): - __all__ = ("SelectorEventLoop", "_DefaultEventLoopPolicy", "EventLoop") + __all__ = ("SelectorEventLoop", "EventLoop") elif sys.version_info >= (3, 13): # Adds EventLoop __all__ = ( @@ -131,6 +131,7 @@ if sys.version_info < (3, 14): Return True if the watcher is installed and ready to handle process exit notifications. + """ else: @@ -214,6 +215,7 @@ if sys.version_info < (3, 14): Return True if the watcher is installed and ready to handle process exit notifications. + """ if sys.platform != "win32": diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/base64.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/base64.pyi index 7cd56d859a..0fc7e13da0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/base64.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/base64.pyi @@ -93,10 +93,13 @@ def urlsafe_b64decode(s: str | ReadableBuffer) -> bytes: """ def b32encode(s: ReadableBuffer) -> bytes: - """Encode the bytes-like objects using base32 and return a bytes object.""" + """ + Encode the bytes-like objects using base32 and return a bytes object. + """ def b32decode(s: str | ReadableBuffer, casefold: bool = False, map01: str | ReadableBuffer | None = None) -> bytes: - """Decode the base32 encoded bytes-like object or ASCII string s. + """ + Decode the base32 encoded bytes-like object or ASCII string s. Optional casefold is a flag specifying whether a lowercase alphabet is acceptable as input. For security purposes, the default is False. @@ -130,10 +133,13 @@ def b16decode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: if sys.version_info >= (3, 10): def b32hexencode(s: ReadableBuffer) -> bytes: - """Encode the bytes-like objects using base32hex and return a bytes object.""" + """ + Encode the bytes-like objects using base32hex and return a bytes object. + """ def b32hexdecode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: - """Decode the base32hex encoded bytes-like object or ASCII string s. + """ + Decode the base32hex encoded bytes-like object or ASCII string s. Optional casefold is a flag specifying whether a lowercase alphabet is acceptable as input. For security purposes, the default is False. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/bdb.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/bdb.pyi index 4046207b55..2857aff0f6 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/bdb.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/bdb.pyi @@ -278,6 +278,7 @@ class Bdb: return string contains the canonical filename, the function name or '', the input arguments, the return value, and the line of code (if it exists). + """ def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> None: @@ -374,6 +375,7 @@ class Breakpoint: The information includes the breakpoint number, temporary status, file:line position, break condition, number of times to ignore, and number of times hit. + """ def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi index daec4dadf8..5df63f805d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi @@ -881,9 +881,11 @@ class complex: def from_number(cls, number: complex | SupportsComplex | SupportsFloat | SupportsIndex, /) -> Self: """Convert number to a complex floating-point number.""" +@type_check_only class _FormatMapMapping(Protocol): def __getitem__(self, key: str, /) -> Any: ... +@type_check_only class _TranslateTable(Protocol): def __getitem__(self, key: int, /) -> str | int | None: ... @@ -3380,6 +3382,7 @@ if sys.version_info >= (3, 10): def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: """Return an AsyncIterator for an AsyncIterable object.""" + @type_check_only class _SupportsSynchronousAnext(Protocol[_AwaitableT_co]): def __anext__(self) -> _AwaitableT_co: ... @@ -3700,7 +3703,6 @@ def iter(object: Callable[[], _T | None], sentinel: None, /) -> Iterator[_T]: .. @overload def iter(object: Callable[[], _T], sentinel: object, /) -> Iterator[_T]: ... -# Keep this alias in sync with unittest.case._ClassInfo if sys.version_info >= (3, 10): _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] else: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/bz2.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/bz2.pyi index 5ec5d81a28..ad86b66dc1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/bz2.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/bz2.pyi @@ -75,6 +75,7 @@ def open( For text mode, a BZ2File object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/calendar.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/calendar.pyi index 5841629aaf..2c5dd4ae6f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/calendar.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/calendar.pyi @@ -87,7 +87,8 @@ def monthrange(year: int, month: int) -> tuple[int, int]: """ class Calendar: - """Base calendar class. This class doesn't do any formatting. It simply + """ + Base calendar class. This class doesn't do any formatting. It simply provides data to subclasses. """ @@ -96,137 +97,183 @@ class Calendar: def getfirstweekday(self) -> int: ... def setfirstweekday(self, firstweekday: int) -> None: ... def iterweekdays(self) -> Iterable[int]: - """Return an iterator for one week of weekday numbers starting with the + """ + Return an iterator for one week of weekday numbers starting with the configured first one. """ def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: - """Return an iterator for one month. The iterator will yield datetime.date + """ + Return an iterator for one month. The iterator will yield datetime.date values and will always iterate through complete weeks, so it will yield dates outside the specified month. """ def itermonthdays2(self, year: int, month: int) -> Iterable[tuple[int, int]]: - """Like itermonthdates(), but will yield (day number, weekday number) + """ + Like itermonthdates(), but will yield (day number, weekday number) tuples. For days outside the specified month the day number is 0. """ def itermonthdays(self, year: int, month: int) -> Iterable[int]: - """Like itermonthdates(), but will yield day numbers. For days outside + """ + Like itermonthdates(), but will yield day numbers. For days outside the specified month the day number is 0. """ def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: - """Return a matrix (list of lists) representing a month's calendar. + """ + Return a matrix (list of lists) representing a month's calendar. Each row represents a week; week entries are datetime.date values. """ def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: - """Return a matrix representing a month's calendar. + """ + Return a matrix representing a month's calendar. Each row represents a week; week entries are (day number, weekday number) tuples. Day numbers outside this month are zero. """ def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: - """Return a matrix representing a month's calendar. + """ + Return a matrix representing a month's calendar. Each row represents a week; days outside this month are zero. """ def yeardatescalendar(self, year: int, width: int = 3) -> list[list[list[list[datetime.date]]]]: - """Return the data for the specified year ready for formatting. The return + """ + Return the data for the specified year ready for formatting. The return value is a list of month rows. Each month row contains up to width months. Each month contains between 4 and 6 weeks and each week contains 1-7 days. Days are datetime.date objects. """ def yeardays2calendar(self, year: int, width: int = 3) -> list[list[list[list[tuple[int, int]]]]]: - """Return the data for the specified year ready for formatting (similar to + """ + Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are (day number, weekday number) tuples. Day numbers outside this month are zero. """ def yeardayscalendar(self, year: int, width: int = 3) -> list[list[list[list[int]]]]: - """Return the data for the specified year ready for formatting (similar to + """ + Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero. """ def itermonthdays3(self, year: int, month: int) -> Iterable[tuple[int, int, int]]: - """Like itermonthdates(), but will yield (year, month, day) tuples. Can be + """ + Like itermonthdates(), but will yield (year, month, day) tuples. Can be used for dates outside of datetime.date range. """ def itermonthdays4(self, year: int, month: int) -> Iterable[tuple[int, int, int, int]]: - """Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples. + """ + Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples. Can be used for dates outside of datetime.date range. """ class TextCalendar(Calendar): - """Subclass of Calendar that outputs a calendar as a simple plain text + """ + Subclass of Calendar that outputs a calendar as a simple plain text similar to the UNIX program cal. """ def prweek(self, theweek: int, width: int) -> None: - """Print a single week (no newline).""" + """ + Print a single week (no newline). + """ def formatday(self, day: int, weekday: int, width: int) -> str: - """Returns a formatted day.""" + """ + Returns a formatted day. + """ def formatweek(self, theweek: int, width: int) -> str: - """Returns a single week in a string (no newline).""" + """ + Returns a single week in a string (no newline). + """ def formatweekday(self, day: int, width: int) -> str: - """Returns a formatted week day name.""" + """ + Returns a formatted week day name. + """ def formatweekheader(self, width: int) -> str: - """Return a header for a week.""" + """ + Return a header for a week. + """ def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = True) -> str: - """Return a formatted month name.""" + """ + Return a formatted month name. + """ def prmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> None: - """Print a month's calendar.""" + """ + Print a month's calendar. + """ def formatmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: - """Return a month's calendar string (multi-line).""" + """ + Return a month's calendar string (multi-line). + """ def formatyear(self, theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: - """Returns a year's calendar as a multi-line string.""" + """ + Returns a year's calendar as a multi-line string. + """ def pryear(self, theyear: int, w: int = 0, l: int = 0, c: int = 6, m: int = 3) -> None: """Print a year's calendar.""" def firstweekday() -> int: ... def monthcalendar(year: int, month: int) -> list[list[int]]: - """Return a matrix representing a month's calendar. + """ + Return a matrix representing a month's calendar. Each row represents a week; days outside this month are zero. """ def prweek(theweek: int, width: int) -> None: - """Print a single week (no newline).""" + """ + Print a single week (no newline). + """ def week(theweek: int, width: int) -> str: - """Returns a single week in a string (no newline).""" + """ + Returns a single week in a string (no newline). + """ def weekheader(width: int) -> str: - """Return a header for a week.""" + """ + Return a header for a week. + """ def prmonth(theyear: int, themonth: int, w: int = 0, l: int = 0) -> None: - """Print a month's calendar.""" + """ + Print a month's calendar. + """ def month(theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: - """Return a month's calendar string (multi-line).""" + """ + Return a month's calendar string (multi-line). + """ def calendar(theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: - """Returns a year's calendar as a multi-line string.""" + """ + Returns a year's calendar as a multi-line string. + """ def prcal(theyear: int, w: int = 0, l: int = 0, c: int = 6, m: int = 3) -> None: """Print a year's calendar.""" class HTMLCalendar(Calendar): - """This calendar returns complete HTML pages.""" + """ + This calendar returns complete HTML pages. + """ cssclasses: ClassVar[list[str]] cssclass_noday: ClassVar[str] @@ -236,30 +283,46 @@ class HTMLCalendar(Calendar): cssclass_year: ClassVar[str] cssclass_year_head: ClassVar[str] def formatday(self, day: int, weekday: int) -> str: - """Return a day as a table cell.""" + """ + Return a day as a table cell. + """ def formatweek(self, theweek: int) -> str: - """Return a complete week as a table row.""" + """ + Return a complete week as a table row. + """ def formatweekday(self, day: int) -> str: - """Return a weekday name as a table header.""" + """ + Return a weekday name as a table header. + """ def formatweekheader(self) -> str: - """Return a header for a week as a table row.""" + """ + Return a header for a week as a table row. + """ def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: - """Return a month name as a table row.""" + """ + Return a month name as a table row. + """ def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: - """Return a formatted month as a table.""" + """ + Return a formatted month as a table. + """ def formatyear(self, theyear: int, width: int = 3) -> str: - """Return a formatted year as a table of tables.""" + """ + Return a formatted year as a table of tables. + """ def formatyearpage( self, theyear: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None ) -> bytes: - """Return a formatted year as a complete HTML page.""" + """ + Return a formatted year as a complete HTML page. + """ class different_locale: def __init__(self, locale: _LocaleType) -> None: ... @@ -267,14 +330,16 @@ class different_locale: def __exit__(self, *args: Unused) -> None: ... class LocaleTextCalendar(TextCalendar): - """This class can be passed a locale name in the constructor and will return + """ + This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale. """ def __init__(self, firstweekday: int = 0, locale: _LocaleType | None = None) -> None: ... class LocaleHTMLCalendar(HTMLCalendar): - """This class can be passed a locale name in the constructor and will return + """ + This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/cgi.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/cgi.pyi index b4fb0b2b56..b3ed05365d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/cgi.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/cgi.pyi @@ -14,7 +14,7 @@ from builtins import list as _list, type as _type from collections.abc import Iterable, Iterator, Mapping from email.message import Message from types import TracebackType -from typing import IO, Any, Protocol +from typing import IO, Any, Protocol, type_check_only from typing_extensions import Self __all__ = [ @@ -78,6 +78,7 @@ def parse_multipart( is a list of strings. """ +@type_check_only class _Environ(Protocol): def __getitem__(self, k: str, /) -> str: ... def keys(self) -> Iterable[str]: ... @@ -86,6 +87,7 @@ def parse_header(line: str) -> tuple[str, dict[str, str]]: """Parse a Content-type like header. Return the main content-type and a dictionary of options. + """ def test(environ: _Environ = ...) -> None: @@ -93,6 +95,7 @@ def test(environ: _Environ = ...) -> None: Write minimal HTTP headers and dump all information provided to the script in HTML form. + """ def print_environ(environ: _Environ = ...) -> None: @@ -164,6 +167,7 @@ class FieldStorage: a file open for reading and writing. This makes it possible to override the default choice of storing all files in a temporary directory and unlinking them as soon as they have been opened. + """ FieldStorageClass: _type | None @@ -243,6 +247,7 @@ class FieldStorage: max_num_fields: int. If set, then __init__ throws a ValueError if there are more than n fields read by parse_qsl(). + """ def __enter__(self) -> Self: ... @@ -294,6 +299,7 @@ class FieldStorage: that is nevertheless automatically deleted when the script terminates, try defining a __del__ method in a derived class which unlinks the temporary files you have created. + """ def print_exception( diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/cmd.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/cmd.pyi index af19c87d35..a2ffd98d5f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/cmd.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/cmd.pyi @@ -61,6 +61,7 @@ class Cmd: framework. There is no good reason to instantiate Cmd itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit Cmd's methods and encapsulate action methods. + """ prompt: str @@ -87,17 +88,20 @@ class Cmd: is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used. + """ old_completer: Callable[[str, int], str | None] | None def cmdloop(self, intro: Any | None = None) -> None: """Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. + """ def precmd(self, line: str) -> str: """Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued. + """ def postcmd(self, stop: bool, line: str) -> bool: @@ -109,6 +113,7 @@ class Cmd: def postloop(self) -> None: """Hook method executed once when the cmdloop() method is about to return. + """ def parseline(self, line: str) -> tuple[str | None, str | None, str]: @@ -125,6 +130,7 @@ class Cmd: see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop. + """ def emptyline(self) -> bool: @@ -132,6 +138,7 @@ class Cmd: If this method is not overridden, it repeats the last nonempty command entered. + """ def default(self, line: str) -> None: @@ -139,6 +146,7 @@ class Cmd: If this method is not overridden, it prints an error message and returns. + """ def completedefault(self, *ignored: Any) -> list[str]: @@ -146,6 +154,7 @@ class Cmd: complete_*() method is available. By default, it returns an empty list. + """ def completenames(self, text: str, *ignored: Any) -> list[str]: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/code.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/code.pyi index d433728d26..2a1098ac03 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/code.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/code.pyi @@ -14,6 +14,7 @@ class InteractiveInterpreter: This class deals with parsing and interpreter state (the user's namespace); it doesn't deal with input buffering or prompting or input file naming (the filename is always passed in explicitly). + """ locals: dict[str, Any] # undocumented @@ -25,6 +26,7 @@ class InteractiveInterpreter: namespace in which code will be executed; it defaults to a newly created dictionary with key "__name__" set to "__console__" and key "__doc__" set to None. + """ def runsource(self, source: str, filename: str = "", symbol: str = "single") -> bool: @@ -49,6 +51,7 @@ class InteractiveInterpreter: an exception is raised). The return value can be used to decide whether to use sys.ps1 or sys.ps2 to prompt the next line. + """ def runcode(self, code: CodeType) -> None: @@ -61,6 +64,7 @@ class InteractiveInterpreter: A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not always be caught. The caller should be prepared to deal with it. + """ if sys.version_info >= (3, 13): def showsyntaxerror(self, filename: str | None = None, *, source: str = "") -> None: @@ -73,6 +77,7 @@ class InteractiveInterpreter: "" when reading from a string). The output is written by self.write(), below. + """ else: def showsyntaxerror(self, filename: str | None = None) -> None: @@ -85,6 +90,7 @@ class InteractiveInterpreter: "" when reading from a string). The output is written by self.write(), below. + """ def showtraceback(self) -> None: @@ -93,6 +99,7 @@ class InteractiveInterpreter: We remove the first stack item because it is our own code. The output is written by self.write(), below. + """ def write(self, data: str) -> None: @@ -100,6 +107,7 @@ class InteractiveInterpreter: The base implementation writes to sys.stderr; a subclass may replace this with a different implementation. + """ class InteractiveConsole(InteractiveInterpreter): @@ -107,6 +115,7 @@ class InteractiveConsole(InteractiveInterpreter): This class builds on InteractiveInterpreter and adds prompting using the familiar sys.ps1 and sys.ps2, and input buffering. + """ buffer: list[str] # undocumented @@ -122,6 +131,7 @@ class InteractiveConsole(InteractiveInterpreter): The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks. + """ def push(self, line: str, filename: str | None = None) -> bool: @@ -136,6 +146,7 @@ class InteractiveConsole(InteractiveInterpreter): is left as it was after the line was appended. The return value is 1 if more input is required, 0 if the line was dealt with in some way (this is the same as runsource()). + """ else: def __init__(self, locals: dict[str, Any] | None = None, filename: str = "") -> None: @@ -146,6 +157,7 @@ class InteractiveConsole(InteractiveInterpreter): The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks. + """ def push(self, line: str) -> bool: @@ -160,6 +172,7 @@ class InteractiveConsole(InteractiveInterpreter): is left as it was after the line was appended. The return value is 1 if more input is required, 0 if the line was dealt with in some way (this is the same as runsource()). + """ def interact(self, banner: str | None = None, exitmsg: str | None = None) -> None: @@ -176,6 +189,7 @@ class InteractiveConsole(InteractiveInterpreter): printed when exiting. Pass the empty string to suppress printing an exit message. If exitmsg is not given or None, a default message is printed. + """ def resetbuffer(self) -> None: @@ -190,6 +204,7 @@ class InteractiveConsole(InteractiveInterpreter): The base implementation uses the built-in function input(); a subclass may replace this with a different implementation. + """ if sys.version_info >= (3, 13): @@ -213,6 +228,7 @@ if sys.version_info >= (3, 13): local -- passed to InteractiveInterpreter.__init__() exitmsg -- passed to InteractiveConsole.interact() local_exit -- passed to InteractiveConsole.__init__() + """ else: @@ -234,4 +250,5 @@ else: readfunc -- if not None, replaces InteractiveConsole.raw_input() local -- passed to InteractiveInterpreter.__init__() exitmsg -- passed to InteractiveConsole.interact() + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/codecs.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/codecs.pyi index 96953ffb6c..eb90d7c5f1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/codecs.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/codecs.pyi @@ -156,6 +156,7 @@ def getencoder(encoding: str) -> _Encoder: its encoder function. Raises a LookupError in case the encoding cannot be found. + """ def getdecoder(encoding: str) -> _Decoder: @@ -163,6 +164,7 @@ def getdecoder(encoding: str) -> _Decoder: its decoder function. Raises a LookupError in case the encoding cannot be found. + """ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: @@ -171,6 +173,7 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: Raises a LookupError in case the encoding cannot be found or the codecs doesn't provide an incremental encoder. + """ @overload @@ -180,6 +183,7 @@ def getincrementaldecoder(encoding: _BufferedEncoding) -> _BufferedIncrementalDe Raises a LookupError in case the encoding cannot be found or the codecs doesn't provide an incremental decoder. + """ @overload @@ -189,6 +193,7 @@ def getreader(encoding: str) -> _StreamReader: its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found. + """ def getwriter(encoding: str) -> _StreamWriter: @@ -196,6 +201,7 @@ def getwriter(encoding: str) -> _StreamWriter: its StreamWriter class or factory function. Raises a LookupError in case the encoding cannot be found. + """ def open( @@ -252,10 +258,12 @@ def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = N .data_encoding and .file_encoding which reflect the given parameters of the same name. The attributes can be used for introspection by Python programs. + """ def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: - """Encoding iterator. + """ + Encoding iterator. Encodes the input strings from the iterator using an IncrementalEncoder. @@ -264,7 +272,8 @@ def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") - """ def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str, None, None]: - """Decoding iterator. + """ + Decoding iterator. Decodes the input strings from the iterator using an IncrementalDecoder. @@ -322,6 +331,7 @@ class Codec: (only for encoding). The set of allowed values can be extended via register_error. + """ # These are sort of @abstractmethod but sort of not. @@ -340,6 +350,7 @@ class Codec: The encoder must be able to handle zero length input and return an empty object of the output object type in this situation. + """ def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: @@ -360,17 +371,20 @@ class Codec: The decoder must be able to handle zero length input and return an empty object of the output object type in this situation. + """ class IncrementalEncoder: - """An IncrementalEncoder encodes an input in multiple steps. The input can + """ + An IncrementalEncoder encodes an input in multiple steps. The input can be passed piece by piece to the encode() method. The IncrementalEncoder remembers the state of the encoding process between calls to encode(). """ errors: str def __init__(self, errors: str = "strict") -> None: - """Creates an IncrementalEncoder instance. + """ + Creates an IncrementalEncoder instance. The IncrementalEncoder may use different error handling schemes by providing the errors keyword argument. See the module docstring @@ -379,28 +393,37 @@ class IncrementalEncoder: @abstractmethod def encode(self, input: str, final: bool = False) -> bytes: - """Encodes input and returns the resulting object.""" + """ + Encodes input and returns the resulting object. + """ def reset(self) -> None: - """Resets the encoder to the initial state.""" + """ + Resets the encoder to the initial state. + """ # documentation says int but str is needed for the subclass. def getstate(self) -> int | str: - """Return the current state of the encoder.""" + """ + Return the current state of the encoder. + """ def setstate(self, state: int | str) -> None: - """Set the current state of the encoder. state must have been + """ + Set the current state of the encoder. state must have been returned by getstate(). """ class IncrementalDecoder: - """An IncrementalDecoder decodes an input in multiple steps. The input can + """ + An IncrementalDecoder decodes an input in multiple steps. The input can be passed piece by piece to the decode() method. The IncrementalDecoder remembers the state of the decoding process between calls to decode(). """ errors: str def __init__(self, errors: str = "strict") -> None: - """Create an IncrementalDecoder instance. + """ + Create an IncrementalDecoder instance. The IncrementalDecoder may use different error handling schemes by providing the errors keyword argument. See the module docstring @@ -409,13 +432,18 @@ class IncrementalDecoder: @abstractmethod def decode(self, input: ReadableBuffer, final: bool = False) -> str: - """Decode input and returns the resulting object.""" + """ + Decode input and returns the resulting object. + """ def reset(self) -> None: - """Reset the decoder to the initial state.""" + """ + Reset the decoder to the initial state. + """ def getstate(self) -> tuple[bytes, int]: - """Return the current state of the decoder. + """ + Return the current state of the decoder. This must be a (buffered_input, additional_state_info) tuple. buffered_input must be a bytes object containing bytes that @@ -427,7 +455,8 @@ class IncrementalDecoder: """ def setstate(self, state: tuple[bytes, int]) -> None: - """Set the current state of the decoder. + """ + Set the current state of the decoder. state must have been returned by getstate(). The effect of setstate((b"", 0)) must be equivalent to reset(). @@ -435,7 +464,8 @@ class IncrementalDecoder: # These are not documented but used in encodings/*.py implementations. class BufferedIncrementalEncoder(IncrementalEncoder): - """This subclass of IncrementalEncoder can be used as the baseclass for an + """ + This subclass of IncrementalEncoder can be used as the baseclass for an incremental encoder if the encoder must keep some of the output in a buffer between calls to encode(). """ @@ -447,7 +477,8 @@ class BufferedIncrementalEncoder(IncrementalEncoder): def encode(self, input: str, final: bool = False) -> bytes: ... class BufferedIncrementalDecoder(IncrementalDecoder): - """This subclass of IncrementalDecoder can be used as the baseclass for an + """ + This subclass of IncrementalDecoder can be used as the baseclass for an incremental decoder if the decoder must be able to handle incomplete byte sequences. """ @@ -500,6 +531,7 @@ class StreamWriter(Codec): output is put into a clean state, that allows appending of new fresh data without having to rescan the whole stream to recover state. + """ def seek(self, offset: int, whence: int = 0) -> None: ... @@ -564,6 +596,7 @@ class StreamReader(Codec): size, if given, is passed as size argument to the read() method. + """ def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: @@ -574,7 +607,8 @@ class StreamReader(Codec): method and are included in the list entries. sizehint, if given, is ignored since there is no efficient - way to finding the true end-of-line. + way of finding the true end-of-line. + """ def reset(self) -> None: @@ -583,6 +617,7 @@ class StreamReader(Codec): Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors. + """ def seek(self, offset: int, whence: int = 0) -> None: @@ -609,6 +644,7 @@ class StreamReaderWriter(TextIO): The design is such that one can use the factory functions returned by the codec.lookup() function to construct the instance. + """ stream: _Stream @@ -622,6 +658,7 @@ class StreamReaderWriter(TextIO): Error handling is done in the same way as defined for the StreamWriter/Readers. + """ def read(self, size: int = -1) -> str: ... @@ -664,6 +701,7 @@ class StreamRecoder(BinaryIO): In the other direction, data is read from the underlying stream using a Reader instance and then encoded and returned to the caller. + """ data_encoding: str @@ -693,6 +731,7 @@ class StreamRecoder(BinaryIO): Error handling is done in the same way as defined for the StreamWriter/Readers. + """ def read(self, size: int = -1) -> bytes: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/collections/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/collections/__init__.pyi index b8cb12114b..6e35e64770 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/collections/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/collections/__init__.pyi @@ -77,6 +77,7 @@ def namedtuple( Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22) + """ class UserDict(MutableMapping[_KT, _VT]): @@ -404,6 +405,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c['b'] -= 2 # reduce the count of 'b' by two >>> c.most_common() # 'b' is still in, but its count is zero [('a', 3), ('c', 1), ('b', 0)] + """ @overload @@ -416,6 +418,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c = Counter('gallahad') # a new counter from an iterable >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping >>> c = Counter(a=4, b=2) # a new counter from keyword args + """ @overload @@ -443,6 +446,7 @@ class Counter(dict[_T, int], Generic[_T]): Note, if an element's count has been set to zero or is a negative number, elements() will ignore it. + """ def most_common(self, n: int | None = None) -> list[tuple[_T, int]]: @@ -451,6 +455,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> Counter('abracadabra').most_common(3) [('a', 5), ('b', 2), ('r', 2)] + """ @classmethod @@ -470,6 +475,7 @@ class Counter(dict[_T, int], Generic[_T]): 0 >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch -1 + """ @overload @@ -494,6 +500,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c.update(d) # add elements from another counter >>> c['h'] # four 'h' in which, witch, and watch 4 + """ @overload @@ -517,6 +524,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) + """ def __sub__(self, other: Counter[_T]) -> Counter[_T]: @@ -524,6 +532,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) + """ def __and__(self, other: Counter[_T]) -> Counter[_T]: @@ -531,6 +540,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) + """ def __or__(self, other: Counter[_S]) -> Counter[_T | _S]: # type: ignore[override] @@ -538,6 +548,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) + """ def __pos__(self) -> Counter[_T]: @@ -546,6 +557,7 @@ class Counter(dict[_T, int], Generic[_T]): def __neg__(self) -> Counter[_T]: """Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. + """ # several type: ignores because __iadd__ is supposedly incompatible with __add__, etc. def __iadd__(self, other: SupportsItems[_T, int]) -> Self: # type: ignore[misc] @@ -555,6 +567,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) + """ def __isub__(self, other: SupportsItems[_T, int]) -> Self: @@ -564,6 +577,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) + """ def __iand__(self, other: SupportsItems[_T, int]) -> Self: @@ -573,6 +587,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c &= Counter('bcc') >>> c Counter({'b': 1}) + """ def __ior__(self, other: SupportsItems[_T, int]) -> Self: # type: ignore[override,misc] @@ -582,6 +597,7 @@ class Counter(dict[_T, int], Generic[_T]): >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) + """ if sys.version_info >= (3, 10): def total(self) -> int: @@ -779,12 +795,14 @@ class ChainMap(MutableMapping[_KT, _VT]): Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. + """ maps: list[MutableMapping[_KT, _VT]] def __init__(self, *maps: MutableMapping[_KT, _VT]) -> None: """Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. + """ def new_child(self, m: MutableMapping[_KT, _VT] | None = None) -> Self: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/compileall.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/compileall.pyi index 8b63dbb72e..e6c1e174f6 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/compileall.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/compileall.pyi @@ -14,10 +14,11 @@ See module py_compile for details of the actual byte-compilation. import sys from _typeshed import StrPath from py_compile import PycInvalidationMode -from typing import Any, Protocol +from typing import Any, Protocol, type_check_only __all__ = ["compile_dir", "compile_file", "compile_path"] +@type_check_only class _SupportsSearch(Protocol): def search(self, string: str, /) -> Any: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/__init__.pyi index 4ab3016faf..251a453c6e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/__init__.pyi @@ -21,7 +21,7 @@ from .thread import ThreadPoolExecutor as ThreadPoolExecutor if sys.version_info >= (3, 14): from .interpreter import InterpreterPoolExecutor as InterpreterPoolExecutor - __all__ = ( + __all__ = [ "FIRST_COMPLETED", "FIRST_EXCEPTION", "ALL_COMPLETED", @@ -36,7 +36,7 @@ if sys.version_info >= (3, 14): "ProcessPoolExecutor", "ThreadPoolExecutor", "InterpreterPoolExecutor", - ) + ] elif sys.version_info >= (3, 13): __all__ = ( diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/_base.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/_base.pyi index 9ca0ce6ec4..15c15f4140 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/_base.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/_base.pyi @@ -35,7 +35,9 @@ class InvalidStateError(Error): """The operation is not allowed in this state.""" class BrokenExecutor(RuntimeError): - """Raised when a executor has become non-functional after a severe failure.""" + """ + Raised when a executor has become non-functional after a severe failure. + """ _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/interpreter.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/interpreter.pyi index d4cd47354b..636147c979 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/interpreter.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/interpreter.pyi @@ -58,7 +58,9 @@ if sys.version_info >= (3, 14): def run(self, task: _Task) -> None: ... # type: ignore[override] class BrokenInterpreterPool(BrokenThreadPool): - """Raised when a worker thread in an InterpreterPoolExecutor failed initializing.""" + """ + Raised when a worker thread in an InterpreterPoolExecutor failed initializing. + """ class InterpreterPoolExecutor(ThreadPoolExecutor): BROKEN: type[BrokenInterpreterPool] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/process.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/process.pyi index 152d764522..d02bd67584 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/process.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/process.pyi @@ -151,6 +151,7 @@ def _process_chunk(fn: Callable[..., _T], chunk: Iterable[tuple[Any, ...]]) -> l iterable passed to map. This function is run in a separate process. + """ if sys.version_info >= (3, 11): @@ -247,13 +248,15 @@ _system_limited: bool | None def _check_system_limits() -> None: ... def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> Any: - """Specialized implementation of itertools.chain.from_iterable. + """ + Specialized implementation of itertools.chain.from_iterable. Each item in *iterable* should be a list. This function is careful not to keep references to yielded objects. """ class BrokenProcessPool(BrokenExecutor): - """Raised when a process in a ProcessPoolExecutor terminated abruptly + """ + Raised when a process in a ProcessPoolExecutor terminated abruptly while a future was in the running state. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/thread.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/thread.pyi index 095fe527de..8bf83dc8b2 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/thread.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/futures/thread.pyi @@ -89,7 +89,9 @@ else: ) -> None: ... class BrokenThreadPool(BrokenExecutor): - """Raised when a worker thread in a ThreadPoolExecutor failed initializing.""" + """ + Raised when a worker thread in a ThreadPoolExecutor failed initializing. + """ class ThreadPoolExecutor(Executor): if sys.version_info >= (3, 14): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/__init__.pyi new file mode 100644 index 0000000000..3485bb69cd --- /dev/null +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/__init__.pyi @@ -0,0 +1,142 @@ +"""Subinterpreters High Level Module.""" + +import sys +import threading +import types +from collections.abc import Callable +from typing import Any, Literal, TypeVar +from typing_extensions import ParamSpec, Self + +if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13 + from _interpreters import ( + InterpreterError as InterpreterError, + InterpreterNotFoundError as InterpreterNotFoundError, + NotShareableError as NotShareableError, + _SharedDict, + _Whence, + is_shareable as is_shareable, + ) + + from ._queues import Queue as Queue, QueueEmpty as QueueEmpty, QueueFull as QueueFull, create as create_queue + + __all__ = [ + "ExecutionFailed", + "Interpreter", + "InterpreterError", + "InterpreterNotFoundError", + "NotShareableError", + "Queue", + "QueueEmpty", + "QueueFull", + "create", + "create_queue", + "get_current", + "get_main", + "is_shareable", + "list_all", + ] + + _R = TypeVar("_R") + _P = ParamSpec("_P") + + class ExecutionFailed(InterpreterError): + """An unhandled exception happened during execution. + + This is raised from Interpreter.exec() and Interpreter.call(). + """ + + excinfo: types.SimpleNamespace + + def __init__(self, excinfo: types.SimpleNamespace) -> None: ... + + def create() -> Interpreter: + """Return a new (idle) Python interpreter.""" + + def list_all() -> list[Interpreter]: + """Return all existing interpreters.""" + + def get_current() -> Interpreter: + """Return the currently running interpreter.""" + + def get_main() -> Interpreter: + """Return the main interpreter.""" + + class Interpreter: + """A single Python interpreter. + + Attributes: + + "id" - the unique process-global ID number for the interpreter + "whence" - indicates where the interpreter was created + + If the interpreter wasn't created by this module + then any method that modifies the interpreter will fail, + i.e. .close(), .prepare_main(), .exec(), and .call() + """ + + def __new__(cls, id: int, /, _whence: _Whence | None = None, _ownsref: bool | None = None) -> Self: ... + def __reduce__(self) -> tuple[type[Self], int]: ... + def __hash__(self) -> int: ... + def __del__(self) -> None: ... + @property + def id(self) -> int: ... + @property + def whence( + self, + ) -> Literal["unknown", "runtime init", "legacy C-API", "C-API", "cross-interpreter C-API", "_interpreters module"]: ... + def is_running(self) -> bool: + """Return whether or not the identified interpreter is running.""" + + def close(self) -> None: + """Finalize and destroy the interpreter. + + Attempting to destroy the current interpreter results + in an InterpreterError. + """ + + def prepare_main( + self, ns: _SharedDict | None = None, /, **kwargs: Any + ) -> None: # kwargs has same value restrictions as _SharedDict + """Bind the given values into the interpreter's __main__. + + The values must be shareable. + """ + + def exec(self, code: str | types.CodeType | Callable[[], object], /) -> None: + """Run the given source code in the interpreter. + + This is essentially the same as calling the builtin "exec" + with this interpreter, using the __dict__ of its __main__ + module as both globals and locals. + + There is no return value. + + If the code raises an unhandled exception then an ExecutionFailed + exception is raised, which summarizes the unhandled exception. + The actual exception is discarded because objects cannot be + shared between interpreters. + + This blocks the current Python thread until done. During + that time, the previous interpreter is allowed to run + in other threads. + """ + + def call(self, callable: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: + """Call the object in the interpreter with given args/kwargs. + + Nearly all callables, args, kwargs, and return values are + supported. All "shareable" objects are supported, as are + "stateless" functions (meaning non-closures that do not use + any globals). This method will fall back to pickle. + + If the callable raises an exception then the error display + (including full traceback) is sent back between the interpreters + and an ExecutionFailed exception is raised, much like what + happens with Interpreter.exec(). + """ + + def call_in_thread(self, callable: Callable[_P, object], /, *args: _P.args, **kwargs: _P.kwargs) -> threading.Thread: + """Return a new thread that calls the object in the interpreter. + + The return value and any raised exception are discarded. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_crossinterp.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_crossinterp.pyi new file mode 100644 index 0000000000..b2a01173ff --- /dev/null +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_crossinterp.pyi @@ -0,0 +1,44 @@ +"""Common code between queues and channels.""" + +import sys +from collections.abc import Callable +from typing import Final, NewType +from typing_extensions import Never, Self, TypeAlias + +if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13 + from _interpqueues import _UnboundOp + + class ItemInterpreterDestroyed(Exception): + """Raised when trying to get an item whose interpreter was destroyed.""" + + # Actually a descriptor that behaves similarly to classmethod but prevents + # access from instances. + classonly = classmethod + + class UnboundItem: + """Represents a cross-interpreter item no longer bound to an interpreter. + + An item is unbound when the interpreter that added it to the + cross-interpreter container is destroyed. + """ + + def __new__(cls) -> Never: ... + @classonly + def singleton(cls, kind: str, module: str, name: str = "UNBOUND") -> Self: + """A non-data descriptor that makes a value only visible on the class. + + This is like the "classmethod" builtin, but does not show up on + instances of the class. It may be used as a decorator. + """ + + # Sentinel types and alias that don't exist at runtime. + _UnboundErrorType = NewType("_UnboundErrorType", object) + _UnboundRemoveType = NewType("_UnboundRemoveType", object) + _AnyUnbound: TypeAlias = _UnboundErrorType | _UnboundRemoveType | UnboundItem + + UNBOUND_ERROR: Final[_UnboundErrorType] + UNBOUND_REMOVE: Final[_UnboundRemoveType] + UNBOUND: Final[UnboundItem] # analogous to UNBOUND_REPLACE in C + + def serialize_unbound(unbound: _AnyUnbound) -> tuple[_UnboundOp]: ... + def resolve_unbound(flag: _UnboundOp, exctype_destroyed: Callable[[str], BaseException]) -> UnboundItem: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_queues.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_queues.pyi new file mode 100644 index 0000000000..4eb08bfc81 --- /dev/null +++ b/crates/ty_vendored/vendor/typeshed/stdlib/concurrent/interpreters/_queues.pyi @@ -0,0 +1,134 @@ +"""Cross-interpreter Queues High Level Module.""" + +import queue +import sys +from typing import Final, SupportsIndex +from typing_extensions import Self + +if sys.version_info >= (3, 13): # needed to satisfy pyright checks for Python <3.13 + from _interpqueues import QueueError as QueueError, QueueNotFoundError as QueueNotFoundError + + from . import _crossinterp + from ._crossinterp import UNBOUND_ERROR as UNBOUND_ERROR, UNBOUND_REMOVE as UNBOUND_REMOVE, UnboundItem, _AnyUnbound + + __all__ = [ + "UNBOUND", + "UNBOUND_ERROR", + "UNBOUND_REMOVE", + "ItemInterpreterDestroyed", + "Queue", + "QueueEmpty", + "QueueError", + "QueueFull", + "QueueNotFoundError", + "create", + "list_all", + ] + + class QueueEmpty(QueueError, queue.Empty): + """Raised from get_nowait() when the queue is empty. + + It is also raised from get() if it times out. + """ + + class QueueFull(QueueError, queue.Full): + """Raised from put_nowait() when the queue is full. + + It is also raised from put() if it times out. + """ + + class ItemInterpreterDestroyed(QueueError, _crossinterp.ItemInterpreterDestroyed): + """Raised from get() and get_nowait().""" + + UNBOUND: Final[UnboundItem] + + def create(maxsize: int = 0, *, unbounditems: _AnyUnbound = ...) -> Queue: + """Return a new cross-interpreter queue. + + The queue may be used to pass data safely between interpreters. + + "unbounditems" sets the default for Queue.put(); see that method for + supported values. The default value is UNBOUND, which replaces + the unbound item. + """ + + def list_all() -> list[Queue]: + """Return a list of all open queues.""" + + class Queue: + """A cross-interpreter queue.""" + + def __new__(cls, id: int, /) -> Self: ... + def __del__(self) -> None: ... + def __hash__(self) -> int: ... + def __reduce__(self) -> tuple[type[Self], int]: ... + @property + def id(self) -> int: ... + @property + def unbounditems(self) -> _AnyUnbound: ... + @property + def maxsize(self) -> int: ... + def empty(self) -> bool: ... + def full(self) -> bool: ... + def qsize(self) -> int: ... + def put( + self, + obj: object, + timeout: SupportsIndex | None = None, + *, + unbounditems: _AnyUnbound | None = None, + _delay: float = ..., + ) -> None: + """Add the object to the queue. + + This blocks while the queue is full. + + For most objects, the object received through Queue.get() will + be a new one, equivalent to the original and not sharing any + actual underlying data. The notable exceptions include + cross-interpreter types (like Queue) and memoryview, where the + underlying data is actually shared. Furthermore, some types + can be sent through a queue more efficiently than others. This + group includes various immutable types like int, str, bytes, and + tuple (if the items are likewise efficiently shareable). See interpreters.is_shareable(). + + "unbounditems" controls the behavior of Queue.get() for the given + object if the current interpreter (calling put()) is later + destroyed. + + If "unbounditems" is None (the default) then it uses the + queue's default, set with create_queue(), + which is usually UNBOUND. + + If "unbounditems" is UNBOUND_ERROR then get() will raise an + ItemInterpreterDestroyed exception if the original interpreter + has been destroyed. This does not otherwise affect the queue; + the next call to put() will work like normal, returning the next + item in the queue. + + If "unbounditems" is UNBOUND_REMOVE then the item will be removed + from the queue as soon as the original interpreter is destroyed. + Be aware that this will introduce an imbalance between put() + and get() calls. + + If "unbounditems" is UNBOUND then it is returned by get() in place + of the unbound item. + """ + + def put_nowait(self, obj: object, *, unbounditems: _AnyUnbound | None = None) -> None: ... + def get(self, timeout: SupportsIndex | None = None, *, _delay: float = ...) -> object: + """Return the next object from the queue. + + This blocks while the queue is empty. + + If the next item's original interpreter has been destroyed + then the "next object" is determined by the value of the + "unbounditems" argument to put(). + """ + + def get_nowait(self) -> object: + """Return the next object from the channel. + + If the queue is empty then raise QueueEmpty. Otherwise this + is the same as get(). + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/configparser.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/configparser.pyi index 6b1e6f5a3d..7df1e3d361 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/configparser.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/configparser.pyi @@ -648,6 +648,7 @@ class SectionProxy(MutableMapping[str, str]): Unless `fallback` is provided, `None` will be returned if the option is not found. + """ @overload @@ -664,17 +665,17 @@ class SectionProxy(MutableMapping[str, str]): # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together @overload - def getint(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int | None: ... + def getint(self, option: str, *, raw: bool = False, vars: _Section | None = None) -> int | None: ... @overload - def getint(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> int | _T: ... + def getint(self, option: str, fallback: _T = ..., *, raw: bool = False, vars: _Section | None = None) -> int | _T: ... @overload - def getfloat(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float | None: ... + def getfloat(self, option: str, *, raw: bool = False, vars: _Section | None = None) -> float | None: ... @overload - def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> float | _T: ... + def getfloat(self, option: str, fallback: _T = ..., *, raw: bool = False, vars: _Section | None = None) -> float | _T: ... @overload - def getboolean(self, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool | None: ... + def getboolean(self, option: str, *, raw: bool = False, vars: _Section | None = None) -> bool | None: ... @overload - def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: _Section | None = ...) -> bool | _T: ... + def getboolean(self, option: str, fallback: _T = ..., *, raw: bool = False, vars: _Section | None = None) -> bool | _T: ... # SectionProxy can have arbitrary attributes when custom converters are used def __getattr__(self, key: str) -> Callable[..., Any]: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/contextlib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/contextlib.pyi index e47ef76843..1a1bb2c69c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/contextlib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/contextlib.pyi @@ -6,7 +6,7 @@ from _typeshed import FileDescriptorOrPath, Unused from abc import ABC, abstractmethod from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator from types import TracebackType -from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable +from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable, type_check_only from typing_extensions import ParamSpec, Self, TypeAlias __all__ = [ @@ -201,6 +201,7 @@ def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P """ +@type_check_only class _SupportsClose(Protocol): def close(self) -> object: ... @@ -221,12 +222,14 @@ class closing(AbstractContextManager[_SupportsCloseT, None]): finally: f.close() + """ def __init__(self, thing: _SupportsCloseT) -> None: ... def __exit__(self, *exc_info: Unused) -> None: ... if sys.version_info >= (3, 10): + @type_check_only class _SupportsAclose(Protocol): def aclose(self) -> Awaitable[object]: ... @@ -248,6 +251,7 @@ if sys.version_info >= (3, 10): finally: await agen.aclose() + """ def __init__(self, thing: _SupportsAcloseT) -> None: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/copy.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/copy.pyi index 1638f9ce62..9f143cf7fd 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/copy.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/copy.pyi @@ -50,7 +50,7 @@ __getstate__() and __setstate__(). See the documentation for module """ import sys -from typing import Any, Protocol, TypeVar +from typing import Any, Protocol, TypeVar, type_check_only from typing_extensions import Self __all__ = ["Error", "copy", "deepcopy"] @@ -58,6 +58,7 @@ __all__ = ["Error", "copy", "deepcopy"] _T = TypeVar("_T") _SR = TypeVar("_SR", bound=_SupportsReplace) +@type_check_only class _SupportsReplace(Protocol): # In reality doesn't support args, but there's no other great way to express this. def __replace__(self, *args: Any, **kwargs: Any) -> Self: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/crypt.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/crypt.pyi index c4eaa4d498..0830524b75 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/crypt.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/crypt.pyi @@ -26,6 +26,7 @@ if sys.platform != "win32": """Generate a salt for the specified method. If not specified, the strongest available method will be used. + """ def crypt(word: str, salt: str | _Method | None = None) -> str: @@ -36,4 +37,5 @@ if sys.platform != "win32": available method will be selected and a salt generated. Otherwise, ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as returned by ``crypt.mksalt()``. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/csv.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/csv.pyi index 6f1b1858eb..2f4cd6b124 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/csv.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/csv.pyi @@ -128,6 +128,7 @@ class Dialect: This must be subclassed (see csv.excel). Valid attributes are: delimiter, quotechar, escapechar, doublequote, skipinitialspace, lineterminator, quoting. + """ delimiter: str @@ -234,12 +235,15 @@ class DictWriter(Generic[_T]): """ class Sniffer: - """ "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) + """ + "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) Returns a Dialect object. """ preferred: list[str] def sniff(self, sample: str, delimiters: str | None = None) -> type[Dialect]: - """Returns a dialect (or None) corresponding to the sample""" + """ + Returns a dialect (or None) corresponding to the sample + """ def has_header(self, sample: str) -> bool: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/__init__.pyi index 7f7e77d7b4..2d30ef8b6a 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/__init__.pyi @@ -13,6 +13,7 @@ from _ctypes import ( _CData as _CData, _CDataType as _CDataType, _CField as _CField, + _CTypeBaseType, _Pointer as _Pointer, _PointerLike as _PointerLike, _SimpleCData as _SimpleCData, @@ -231,7 +232,7 @@ def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_w """ @deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15") -def SetPointerType(pointer: type[_Pointer[Any]], cls: Any) -> None: ... +def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ... def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove if sys.platform == "win32": diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dyld.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dyld.pyi index 1bb07b4ec4..37be9bd241 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dyld.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dyld.pyi @@ -9,10 +9,13 @@ from ctypes.macholib.framework import framework_info as framework_info __all__ = ["dyld_find", "framework_find", "framework_info", "dylib_info"] def dyld_find(name: str, executable_path: str | None = None, env: Mapping[str, str] | None = None) -> str: - """Find a library or framework using dyld semantics""" + """ + Find a library or framework using dyld semantics + """ def framework_find(fn: str, executable_path: str | None = None, env: Mapping[str, str] | None = None) -> str: - """Find a framework using dyld semantics in a very loose manner. + """ + Find a framework using dyld semantics in a very loose manner. Will take input such as: Python diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dylib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dylib.pyi index af745eaa42..58ece6cc99 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dylib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/dylib.pyi @@ -16,7 +16,8 @@ class _DylibInfo(TypedDict): suffix: str | None def dylib_info(filename: str) -> _DylibInfo | None: - """A dylib name can take one of the following four forms: + """ + A dylib name can take one of the following four forms: Location/Name.SomeVersion_Suffix.dylib Location/Name.SomeVersion.dylib Location/Name_Suffix.dylib diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/framework.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/framework.pyi index 4a1732ad51..f12f2b3fd1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/framework.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ctypes/macholib/framework.pyi @@ -16,7 +16,8 @@ class _FrameworkInfo(TypedDict): suffix: str | None def framework_info(filename: str) -> _FrameworkInfo | None: - """A framework name can take one of the following four forms: + """ + A framework name can take one of the following four forms: Location/Name.framework/Versions/SomeVersion/Name_Suffix Location/Name.framework/Versions/SomeVersion/Name Location/Name.framework/Name_Suffix diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/datetime.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/datetime.pyi index c54546eeb4..4729c819c0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/datetime.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/datetime.pyi @@ -193,13 +193,13 @@ class time: resolution: ClassVar[timedelta] def __new__( cls, - hour: SupportsIndex = ..., - minute: SupportsIndex = ..., - second: SupportsIndex = ..., - microsecond: SupportsIndex = ..., - tzinfo: _TzInfo | None = ..., + hour: SupportsIndex = 0, + minute: SupportsIndex = 0, + second: SupportsIndex = 0, + microsecond: SupportsIndex = 0, + tzinfo: _TzInfo | None = None, *, - fold: int = ..., + fold: int = 0, ) -> Self: ... @property def hour(self) -> int: ... @@ -219,7 +219,7 @@ class time: def __gt__(self, value: time, /) -> bool: ... def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... - def isoformat(self, timespec: str = ...) -> str: + def isoformat(self, timespec: str = "auto") -> str: """Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. The optional argument timespec specifies the number of additional terms @@ -298,13 +298,13 @@ class timedelta: resolution: ClassVar[timedelta] def __new__( cls, - days: float = ..., - seconds: float = ..., - microseconds: float = ..., - milliseconds: float = ..., - minutes: float = ..., - hours: float = ..., - weeks: float = ..., + days: float = 0, + seconds: float = 0, + microseconds: float = 0, + milliseconds: float = 0, + minutes: float = 0, + hours: float = 0, + weeks: float = 0, ) -> Self: ... @property def days(self) -> int: @@ -390,13 +390,13 @@ class datetime(date): year: SupportsIndex, month: SupportsIndex, day: SupportsIndex, - hour: SupportsIndex = ..., - minute: SupportsIndex = ..., - second: SupportsIndex = ..., - microsecond: SupportsIndex = ..., - tzinfo: _TzInfo | None = ..., + hour: SupportsIndex = 0, + minute: SupportsIndex = 0, + second: SupportsIndex = 0, + microsecond: SupportsIndex = 0, + tzinfo: _TzInfo | None = None, *, - fold: int = ..., + fold: int = 0, ) -> Self: ... @property def hour(self) -> int: ... @@ -415,11 +415,11 @@ class datetime(date): # meaning it is only *safe* to pass it as a keyword argument on 3.12+ if sys.version_info >= (3, 12): @classmethod - def fromtimestamp(cls, timestamp: float, tz: _TzInfo | None = ...) -> Self: + def fromtimestamp(cls, timestamp: float, tz: _TzInfo | None = None) -> Self: """timestamp[, tz] -> tz's local time from POSIX timestamp.""" else: @classmethod - def fromtimestamp(cls, timestamp: float, /, tz: _TzInfo | None = ...) -> Self: + def fromtimestamp(cls, timestamp: float, /, tz: _TzInfo | None = None) -> Self: """timestamp[, tz] -> tz's local time from POSIX timestamp.""" @classmethod @@ -492,10 +492,10 @@ class datetime(date): ) -> Self: """Return datetime with new specified fields.""" - def astimezone(self, tz: _TzInfo | None = ...) -> Self: + def astimezone(self, tz: _TzInfo | None = None) -> Self: """tz -> convert to local time in new timezone tz""" - def isoformat(self, sep: str = ..., timespec: str = ...) -> str: + def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: """[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to 'T'. The optional argument timespec specifies the number of additional terms diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/dbm/dumb.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/dbm/dumb.pyi index 43aabf5c22..22ef756aca 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/dbm/dumb.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/dbm/dumb.pyi @@ -66,6 +66,7 @@ if sys.version_info >= (3, 11): The optional mode argument is the UNIX mode of the file, used only when the database has to be created. It defaults to octal code 0o666 (and will be modified by the prevailing umask). + """ else: @@ -81,4 +82,5 @@ else: The optional mode argument is the UNIX mode of the file, used only when the database has to be created. It defaults to octal code 0o666 (and will be modified by the prevailing umask). + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/decimal.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/decimal.pyi index 4fe310ce77..a4e56372dc 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/decimal.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/decimal.pyi @@ -175,6 +175,7 @@ class Decimal: or another Decimal object. If no value is given, return Decimal('0'). The context does not affect the conversion and is only passed to determine if the InvalidOperation trap is active. + """ def __new__(cls, value: _DecimalNew = "0", context: Context | None = None) -> Self: ... @@ -189,6 +190,8 @@ class Decimal: Decimal('0.1000000000000000055511151231257827021181583404541015625') >>> Decimal.from_number(Decimal('3.14')) # another decimal instance Decimal('3.14') + + """ @classmethod @@ -205,6 +208,8 @@ class Decimal: Decimal('Infinity') >>> Decimal.from_float(float('-inf')) Decimal('-Infinity') + + """ def __bool__(self) -> bool: @@ -217,6 +222,7 @@ class Decimal: a < b ==> Decimal('-1') a == b ==> Decimal('0') a > b ==> Decimal('1') + """ def __hash__(self) -> int: ... @@ -229,6 +235,7 @@ class Decimal: Return a pair of integers, whose ratio is exactly equal to the original Decimal and with a positive denominator. The ratio is in lowest terms. Raise OverflowError on infinities and a ValueError on NaNs. + """ def to_eng_string(self, context: Context | None = None) -> str: @@ -238,6 +245,7 @@ class Decimal: The value of context.capitals determines whether the exponent sign is lower or upper case. Otherwise, the context does not affect the operation. + """ def __abs__(self) -> Decimal: @@ -307,6 +315,7 @@ class Decimal: if two integers are equally near then the even one is chosen. If the result is zero then its sign will be the sign of self. + """ def __float__(self) -> float: @@ -336,6 +345,8 @@ class Decimal: >>> Decimal(2).fma(3, 5) Decimal('11') + + """ def __rpow__(self, value: _Decimal, mod: Context | None = None, /) -> Decimal: @@ -347,6 +358,7 @@ class Decimal: for producing canonical values for members of an equivalence class. For example, Decimal('32.100') and Decimal('0.321000e+2') both normalize to the equivalent value Decimal('32.1'). + """ def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: @@ -368,6 +380,7 @@ class Decimal: rounding may be necessary. In this case, the rounding mode is determined by the rounding argument if given, else by the given context argument; if neither argument is given, the rounding mode of the current thread's context is used. + """ def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: @@ -376,6 +389,7 @@ class Decimal: This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. As an exception, the C version may raise InvalidOperation if the second operand cannot be converted exactly. + """ def to_integral_exact(self, rounding: str | None = None, context: Context | None = None) -> Decimal: @@ -383,6 +397,7 @@ class Decimal: rounding occurs. The rounding mode is determined by the rounding parameter if given, else by the given context. If neither parameter is given, then the rounding mode of the current default context is used. + """ def to_integral_value(self, rounding: str | None = None, context: Context | None = None) -> Decimal: @@ -390,26 +405,31 @@ class Decimal: rounding mode is determined by the rounding parameter if given, else by the given context. If neither parameter is given, then the rounding mode of the current default context is used. + """ def to_integral(self, rounding: str | None = None, context: Context | None = None) -> Decimal: """Identical to the to_integral_value() method. The to_integral() name has been kept for compatibility with older versions. + """ def sqrt(self, context: Context | None = None) -> Decimal: """Return the square root of the argument to full precision. The result is correctly rounded using the ROUND_HALF_EVEN rounding mode. + """ def max(self, other: _Decimal, context: Context | None = None) -> Decimal: """Maximum of self and other. If one operand is a quiet NaN and the other is numeric, the numeric operand is returned. + """ def min(self, other: _Decimal, context: Context | None = None) -> Decimal: """Minimum of self and other. If one operand is a quiet NaN and the other is numeric, the numeric operand is returned. + """ def adjusted(self) -> int: @@ -419,6 +439,7 @@ class Decimal: """Return the canonical encoding of the argument. Currently, the encoding of a Decimal instance is always canonical, so this operation returns its argument unchanged. + """ def compare_signal(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -443,6 +464,7 @@ class Decimal: This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. As an exception, the C version may raise InvalidOperation if the second operand cannot be converted exactly. + """ def compare_total_mag(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -454,16 +476,19 @@ class Decimal: This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. As an exception, the C version may raise InvalidOperation if the second operand cannot be converted exactly. + """ def copy_abs(self) -> Decimal: """Return the absolute value of the argument. This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. + """ def copy_negate(self) -> Decimal: """Return the negation of the argument. This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. + """ def copy_sign(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -476,39 +501,46 @@ class Decimal: This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. As an exception, the C version may raise InvalidOperation if the second operand cannot be converted exactly. + """ def exp(self, context: Context | None = None) -> Decimal: """Return the value of the (natural) exponential function e**x at the given number. The function always uses the ROUND_HALF_EVEN mode and the result is correctly rounded. + """ def is_canonical(self) -> bool: """Return True if the argument is canonical and False otherwise. Currently, a Decimal instance is always canonical, so this operation always returns True. + """ def is_finite(self) -> bool: """Return True if the argument is a finite number, and False if the argument is infinite or a NaN. + """ def is_infinite(self) -> bool: """Return True if the argument is either positive or negative infinity and False otherwise. + """ def is_nan(self) -> bool: """Return True if the argument is a (quiet or signaling) NaN and False otherwise. + """ def is_normal(self, context: Context | None = None) -> bool: """Return True if the argument is a normal finite non-zero number with an adjusted exponent greater than or equal to Emin. Return False if the argument is zero, subnormal, infinite or a NaN. + """ def is_qnan(self) -> bool: @@ -517,6 +549,7 @@ class Decimal: def is_signed(self) -> bool: """Return True if the argument has a negative sign and False otherwise. Note that both zeros and NaNs can carry signs. + """ def is_snan(self) -> bool: @@ -526,21 +559,25 @@ class Decimal: """Return True if the argument is subnormal, and False otherwise. A number is subnormal if it is non-zero, finite, and has an adjusted exponent less than Emin. + """ def is_zero(self) -> bool: """Return True if the argument is a (positive or negative) zero and False otherwise. + """ def ln(self, context: Context | None = None) -> Decimal: """Return the natural (base e) logarithm of the operand. The function always uses the ROUND_HALF_EVEN mode and the result is correctly rounded. + """ def log10(self, context: Context | None = None) -> Decimal: """Return the base ten logarithm of the operand. The function always uses the ROUND_HALF_EVEN mode and the result is correctly rounded. + """ def logb(self, context: Context | None = None) -> Decimal: @@ -548,6 +585,7 @@ class Decimal: Decimal instance. If the operand is a zero, then Decimal('-Infinity') is returned and the DivisionByZero condition is raised. If the operand is an infinity then Decimal('Infinity') is returned. + """ def logical_and(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -565,23 +603,27 @@ class Decimal: def max_mag(self, other: _Decimal, context: Context | None = None) -> Decimal: """Similar to the max() method, but the comparison is done using the absolute values of the operands. + """ def min_mag(self, other: _Decimal, context: Context | None = None) -> Decimal: """Similar to the min() method, but the comparison is done using the absolute values of the operands. + """ def next_minus(self, context: Context | None = None) -> Decimal: """Return the largest number representable in the given context (or in the current default context if no context is given) that is smaller than the given operand. + """ def next_plus(self, context: Context | None = None) -> Decimal: """Return the smallest number representable in the given context (or in the current default context if no context is given) that is larger than the given operand. + """ def next_toward(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -589,6 +631,7 @@ class Decimal: operand in the direction of the second operand. If both operands are numerically equal, return a copy of the first operand with the sign set to be the same as the sign of the second operand. + """ def number_class(self, context: Context | None = None) -> str: @@ -605,11 +648,14 @@ class Decimal: * '+Infinity', indicating that the operand is positive infinity. * 'NaN', indicating that the operand is a quiet NaN (Not a Number). * 'sNaN', indicating that the operand is a signaling NaN. + + """ def radix(self) -> Decimal: """Return Decimal(10), the radix (base) in which the Decimal class does all its arithmetic. Included for compatibility with the specification. + """ def rotate(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -621,12 +667,14 @@ class Decimal: The coefficient of the first operand is padded on the left with zeros to length precision if necessary. The sign and exponent of the first operand are unchanged. + """ def scaleb(self, other: _Decimal, context: Context | None = None) -> Decimal: """Return the first operand with the exponent adjusted the second. Equivalently, return the first operand multiplied by 10**other. The second operand must be an integer. + """ def shift(self, other: _Decimal, context: Context | None = None) -> Decimal: @@ -637,6 +685,7 @@ class Decimal: positive, then the shift is to the left; otherwise the shift is to the right. Digits shifted into the coefficient are zeros. The sign and exponent of the first operand are unchanged. + """ def __reduce__(self) -> tuple[type[Self], tuple[str]]: ... @@ -654,6 +703,8 @@ class Context: ... traps=[InvalidOperation, DivisionByZero, Overflow], ... flags=[]) >>> + + """ # TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime, @@ -696,22 +747,26 @@ class Context: def Etiny(self) -> int: """Return a value equal to Emin - prec + 1, which is the minimum exponent value for subnormal results. When underflow occurs, the exponent is set to Etiny. + """ def Etop(self) -> int: """Return a value equal to Emax - prec + 1. This is the maximum exponent if the _clamp field of the context is set to 1 (IEEE clamp mode). Etop() must not be negative. + """ def create_decimal(self, num: _DecimalNew = "0", /) -> Decimal: """Create a new Decimal instance from num, using self as the context. Unlike the Decimal constructor, this function observes the context limits. + """ def create_decimal_from_float(self, f: float, /) -> Decimal: """Create a new Decimal instance from float f. Unlike the Decimal.from_float() class method, this function observes the context limits. + """ def abs(self, x: _Decimal, /) -> Decimal: @@ -828,6 +883,7 @@ class Context: def minus(self, x: _Decimal, /) -> Decimal: """Minus corresponds to the unary prefix minus operator in Python, but applies the context to the result. + """ def multiply(self, x: _Decimal, y: _Decimal, /) -> Decimal: @@ -851,6 +907,7 @@ class Context: def plus(self, x: _Decimal, /) -> Decimal: """Plus corresponds to the unary prefix plus operator in Python, but applies the context to the result. + """ def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = None) -> Decimal: @@ -867,6 +924,8 @@ class Context: * 'b' must be nonnegative * at least one of 'a' or 'b' must be nonzero * modulo must be nonzero and less than 10**prec in absolute value + + """ def quantize(self, x: _Decimal, y: _Decimal, /) -> Decimal: @@ -878,11 +937,13 @@ class Context: def remainder(self, x: _Decimal, y: _Decimal, /) -> Decimal: """Return the remainder from integer division. The sign of the result, if non-zero, is the same as that of the original dividend. + """ def remainder_near(self, x: _Decimal, y: _Decimal, /) -> Decimal: """Return x - y * n, where n is the integer nearest the exact value of x / y (if the result is 0 then its sign will be the sign of x). + """ def rotate(self, x: _Decimal, y: _Decimal, /) -> Decimal: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/difflib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/difflib.pyi index c359ee340d..7f05a7996e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/difflib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/difflib.pyi @@ -26,6 +26,8 @@ Class HtmlDiff: For producing HTML side by side comparison with change highlights. """ +import re +import sys from collections.abc import Callable, Iterable, Iterator, Sequence from types import GenericAlias from typing import Any, AnyStr, Generic, Literal, NamedTuple, TypeVar, overload @@ -55,7 +57,8 @@ class Match(NamedTuple): size: int class SequenceMatcher(Generic[_T]): - """SequenceMatcher is a flexible class for comparing pairs of sequences of + """ + SequenceMatcher is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are hashable. The basic algorithm predates, and is a little fancier than, an algorithm published in the late 1980's by Ratcliff and Obershelp under the @@ -411,7 +414,8 @@ def get_close_matches( ) -> list[Sequence[_T]]: ... class Differ: - """Differ is a class for comparing sequences of lines of text, and + """ + Differ is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. @@ -496,7 +500,8 @@ class Differ: """ def __init__(self, linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = None) -> None: - """Construct a text differencer, with optional filters. + """ + Construct a text differencer, with optional filters. The two optional keyword parameters are for filter functions: @@ -515,7 +520,8 @@ class Differ: """ def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: - """Compare two sequences of lines; generate the resulting delta. + """ + Compare two sequences of lines; generate the resulting delta. Each sequence must contain individual single-line strings ending with newlines. Such sequences can be obtained from the `readlines()` method @@ -539,21 +545,39 @@ class Differ: + emu """ -def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: # pat is undocumented - """Return True for ignorable line: if `line` is blank or contains a single '#'. +if sys.version_info >= (3, 14): + def IS_LINE_JUNK(line: str, pat: Callable[[str], re.Match[str] | None] | None = None) -> bool: + """ + Return True for ignorable line: if `line` is blank or contains a single '#'. - Examples: + Examples: - >>> IS_LINE_JUNK('\\n') - True - >>> IS_LINE_JUNK(' # \\n') - True - >>> IS_LINE_JUNK('hello\\n') - False - """ + >>> IS_LINE_JUNK('\\n') + True + >>> IS_LINE_JUNK(' # \\n') + True + >>> IS_LINE_JUNK('hello\\n') + False + """ + +else: + def IS_LINE_JUNK(line: str, pat: Callable[[str], re.Match[str] | None] = ...) -> bool: + """ + Return True for ignorable line: iff `line` is blank or contains a single '#'. + + Examples: + + >>> IS_LINE_JUNK('\\n') + True + >>> IS_LINE_JUNK(' # \\n') + True + >>> IS_LINE_JUNK('hello\\n') + False + """ def IS_CHARACTER_JUNK(ch: str, ws: str = " \t") -> bool: # ws is undocumented - """Return True for ignorable character: iff `ch` is a space or tab. + """ + Return True for ignorable character: iff `ch` is a space or tab. Examples: @@ -577,7 +601,8 @@ def unified_diff( n: int = 3, lineterm: str = "\n", ) -> Iterator[str]: - """Compare two sequences of lines; generate the delta as a unified diff. + """ + Compare two sequences of lines; generate the delta as a unified diff. Unified diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which @@ -625,7 +650,8 @@ def context_diff( n: int = 3, lineterm: str = "\n", ) -> Iterator[str]: - """Compare two sequences of lines; generate the delta as a context diff. + """ + Compare two sequences of lines; generate the delta as a context diff. Context diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which @@ -672,7 +698,8 @@ def ndiff( linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = ..., ) -> Iterator[str]: - """Compare `a` and `b` (lists of strings); return a `Differ`-style delta. + """ + Compare `a` and `b` (lists of strings); return a `Differ`-style delta. Optional keyword parameters `linejunk` and `charjunk` are for filter functions, or can be None: @@ -794,7 +821,8 @@ class HtmlDiff: """ def restore(delta: Iterable[str], which: int) -> Iterator[str]: - """Generate one of the two sequences that generated a delta. + """ + Generate one of the two sequences that generated a delta. Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract lines originating from file 1 or 2 (parameter `which`), stripping off line @@ -826,7 +854,8 @@ def diff_bytes( n: int = 3, lineterm: bytes | bytearray = b"\n", ) -> Iterator[bytes]: - """Compare `a` and `b`, two sequences of lines represented as bytes rather + """ + Compare `a` and `b`, two sequences of lines represented as bytes rather than str. This is a wrapper for `dfunc`, which is typically either unified_diff() or context_diff(). Inputs are losslessly converted to strings so that `dfunc` only has to worry about strings, and encoded diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/dis.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/dis.pyi index a219868f3e..af64aa94c6 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/dis.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/dis.pyi @@ -255,6 +255,7 @@ def findlabels(code: _HaveCodeType) -> list[int]: """Detect all offsets in a byte code which are jump targets. Return the list of offsets. + """ def findlinestarts(code: _HaveCodeType) -> Iterator[tuple[int, int]]: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/distutils/command/register.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/distutils/command/register.pyi index 8d655005e9..d7491aa079 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/distutils/command/register.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/distutils/command/register.pyi @@ -52,6 +52,7 @@ class register(PyPIRCCommand): 1. use existing login, 2. register as a new user, or 3. set the password to a random string and email the user. + """ def build_post_data(self, action): ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/distutils/filelist.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/distutils/filelist.pyi index fe6db98b1c..5e450f2547 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/distutils/filelist.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/distutils/filelist.pyi @@ -101,7 +101,8 @@ class FileList: ) -> bool: ... def findall(dir: str = ".") -> list[str]: - """Find all files under 'dir' and return the list of full filenames. + """ + Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/distutils/util.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/distutils/util.pyi index 455821dbba..8a492c6873 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/distutils/util.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/distutils/util.pyi @@ -29,6 +29,7 @@ def get_host_platform() -> str: win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. + """ def get_platform() -> str: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/doctest.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/doctest.pyi index dde78b3bf2..3b12009681 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/doctest.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/doctest.pyi @@ -123,7 +123,8 @@ BLANKLINE_MARKER: str ELLIPSIS_MARKER: str class Example: - """A single doctest example, consisting of source code and expected + """ + A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. @@ -176,7 +177,8 @@ class Example: def __eq__(self, other: object) -> bool: ... class DocTest: - """A collection of doctest examples that should be run in a single + """ + A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. @@ -214,7 +216,8 @@ class DocTest: lineno: int | None, docstring: str | None, ) -> None: - """Create a new DocTest containing the given examples. The + """ + Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. """ @@ -223,10 +226,13 @@ class DocTest: def __eq__(self, other: object) -> bool: ... class DocTestParser: - """A class used to parse strings containing doctest examples.""" + """ + A class used to parse strings containing doctest examples. + """ def parse(self, string: str, name: str = "") -> list[str | Example]: - """Divide the given string into examples and intervening text, + """ + Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only @@ -234,7 +240,8 @@ class DocTestParser: """ def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: - """Extract all doctest examples from the given string, and + """ + Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for @@ -243,7 +250,8 @@ class DocTestParser: """ def get_examples(self, string: str, name: str = "") -> list[Example]: - """Extract all doctest examples from the given string, and return + """ + Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, @@ -254,7 +262,8 @@ class DocTestParser: """ class DocTestFinder: - """A class used to extract the DocTests that are relevant to a given + """ + A class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. Doctests can currently be extracted from the following object types: modules, functions, classes, methods, staticmethods, @@ -264,7 +273,8 @@ class DocTestFinder: def __init__( self, verbose: bool = False, parser: DocTestParser = ..., recurse: bool = True, exclude_empty: bool = True ) -> None: - """Create a new doctest finder. + """ + Create a new doctest finder. The optional argument `parser` specifies a class or function that should be used to create new DocTest objects (or @@ -287,7 +297,8 @@ class DocTestFinder: globs: dict[str, Any] | None = None, extraglobs: dict[str, Any] | None = None, ) -> list[DocTest]: - """Return a list of the DocTests that are defined by the given + """ + Return a list of the DocTests that are defined by the given object's docstring, or by any of its contained objects' docstrings. @@ -318,12 +329,14 @@ class DocTestFinder: defaults to the module's `__dict__`, if specified, or {} otherwise. If `extraglobs` is not specified, then it defaults to {}. + """ _Out: TypeAlias = Callable[[str], object] class DocTestRunner: - """A class used to run DocTest test cases, and accumulate statistics. + """ + A class used to run DocTest test cases, and accumulate statistics. The `run` method is used to process a single DocTest case. It returns a TestResults instance. @@ -393,7 +406,8 @@ class DocTestRunner: skips: int test: DocTest def __init__(self, checker: OutputChecker | None = None, verbose: bool | None = None, optionflags: int = 0) -> None: - """Create a new test runner. + """ + Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual @@ -410,25 +424,32 @@ class DocTestRunner: """ def report_start(self, out: _Out, test: DocTest, example: Example) -> None: - """Report that the test runner is about to process the given + """ + Report that the test runner is about to process the given example. (Only displays a message if verbose=True) """ def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: - """Report that the given example ran successfully. (Only + """ + Report that the given example ran successfully. (Only displays a message if verbose=True) """ def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: - """Report that the given example failed.""" + """ + Report that the given example failed. + """ def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: ExcInfo) -> None: - """Report that the given example raised an unexpected exception.""" + """ + Report that the given example raised an unexpected exception. + """ def run( self, test: DocTest, compileflags: int | None = None, out: _Out | None = None, clear_globs: bool = True ) -> TestResults: - """Run the examples in `test`, and display the results using the + """ + Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If @@ -448,7 +469,8 @@ class DocTestRunner: """ def summarize(self, verbose: bool | None = None) -> TestResults: - """Print a summary of all the test cases that have been run by + """ + Print a summary of all the test cases that have been run by this DocTestRunner, and return a TestResults instance. The optional `verbose` argument controls how detailed the @@ -459,7 +481,8 @@ class DocTestRunner: def merge(self, other: DocTestRunner) -> None: ... class OutputChecker: - """A class used to check whether the actual output from a doctest + """ + A class used to check whether the actual output from a doctest example matches the expected output. `OutputChecker` defines two methods: `check_output`, which compares a given pair of outputs, and returns true if they match; and `output_difference`, which @@ -467,7 +490,8 @@ class OutputChecker: """ def check_output(self, want: str, got: str, optionflags: int) -> bool: - """Return True iff the actual output from an example (`got`) + """ + Return True iff the actual output from an example (`got`) matches the expected output (`want`). These strings are always considered to match if they are identical; but depending on what option flags the test runner is using, @@ -477,7 +501,8 @@ class OutputChecker: """ def output_difference(self, example: Example, got: str, optionflags: int) -> str: - """Return a string describing the differences between the + """ + Return a string describing the differences between the expected output for a given example (`example`) and the actual output (`got`). `optionflags` is the set of option flags used to compare `want` and `got`. @@ -605,6 +630,7 @@ class DebugRunner(DocTestRunner): >>> test.globs {} + """ master: DocTestRunner | None @@ -628,8 +654,8 @@ def testmod( from module m (or the current module if m is not supplied), starting with m.__doc__. - Also test examples reachable from dict m.__test__ if it exists and is - not None. m.__test__ maps names to functions, classes and strings; + Also test examples reachable from dict m.__test__ if it exists. + m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. @@ -698,7 +724,8 @@ def testfile( parser: DocTestParser = ..., encoding: str | None = None, ) -> TestResults: - """Test examples in the given file. Return (#failures, #tests). + """ + Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: @@ -782,7 +809,8 @@ def run_docstring_examples( compileflags: int | None = None, optionflags: int = 0, ) -> None: - """Test examples in the given object's docstring (`f`), using `globs` + """ + Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. @@ -852,7 +880,8 @@ def DocTestSuite( test_finder: DocTestFinder | None = None, **options: Any, ) -> _DocTestSuite: - """Convert doctest tests for a module to a unittest test suite. + """ + Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/_header_value_parser.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/_header_value_parser.pyi index 2ffff726a1..f7c23cf676 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/_header_value_parser.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/_header_value_parser.pyi @@ -427,6 +427,7 @@ def get_fws(value: str) -> tuple[WhiteSpaceTerminal, str]: This isn't the RFC definition. We're using fws to represent tokens where folding can be done, but when we are parsing the *un*folding has already been done so we don't need to watch out for CRLF. + """ def get_encoded_word(value: str, terminal_type: str = "vtext") -> tuple[EncodedWord, str]: @@ -449,6 +450,7 @@ def get_unstructured(value: str) -> UnstructuredTokenList: Because an 'unstructured' value must by definition constitute the entire value, this 'get' routine does not return a remaining value, only the parsed TokenList. + """ def get_qp_ctext(value: str) -> tuple[WhiteSpaceTerminal, str]: @@ -461,6 +463,7 @@ def get_qp_ctext(value: str) -> tuple[WhiteSpaceTerminal, str]: quoted pairs are converted to their unquoted values, what is returned is a 'ptext' token. In this case it is a WhiteSpaceTerminal, so it's value is ' '. + """ def get_qcontent(value: str) -> tuple[ValueTerminal, str]: @@ -471,6 +474,7 @@ def get_qcontent(value: str) -> tuple[ValueTerminal, str]: added to the token's defects list. Any quoted pairs are converted to their unquoted values, so what is returned is a 'ptext' token. In this case it is a ValueTerminal. + """ def get_atext(value: str) -> tuple[ValueTerminal, str]: @@ -536,6 +540,7 @@ def get_word(value: str) -> tuple[Any, str]: This means the 'word' level of the formal grammar is not represented in the parse tree; this is because having that extra layer when manipulating the parse tree is more confusing than it is helpful. + """ def get_phrase(value: str) -> tuple[Phrase, str]: @@ -548,6 +553,7 @@ def get_phrase(value: str) -> tuple[Phrase, str]: list. We also accept a phrase that starts with CFWS followed by a dot; this is registered as an InvalidHeaderDefect, since it is not supported by even the obsolete grammar. + """ def get_local_part(value: str) -> tuple[LocalPart, str]: @@ -566,6 +572,7 @@ def get_dtext(value: str) -> tuple[ValueTerminal, str]: unquoted values, so what is returned is a ptext token, in this case a ValueTerminal. If there were quoted-printables, an ObsoleteHeaderDefect is added to the returned token's defect list. + """ def get_domain_literal(value: str) -> tuple[DomainLiteral, str]: @@ -574,6 +581,7 @@ def get_domain_literal(value: str) -> tuple[DomainLiteral, str]: def get_domain(value: str) -> tuple[Domain, str]: """domain = dot-atom / domain-literal / obs-domain obs-domain = atom *("." atom)) + """ def get_addr_spec(value: str) -> tuple[AddrSpec, str]: @@ -590,6 +598,7 @@ def get_obs_route(value: str) -> tuple[ObsRoute, str]: def get_angle_addr(value: str) -> tuple[AngleAddr, str]: """angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS] + """ def get_display_name(value: str) -> tuple[DisplayName, str]: @@ -598,6 +607,7 @@ def get_display_name(value: str) -> tuple[DisplayName, str]: Because this is simply a name-rule, we don't return a display-name token containing a phrase, but rather a display-name token with the content of the phrase. + """ def get_name_addr(value: str) -> tuple[NameAddr, str]: @@ -611,6 +621,7 @@ def get_invalid_mailbox(value: str, endchars: str) -> tuple[InvalidMailbox, str] This is outside the formal grammar. The InvalidMailbox TokenList that is returned acts like a Mailbox, but the data attributes are None. + """ def get_mailbox_list(value: str) -> tuple[MailboxList, str]: @@ -623,11 +634,13 @@ def get_mailbox_list(value: str) -> tuple[MailboxList, str]: invalid mailboxes into InvalidMailbox tokens and continue parsing any remaining valid mailboxes. We also allow all mailbox entries to be null, and this condition is handled appropriately at a higher level. + """ def get_group_list(value: str) -> tuple[GroupList, str]: """group-list = mailbox-list / CFWS / obs-group-list obs-group-list = 1*([CFWS] ",") [CFWS] + """ def get_group(value: str) -> tuple[Group, str]: @@ -641,6 +654,7 @@ def get_address(value: str) -> tuple[Address, str]: a 'mailboxes' attribute which treats a single address as a list of length one. When you need to differentiate between to two cases, extract the single element, which is either a mailbox or a group token. + """ def get_address_list(value: str) -> tuple[AddressList, str]: @@ -651,6 +665,7 @@ def get_address_list(value: str) -> tuple[AddressList, str]: of the input, assuming the input to be entirely composed of an address-list. This is always true in email parsing, and allows us to skip invalid addresses to parse additional valid ones. + """ def get_no_fold_literal(value: str) -> tuple[NoFoldLiteral, str]: @@ -674,6 +689,7 @@ def get_invalid_parameter(value: str) -> tuple[InvalidParameter, str]: This is outside the formal grammar. The InvalidParameter TokenList that is returned acts like a Parameter, but the data attributes are None. + """ def get_ttext(value: str) -> tuple[ValueTerminal, str]: @@ -683,6 +699,7 @@ def get_ttext(value: str) -> tuple[ValueTerminal, str]: defects list if we find non-ttext characters. We also register defects for *any* non-printables even though the RFC doesn't exclude all of them, because we follow the spirit of RFC 5322. + """ def get_token(value: str) -> tuple[Token, str]: @@ -692,6 +709,7 @@ def get_token(value: str) -> tuple[Token, str]: tspecials. We also exclude tabs even though the RFC doesn't. The RFC implies the CFWS but is not explicit about it in the BNF. + """ def get_attrtext(value: str) -> tuple[ValueTerminal, str]: @@ -701,6 +719,7 @@ def get_attrtext(value: str) -> tuple[ValueTerminal, str]: token's defects list if we find non-attrtext characters. We also register defects for *any* non-printables even though the RFC doesn't exclude all of them, because we follow the spirit of RFC 5322. + """ def get_attribute(value: str) -> tuple[Attribute, str]: @@ -710,6 +729,7 @@ def get_attribute(value: str) -> tuple[Attribute, str]: value terminal for the actual run of characters. The RFC equivalent of attrtext is the token characters, with the subtraction of '*', "'", and '%'. We include tab in the excluded set just as we do for token. + """ def get_extended_attrtext(value: str) -> tuple[ValueTerminal, str]: @@ -718,6 +738,7 @@ def get_extended_attrtext(value: str) -> tuple[ValueTerminal, str]: This is a special parsing routine so that we get a value that includes % escapes as a single string (which we decode as a single string later). + """ def get_extended_attribute(value: str) -> tuple[Attribute, str]: @@ -725,6 +746,7 @@ def get_extended_attribute(value: str) -> tuple[Attribute, str]: This is like the non-extended version except we allow % characters, so that we can pick up an encoded value as a single string. + """ def get_section(value: str) -> tuple[Section, str]: @@ -734,6 +756,7 @@ def get_section(value: str) -> tuple[Section, str]: check for that and add a defect. We also assume no CFWS is allowed between the '*' and the digits, though the RFC is not crystal clear on that. The caller should already have dealt with leading CFWS. + """ def get_value(value: str) -> tuple[Value, str]: @@ -759,6 +782,7 @@ def parse_mime_parameters(value: str) -> MimeParameters: This is 'parse' routine because it consumes the remaining value, but it would never be called to parse a full header. Instead it is called to parse everything after the non-parameter value of a specific MIME header. + """ def parse_content_type_header(value: str) -> ContentType: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/_policybase.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/_policybase.pyi index 458f2cbe24..de41124c98 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/_policybase.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/_policybase.pyi @@ -41,6 +41,7 @@ class _PolicyBase(Generic[_MessageT_co]): The repr of an instance can be used to reconstruct the object if and only if the repr of the values can be used to reconstruct those values. + """ max_line_length: int | None @@ -67,6 +68,7 @@ class _PolicyBase(Generic[_MessageT_co]): """Create new Policy, possibly overriding some defaults. See class docstring for a list of overridable attributes. + """ def clone( @@ -85,12 +87,14 @@ class _PolicyBase(Generic[_MessageT_co]): The new instance has the same attribute values as the current object, except for the changes passed in as keyword arguments. + """ def __add__(self, other: Policy) -> Self: """Non-default values from right operand override those from left. The object returned is a new instance of the subclass. + """ class Policy(_PolicyBase[_MessageT_co], metaclass=ABCMeta): @@ -164,6 +168,7 @@ class Policy(_PolicyBase[_MessageT_co], metaclass=ABCMeta): This method is intended to be called by parsers that discover defects. The email package parsers always call it with Defect instances. + """ def register_defect(self, obj: Message[Any, Any], defect: MessageDefect) -> None: @@ -175,6 +180,7 @@ class Policy(_PolicyBase[_MessageT_co], metaclass=ABCMeta): the defects attribute of obj. The objects used by the email package by default that get passed to this method will always have a defects attribute with an append method. + """ def header_max_count(self, name: str) -> int | None: @@ -217,6 +223,7 @@ class Policy(_PolicyBase[_MessageT_co], metaclass=ABCMeta): header. The value passed in by the email package may contain surrogateescaped binary data if the lines were parsed by a BytesParser. The returned value should not contain any surrogateescaped data. + """ @abstractmethod @@ -227,6 +234,7 @@ class Policy(_PolicyBase[_MessageT_co], metaclass=ABCMeta): package may contain surrogateescaped binary data if the lines were parsed by a BytesParser. The returned value should not contain any surrogateescaped data. + """ @abstractmethod @@ -235,6 +243,7 @@ class Policy(_PolicyBase[_MessageT_co], metaclass=ABCMeta): data containing linesep characters that implement the folding of the header according to the policy controls. The value passed in by the email package may contain surrogateescaped binary data. + """ class Compat32(Policy[_MessageT_co]): @@ -305,6 +314,7 @@ class Compat32(Policy[_MessageT_co]): The value is determined by stripping leading whitespace off the remainder of the first line joined with all subsequent lines, and stripping any trailing carriage return or linefeed characters. + """ def header_store_parse(self, name: str, value: str) -> tuple[str, str]: @@ -336,6 +346,7 @@ class Compat32(Policy[_MessageT_co]): existing line breaks in the value, and wraps each resulting line to the max_line_length. Non-ASCII binary data are CTE encoded using the unknown-8bit charset. + """ def fold_binary(self, name: str, value: str) -> bytes: @@ -349,6 +360,7 @@ class Compat32(Policy[_MessageT_co]): max_line_length. If cte_type is 7bit, non-ascii binary data is CTE encoded using the unknown-8bit charset. Otherwise the original source header is used, with its existing line breaks and/or binary data. + """ compat32: Compat32[Message[str, str]] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/feedparser.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/feedparser.pyi index 5a184b0d85..aedb2f6c2c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/feedparser.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/feedparser.pyi @@ -33,6 +33,7 @@ class FeedParser(Generic[_MessageT]): The policy keyword specifies a policy object that controls a number of aspects of the parser's operation. The default policy maintains backward compatibility. + """ @overload @@ -53,6 +54,7 @@ class BytesFeedParser(FeedParser[_MessageT]): The policy keyword specifies a policy object that controls a number of aspects of the parser's operation. The default policy maintains backward compatibility. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/generator.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/generator.pyi index 2381a7edd0..9d1f405ee2 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/generator.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/generator.pyi @@ -49,6 +49,7 @@ class Generator(Generic[_MessageT]): aspects of the generator's operation. If no policy is specified, the policy associated with the Message object passed to the flatten method is used. + """ @overload @@ -76,6 +77,7 @@ class Generator(Generic[_MessageT]): the output. The default value is determined by the policy specified when the Generator instance was created or, if none was specified, from the policy associated with the msg. + """ def clone(self, fp: SupportsWrite[str]) -> Self: @@ -123,6 +125,7 @@ class BytesGenerator(Generator[_MessageT]): aspects of the generator's operation. If no policy is specified, the policy associated with the Message object passed to the flatten method is used. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/headerregistry.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/headerregistry.pyi index 9297c83dda..2b1e0d615f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/headerregistry.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/headerregistry.pyi @@ -52,6 +52,7 @@ class BaseHeader(str): The subclass should also make sure that a 'max_count' attribute is defined that is either None or 1. XXX: need to better define this API. + """ # max_count is actually more of an abstract ClassVar (not defined on the base class, but expected to be defined in subclasses) @@ -76,6 +77,7 @@ class BaseHeader(str): The returned value is an ASCII-only string possibly containing linesep characters, and ending with a linesep character. The string includes the header name and the ': ' separator. + """ class UnstructuredHeader: @@ -98,6 +100,7 @@ class UnstructuredHeader: Because an 'unstructured' value must by definition constitute the entire value, this 'get' routine does not return a remaining value, only the parsed TokenList. + """ @classmethod @@ -138,6 +141,7 @@ class DateHeader: Because an 'unstructured' value must by definition constitute the entire value, this 'get' routine does not return a remaining value, only the parsed TokenList. + """ @classmethod @@ -268,6 +272,7 @@ class HeaderRegistry: use_default_map controls whether or not the default mapping of names to specialized classes is copied in to the registry when the factory is created. The default is True. + """ def map_to_type(self, name: str, cls: type[BaseHeader]) -> None: @@ -282,6 +287,7 @@ class HeaderRegistry: base_class with a specialized class from the registry or the default_class, and passing the name and value to the constructed class's constructor. + """ class Address: @@ -313,6 +319,7 @@ class Address: attributes, all of which are read-only. The addr_spec and the string value of the object are both quoted according to RFC5322 rules, but without any Content Transfer Encoding. + """ __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... @@ -335,6 +342,7 @@ class Group: string representation of a Group whose display_name is None is the same as the Address object, if there is one and only one Address object in the addresses list. + """ __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/message.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/message.pyi index 812a9f8827..a67f17fd64 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/message.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/message.pyi @@ -332,6 +332,7 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]): rawparam = msg.get_param('foo') param = email.utils.collapse_rfc2231_value(rawparam) + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/parser.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/parser.pyi index 9afe54af8e..2cbc3f0218 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/parser.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/parser.pyi @@ -32,6 +32,7 @@ class Parser(Generic[_MessageT]): The policy keyword specifies a policy object that controls a number of aspects of the parser's operation. The default policy maintains backward compatibility. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/policy.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/policy.pyi index c00e048e08..14c5bda44c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/policy.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/policy.pyi @@ -119,6 +119,7 @@ class EmailPolicy(Policy[_MessageT]): it as additional arguments. The default content_manager is :data:`~email.contentmanager.raw_data_manager`. + """ utf8: bool @@ -170,6 +171,7 @@ class EmailPolicy(Policy[_MessageT]): remainder of the first line joined with all subsequent lines, and stripping any trailing carriage return or linefeed characters. (This is the same as Compat32). + """ def header_store_parse(self, name: str, value: Any) -> tuple[str, Any]: @@ -181,6 +183,7 @@ class EmailPolicy(Policy[_MessageT]): method, and the resulting custom header object is returned as the value. In this case a ValueError is raised if the input value contains CR or LF characters. + """ def header_fetch_parse(self, name: str, value: str) -> Any: @@ -195,6 +198,7 @@ class EmailPolicy(Policy[_MessageT]): are passed to the header_factory method, and the resulting custom header object is returned. Any surrogateescaped bytes get turned into the unicode unknown-character glyph. + """ def fold(self, name: str, value: str) -> Any: @@ -220,6 +224,7 @@ class EmailPolicy(Policy[_MessageT]): binary data. In that case the value is refolded regardless of the refold_source setting, which causes the binary data to be CTE encoded using the unknown-8bit charset. + """ def fold_binary(self, name: str, value: str) -> bytes: @@ -238,6 +243,7 @@ class EmailPolicy(Policy[_MessageT]): If utf8 is true, headers are encoded to utf8, otherwise to ascii with non-ASCII unicode rendered as encoded words. + """ def clone( @@ -260,6 +266,7 @@ class EmailPolicy(Policy[_MessageT]): The new instance has the same attribute values as the current object, except for the changes passed in as keyword arguments. + """ default: EmailPolicy[EmailMessage] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/quoprimime.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/quoprimime.pyi index 7bb864bef7..7bdd774117 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/quoprimime.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/quoprimime.pyi @@ -94,6 +94,7 @@ def body_encode(body: str, maxlinelen: int = 76, eol: str = "\n") -> str: The minimum maxlinelen is 4 to have room for a quoted character ("=XX") followed by a soft line break. Smaller values will generate a ValueError. + """ def decode(encoded: str, eol: str = "\n") -> str: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/email/utils.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/email/utils.pyi index 05cd193288..009e95f2a8 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/email/utils.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/email/utils.pyi @@ -42,7 +42,8 @@ def unquote(str: str) -> str: # `strict` parameter added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5 def parseaddr(addr: str | list[str], *, strict: bool = True) -> tuple[str, str]: - """Parse addr into its constituent realname and email address parts. + """ + Parse addr into its constituent realname and email address parts. Return a tuple of realname and email address, unless the parse fails, in which case return a 2-tuple of ('', ''). @@ -135,6 +136,7 @@ if sys.version_info >= (3, 14): argument should be a datetime instance, and it is converted to the local time zone according to the system time zone database. If *dt* is naive (that is, dt.tzinfo is None), it is assumed to be in local time. + """ elif sys.version_info >= (3, 12): @@ -147,6 +149,7 @@ elif sys.version_info >= (3, 12): local time zone according to the system time zone database. If *dt* is naive (that is, dt.tzinfo is None), it is assumed to be in local time. The isdst parameter is ignored. + """ @overload @@ -166,6 +169,7 @@ else: is or is not (respectively) in effect for the specified time. A negative value for *isdst* causes the localtime() function to attempt to divine whether summer time is in effect for the specified time. + """ def make_msgid(idstring: str | None = None, domain: str | None = None) -> str: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/encodings/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/encodings/__init__.pyi index 48d2b5ea13..c45ae99601 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/encodings/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/encodings/__init__.pyi @@ -41,6 +41,7 @@ def normalize_encoding(encoding: str | bytes) -> str: becomes '_'. Leading and trailing underscores are removed. Note that encoding names should be ASCII only. + """ def search_function(encoding: str) -> CodecInfo | None: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ensurepip/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ensurepip/__init__.pyi index 84910ee849..c203a2e65b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ensurepip/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ensurepip/__init__.pyi @@ -1,7 +1,9 @@ __all__ = ["version", "bootstrap"] def version() -> str: - """Returns a string specifying the bundled version of pip.""" + """ + Returns a string specifying the bundled version of pip. + """ def bootstrap( *, @@ -12,7 +14,8 @@ def bootstrap( default_pip: bool = False, verbosity: int = 0, ) -> None: - """Bootstrap pip into the current Python installation (or the given root + """ + Bootstrap pip into the current Python installation (or the given root directory). Note that calling this function will alter both sys.path and os.environ. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/enum.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/enum.pyi index 3be379222c..2258926c91 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/enum.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/enum.pyi @@ -57,19 +57,24 @@ _Signature: TypeAlias = Any # TODO: Unable to import Signature from inspect mod if sys.version_info >= (3, 11): class nonmember(Generic[_EnumMemberT]): - """Protects item from becoming an Enum member during class creation.""" + """ + Protects item from becoming an Enum member during class creation. + """ value: _EnumMemberT def __init__(self, value: _EnumMemberT) -> None: ... class member(Generic[_EnumMemberT]): - """Forces item to become an Enum member during class creation.""" + """ + Forces item to become an Enum member during class creation. + """ value: _EnumMemberT def __init__(self, value: _EnumMemberT) -> None: ... class _EnumDict(dict[str, Any]): - """Track enum member order and ensure member names are not reused. + """ + Track enum member order and ensure member names are not reused. EnumType will use the names found in self._member_names as the enumeration member names. @@ -81,7 +86,8 @@ class _EnumDict(dict[str, Any]): def __init__(self) -> None: ... def __setitem__(self, key: str, value: Any) -> None: - """Changes anything not dundered or not a descriptor. + """ + Changes anything not dundered or not a descriptor. If an enum member name is used twice, an error is raised; duplicate values are not checked for. @@ -107,7 +113,9 @@ if sys.version_info >= (3, 13): # Structurally: Iterable[T], Reversible[T], Container[T] where T is the enum itself class EnumMeta(type): - """Metaclass for Enum""" + """ + Metaclass for Enum + """ if sys.version_info >= (3, 11): def __new__( @@ -128,10 +136,14 @@ class EnumMeta(type): @classmethod def __prepare__(metacls, cls: str, bases: tuple[type, ...], **kwds: Any) -> _EnumDict: ... # type: ignore[override] def __iter__(self: type[_EnumMemberT]) -> Iterator[_EnumMemberT]: - """Return members in definition order.""" + """ + Return members in definition order. + """ def __reversed__(self: type[_EnumMemberT]) -> Iterator[_EnumMemberT]: - """Return members in reverse definition order.""" + """ + Return members in reverse definition order. + """ if sys.version_info >= (3, 12): def __contains__(self: type[Any], value: object) -> bool: """Return True if `value` is in `cls`. @@ -143,7 +155,8 @@ class EnumMeta(type): """ elif sys.version_info >= (3, 11): def __contains__(self: type[Any], member: object) -> bool: - """Return True if member is a member of this enum + """ + Return True if member is a member of this enum raises TypeError if member is not an enum member note: in 3.12 TypeError will no longer be raised, and True will also be @@ -155,28 +168,36 @@ class EnumMeta(type): def __contains__(self: type[Any], member: object) -> bool: ... def __getitem__(self: type[_EnumMemberT], name: str) -> _EnumMemberT: - """Return the member matching `name`.""" + """ + Return the member matching `name`. + """ @_builtins_property def __members__(self: type[_EnumMemberT]) -> types.MappingProxyType[str, _EnumMemberT]: - """Returns a mapping of member name->value. + """ + Returns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping. """ def __len__(self) -> int: - """Return the number of members (no aliases)""" + """ + Return the number of members (no aliases) + """ def __bool__(self) -> Literal[True]: - """classes/types should always be True.""" + """ + classes/types should always be True. + """ def __dir__(self) -> list[str]: ... # Overload 1: Value lookup on an already existing enum class (simple case) @overload def __call__(cls: type[_EnumMemberT], value: Any, names: None = None) -> _EnumMemberT: - """Either returns an existing member, or creates a new enum class. + """ + Either returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API @@ -215,7 +236,8 @@ class EnumMeta(type): start: int = 1, boundary: FlagBoundary | None = None, ) -> type[Enum]: - """Either returns an existing member, or creates a new enum class. + """ + Either returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API @@ -252,7 +274,8 @@ class EnumMeta(type): type: type | None = None, start: int = 1, ) -> type[Enum]: - """Either returns an existing member, or creates a new enum class. + """ + Either returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API @@ -285,7 +308,8 @@ class EnumMeta(type): if sys.version_info >= (3, 12): @overload def __call__(cls: type[_EnumMemberT], value: Any, *values: Any) -> _EnumMemberT: - """Either returns an existing member, or creates a new enum class. + """ + Either returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API @@ -323,7 +347,8 @@ if sys.version_info >= (3, 11): EnumType = EnumMeta class property(types.DynamicClassAttribute): - """This is a descriptor, used to define attributes that act differently + """ + This is a descriptor, used to define attributes that act differently when accessed through an enum member and through an enum class. Instance access is the same as property(), but access to an attribute through the enum class will instead look in the class' _member_map_ for @@ -340,7 +365,8 @@ else: _magic_enum_attr = types.DynamicClassAttribute class Enum(metaclass=EnumMeta): - """Create a collection of name/value pairs. + """ + Create a collection of name/value pairs. Example enumeration: @@ -394,7 +420,8 @@ class Enum(metaclass=EnumMeta): def _missing_(cls, value: object) -> Any: ... @staticmethod def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any: - """Generate the next value when not given. + """ + Generate the next value when not given. name: the name of the member start: the initial start value or None @@ -408,11 +435,15 @@ class Enum(metaclass=EnumMeta): # and in practice using `object` here has the same effect as using `Any`. def __new__(cls, value: object) -> Self: ... def __dir__(self) -> list[str]: - """Returns public methods and other interesting attributes.""" + """ + Returns public methods and other interesting attributes. + """ def __hash__(self) -> int: ... def __format__(self, format_spec: str) -> str: - """Returns format using actual value type unless __str__ has been overridden.""" + """ + Returns format using actual value type unless __str__ has been overridden. + """ def __reduce_ex__(self, proto: Unused) -> tuple[Any, ...]: ... if sys.version_info >= (3, 11): @@ -429,7 +460,9 @@ class Enum(metaclass=EnumMeta): if sys.version_info >= (3, 11): class ReprEnum(Enum): - """Only changes the repr(), leaving str() and format() to the mixed-in type.""" + """ + Only changes the repr(), leaving str() and format() to the mixed-in type. + """ if sys.version_info >= (3, 11): _IntEnumBase = ReprEnum @@ -437,7 +470,9 @@ else: _IntEnumBase = Enum class IntEnum(int, _IntEnumBase): - """Enum where members are also (and must be) ints""" + """ + Enum where members are also (and must be) ints + """ _value_: int @_magic_enum_attr @@ -447,12 +482,16 @@ class IntEnum(int, _IntEnumBase): def __new__(cls, value: int) -> Self: ... def unique(enumeration: _EnumerationT) -> _EnumerationT: - """Class decorator for enumerations ensuring unique member values.""" + """ + Class decorator for enumerations ensuring unique member values. + """ _auto_null: Any class Flag(Enum): - """Support for flags""" + """ + Support for flags + """ _name_: str | None # type: ignore[assignment] _value_: int @@ -465,7 +504,9 @@ class Flag(Enum): """The value of the Enum member.""" def __contains__(self, other: Self) -> bool: - """Returns True if self has at least the same flags set as other.""" + """ + Returns True if self has at least the same flags set as other. + """ def __bool__(self) -> bool: ... def __or__(self, other: Self) -> Self: ... @@ -474,7 +515,9 @@ class Flag(Enum): def __invert__(self) -> Self: ... if sys.version_info >= (3, 11): def __iter__(self) -> Iterator[Self]: - """Returns flags in definition order.""" + """ + Returns flags in definition order. + """ def __len__(self) -> int: ... __ror__ = __or__ @@ -483,7 +526,9 @@ class Flag(Enum): if sys.version_info >= (3, 11): class StrEnum(str, ReprEnum): - """Enum where members are also (and must be) strings""" + """ + Enum where members are also (and must be) strings + """ def __new__(cls, value: str) -> Self: ... _value_: str @@ -493,10 +538,14 @@ if sys.version_info >= (3, 11): @staticmethod def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str: - """Return the lower-cased version of the member name.""" + """ + Return the lower-cased version of the member name. + """ class EnumCheck(StrEnum): - """various conditions to check an enumeration for""" + """ + various conditions to check an enumeration for + """ CONTINUOUS = "no skipped integer values" NAMED_FLAGS = "multi-flag aliases may not contain unnamed flags" @@ -507,13 +556,16 @@ if sys.version_info >= (3, 11): UNIQUE = EnumCheck.UNIQUE class verify: - """Check an enumeration for various constraints. (see EnumCheck)""" + """ + Check an enumeration for various constraints. (see EnumCheck) + """ def __init__(self, *checks: EnumCheck) -> None: ... def __call__(self, enumeration: _EnumerationT) -> _EnumerationT: ... class FlagBoundary(StrEnum): - """control how out of range values are handled + """ + control how out of range values are handled "strict" -> error is raised [default for Flag] "conform" -> extra bits are discarded "eject" -> lose flag status @@ -531,22 +583,27 @@ if sys.version_info >= (3, 11): KEEP = FlagBoundary.KEEP def global_str(self: Enum) -> str: - """use enum_name instead of class.enum_name""" + """ + use enum_name instead of class.enum_name + """ def global_enum(cls: _EnumerationT, update_str: bool = False) -> _EnumerationT: - """decorator that makes the repr() of an enum member reference its module + """ + decorator that makes the repr() of an enum member reference its module instead of its class; also exports all members to the enum's module's global namespace """ def global_enum_repr(self: Enum) -> str: - """use module.enum_name instead of class.enum_name + """ + use module.enum_name instead of class.enum_name the module is the last module in case of a multi-module name """ def global_flag_repr(self: Flag) -> str: - """use module.flag_name instead of class.flag_name + """ + use module.flag_name instead of class.flag_name the module is the last module in case of a multi-module name """ @@ -554,7 +611,9 @@ if sys.version_info >= (3, 11): if sys.version_info >= (3, 11): # The body of the class is the same, but the base classes are different. class IntFlag(int, ReprEnum, Flag, boundary=KEEP): # type: ignore[misc] # complaints about incompatible bases - """Support for integer-based Flags""" + """ + Support for integer-based Flags + """ def __new__(cls, value: int) -> Self: ... def __or__(self, other: int) -> Self: ... @@ -567,7 +626,9 @@ if sys.version_info >= (3, 11): else: class IntFlag(int, Flag): # type: ignore[misc] # complaints about incompatible bases - """Support for integer-based Flags""" + """ + Support for integer-based Flags + """ def __new__(cls, value: int) -> Self: ... def __or__(self, other: int) -> Self: ... @@ -579,17 +640,13 @@ else: __rxor__ = __xor__ class auto: - """Instances are replaced with an appropriate value in Enum class suites.""" + """ + Instances are replaced with an appropriate value in Enum class suites. + """ _value_: Any @_magic_enum_attr - def value(self) -> Any: - """The base class of the class hierarchy. - - When called, it accepts no arguments and returns a new featureless - instance that has no instance attributes and cannot be given any. - """ - + def value(self) -> Any: ... def __new__(cls) -> Self: ... # These don't exist, but auto is basically immediately replaced with diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/filecmp.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/filecmp.pyi index 520c8654b5..ddcce673d1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/filecmp.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/filecmp.pyi @@ -41,6 +41,7 @@ def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: bool | Literal[0, 1] = This function uses a cache for past comparisons and the results, with cache entries invalidated if their stat information changes. The cache may be cleared by calling clear_cache(). + """ def cmpfiles( @@ -56,6 +57,7 @@ def cmpfiles( files that compare equal files that are different filenames that aren't regular files. + """ class dircmp(Generic[AnyStr]): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/fileinput.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/fileinput.pyi index 38a3653dc4..9959c68f10 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/fileinput.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/fileinput.pyi @@ -69,7 +69,7 @@ import sys from _typeshed import AnyStr_co, StrOrBytesPath from collections.abc import Callable, Iterable from types import GenericAlias, TracebackType -from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload +from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload, type_check_only from typing_extensions import Self, TypeAlias __all__ = [ @@ -92,6 +92,7 @@ if sys.version_info >= (3, 11): else: _TextMode: TypeAlias = Literal["r", "rU", "U"] +@type_check_only class _HasReadlineAndFileno(Protocol[AnyStr_co]): def readline(self) -> AnyStr_co: ... def fileno(self) -> int: ... @@ -180,7 +181,8 @@ def close() -> None: """Close the sequence.""" def nextfile() -> None: - """Close the current file so that the next iteration will read the first + """ + Close the current file so that the next iteration will read the first line from the next file (if any); lines not read from the file will not count towards the cumulative line count. The filename is not changed until after the first line of the next file has been read. @@ -190,34 +192,40 @@ def nextfile() -> None: """ def filename() -> str: - """Return the name of the file currently being read. + """ + Return the name of the file currently being read. Before the first line has been read, returns None. """ def lineno() -> int: - """Return the cumulative line number of the line that has just been read. + """ + Return the cumulative line number of the line that has just been read. Before the first line has been read, returns 0. After the last line of the last file has been read, returns the line number of that line. """ def filelineno() -> int: - """Return the line number in the current file. Before the first line + """ + Return the line number in the current file. Before the first line has been read, returns 0. After the last line of the last file has been read, returns the line number of that line within the file. """ def fileno() -> int: - """Return the file number of the current file. When no file is currently + """ + Return the file number of the current file. When no file is currently opened, returns -1. """ def isfirstline() -> bool: - """Returns true the line just read is the first line of its file, + """ + Returns true the line just read is the first line of its file, otherwise returns false. """ def isstdin() -> bool: - """Returns true if the last line was read from sys.stdin, + """ + Returns true if the last line was read from sys.stdin, otherwise returns false. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/formatter.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/formatter.pyi index bc11eaec5a..56176d6dea 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/formatter.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/formatter.pyi @@ -34,6 +34,7 @@ class NullFormatter: Implementations should inherit from this class if implementing a writer interface but don't need to inherit any implementation. + """ writer: NullWriter | None @@ -62,6 +63,7 @@ class AbstractFormatter: This implementation has demonstrated wide applicability to many writers, and may be used directly in most circumstances. It has been used to implement a full-featured World Wide Web browser. + """ writer: NullWriter @@ -105,6 +107,7 @@ class NullWriter: A writer which only provides the interface definition; no actions are taken on any methods. This should be the base class for all writers which do not need to inherit any implementation methods. + """ def flush(self) -> None: ... @@ -125,6 +128,7 @@ class AbstractWriter(NullWriter): Each method simply announces itself by printing its name and arguments on standard output. + """ class DumbWriter(NullWriter): @@ -133,6 +137,7 @@ class DumbWriter(NullWriter): output is simply word-wrapped to the number of columns specified by the maxcol parameter. This class is suitable for reflowing a sequence of paragraphs. + """ file: IO[str] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/fractions.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/fractions.pyi index 75638a871f..7175a93952 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/fractions.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/fractions.pyi @@ -4,13 +4,14 @@ import sys from collections.abc import Callable from decimal import Decimal from numbers import Rational, Real -from typing import Any, Literal, Protocol, SupportsIndex, overload +from typing import Any, Literal, Protocol, SupportsIndex, overload, type_check_only from typing_extensions import Self, TypeAlias _ComparableNum: TypeAlias = int | float | Decimal | Real __all__ = ["Fraction"] +@type_check_only class _ConvertibleToIntegerRatio(Protocol): def as_integer_ratio(self) -> tuple[int | Rational, int | Rational]: ... @@ -32,6 +33,7 @@ class Fraction(Rational): - float and Decimal instances - other Rational instances (including integers) + """ @overload @@ -64,6 +66,7 @@ class Fraction(Rational): Fraction(9, 4) >>> Fraction(Decimal('1.47')) Fraction(147, 100) + """ @overload @@ -100,6 +103,7 @@ class Fraction(Rational): Fraction(9, 4) >>> Fraction(Decimal('1.47')) Fraction(147, 100) + """ @classmethod @@ -107,6 +111,7 @@ class Fraction(Rational): """Converts a finite float to a rational number, exactly. Beware that Fraction.from_float(0.3) != Fraction(3, 10). + """ @classmethod @@ -122,6 +127,7 @@ class Fraction(Rational): Fraction(311, 99) >>> Fraction(4321, 8765).limit_denominator(10000) Fraction(4321, 8765) + """ def as_integer_ratio(self) -> tuple[int, int]: @@ -245,6 +251,7 @@ class Fraction(Rational): If b is not an integer, the result will be a float or complex since roots are generally irrational. If b is an integer, the result will be rational. + """ @overload @@ -259,6 +266,7 @@ class Fraction(Rational): If b is not an integer, the result will be a float or complex since roots are generally irrational. If b is an integer, the result will be rational. + """ @overload @@ -351,4 +359,5 @@ class Fraction(Rational): """Converts a finite real number to a rational number, exactly. Beware that Fraction.from_number(0.3) != Fraction(3, 10). + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/functools.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/functools.pyi index 4481f9cb5c..5f5d58288b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/functools.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/functools.pyi @@ -135,6 +135,7 @@ def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Calla Access the underlying function with f.__wrapped__. See: https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU) + """ @overload @@ -434,6 +435,7 @@ def _make_key( If there is only a single argument and its data type is known to cache its hash value, then that argument is returned without a wrapper. This saves space and improves lookup speed. + """ if sys.version_info >= (3, 14): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/getopt.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/getopt.pyi index 0770ea1049..a6e2a8f73d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/getopt.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/getopt.pyi @@ -56,6 +56,7 @@ def getopt( string if the option has no argument. The options occur in the list in the same order in which they were found, thus allowing multiple occurrences. Long and short options may be mixed. + """ def gnu_getopt( @@ -72,6 +73,7 @@ def gnu_getopt( If the first character of the option string is '+', or if the environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a non-option argument is encountered. + """ class GetoptError(Exception): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/gettext.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/gettext.pyi index 8d3623d7e7..e103513790 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/gettext.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/gettext.pyi @@ -14,7 +14,7 @@ import io import sys from _typeshed import StrPath from collections.abc import Callable, Container, Iterable, Sequence -from typing import Any, Final, Literal, Protocol, TypeVar, overload +from typing import Any, Final, Literal, Protocol, TypeVar, overload, type_check_only __all__ = [ "NullTranslations", @@ -38,6 +38,7 @@ __all__ = [ if sys.version_info < (3, 11): __all__ += ["bind_textdomain_codeset", "ldgettext", "ldngettext", "lgettext", "lngettext"] +@type_check_only class _TranslationsReader(Protocol): def read(self) -> bytes: ... # optional: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/graphlib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/graphlib.pyi index 21b07b3aa7..793c8f0975 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/graphlib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/graphlib.pyi @@ -42,6 +42,7 @@ class TopologicalSorter(Generic[_T]): therefore no more nodes can be added using "add". Raise ValueError if nodes have already been passed out of the sorter. + """ def is_active(self) -> bool: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/gzip.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/gzip.pyi index b31946776f..90bdf80f89 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/gzip.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/gzip.pyi @@ -8,7 +8,7 @@ import sys import zlib from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath, WriteableBuffer from io import FileIO, TextIOWrapper -from typing import Final, Literal, Protocol, overload +from typing import Final, Literal, Protocol, overload, type_check_only from typing_extensions import TypeAlias if sys.version_info >= (3, 14): @@ -31,6 +31,7 @@ FEXTRA: Final[int] # actually Literal[4] # undocumented FNAME: Final[int] # actually Literal[8] # undocumented FCOMMENT: Final[int] # actually Literal[16] # undocumented +@type_check_only class _ReadableFileobj(Protocol): def read(self, n: int, /) -> bytes: ... def seek(self, n: int, /) -> object: ... @@ -39,6 +40,7 @@ class _ReadableFileobj(Protocol): # mode: str # def fileno() -> int: ... +@type_check_only class _WritableFileobj(Protocol): def write(self, b: bytes, /) -> object: ... def flush(self) -> object: ... @@ -72,6 +74,7 @@ def open( For text mode, a GzipFile object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). + """ @overload @@ -124,6 +127,7 @@ class GzipFile(BaseStream): This class only supports opening files in binary mode. If you need to open a compressed file in text mode, use the gzip.open() function. + """ myfileobj: FileIO | None @@ -171,6 +175,7 @@ class GzipFile(BaseStream): is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. If mtime is omitted or None, the current time is used. Use mtime = 0 to generate a compressed stream that does not depend on creation time. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/heapq.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/heapq.pyi index 199c0641c7..0eb884cb03 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/heapq.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/heapq.pyi @@ -58,6 +58,7 @@ def merge( >>> list(merge(['dog', 'horse'], ['cat', 'fish', 'kangaroo'], key=len)) ['dog', 'cat', 'fish', 'horse', 'kangaroo'] + """ def nlargest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None) -> list[_S]: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/html/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/html/__init__.pyi index 4d9a27cc42..af5799ee0c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/html/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/html/__init__.pyi @@ -7,14 +7,16 @@ from typing import AnyStr __all__ = ["escape", "unescape"] def escape(s: AnyStr, quote: bool = True) -> AnyStr: - """Replace special characters "&", "<" and ">" to HTML-safe sequences. + """ + Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag quote is true (the default), the quotation mark characters, both double quote (") and single quote (') characters are also translated. """ def unescape(s: AnyStr) -> AnyStr: - """Convert all named and numeric character references (e.g. >, >, + """ + Convert all named and numeric character references (e.g. >, >, &x3e;) in the string s to the corresponding unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the list of diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/html/parser.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/html/parser.pyi index 526ce38811..45805ddf1f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/html/parser.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/html/parser.pyi @@ -1,7 +1,9 @@ """A parser for HTML and XHTML.""" +import sys from _markupbase import ParserBase from re import Pattern +from typing import Final __all__ = ["HTMLParser"] @@ -27,6 +29,10 @@ class HTMLParser(ParserBase): argument. """ + CDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]] + if sys.version_info >= (3, 14): + RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]] + def __init__(self, *, convert_charrefs: bool = True) -> None: """Initialize and reset this instance. @@ -56,7 +62,6 @@ class HTMLParser(ParserBase): def handle_comment(self, data: str) -> None: ... def handle_decl(self, decl: str) -> None: ... def handle_pi(self, data: str) -> None: ... - CDATA_CONTENT_ELEMENTS: tuple[str, ...] def check_for_whole_start_tag(self, i: int) -> int: ... # undocumented def clear_cdata_mode(self) -> None: ... # undocumented def goahead(self, end: bool) -> None: ... # undocumented @@ -65,7 +70,10 @@ class HTMLParser(ParserBase): def parse_html_declaration(self, i: int) -> int: ... # undocumented def parse_pi(self, i: int) -> int: ... # undocumented def parse_starttag(self, i: int) -> int: ... # undocumented - def set_cdata_mode(self, elem: str) -> None: ... # undocumented + if sys.version_info >= (3, 14): + def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented + else: + def set_cdata_mode(self, elem: str) -> None: ... # undocumented rawdata: str # undocumented cdata_elem: str | None # undocumented convert_charrefs: bool # undocumented diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/http/client.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/http/client.pyi index 068db03914..14a7dd6347 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/http/client.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/http/client.pyi @@ -197,6 +197,7 @@ class HTTPMessage(email.message.Message[str, str]): returned, without interpretation. If the header does not occur, an empty list is returned. If the header occurs multiple times, all occurrences are returned. Case is not important in the header name. + """ @overload @@ -250,6 +251,7 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incomp the *default* is not specified. If the headers are unknown, raises http.client.ResponseNotReady. + """ @overload @@ -284,6 +286,7 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incomp Content-Length giving file size, and a Content-Type containing a guess at the file's type. See also the description of the mimetools module. + """ def geturl(self) -> str: @@ -294,11 +297,13 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incomp some cases the caller needs to know which URL the client was redirected to. The geturl() method can be used to get at this redirected URL. + """ def getcode(self) -> int: """Return the HTTP status code that was sent with the response, or None if the URL is not an HTTP URL. + """ def begin(self) -> None: ... @@ -348,7 +353,8 @@ class HTTPConnection: def set_debuglevel(self, level: int) -> None: ... if sys.version_info >= (3, 12): def get_proxy_response_headers(self) -> HTTPMessage | None: - """Returns a dictionary with the headers of the response + """ + Returns a dictionary with the headers of the response received from the proxy server to the CONNECT request sent to set the tunnel. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/http/cookiejar.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/http/cookiejar.pyi index d73b583bea..a2f876c853 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/http/cookiejar.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/http/cookiejar.pyi @@ -66,6 +66,7 @@ class CookieJar: """Add correct Cookie: header to request (urllib.request.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. + """ def extract_cookies(self, response: HTTPResponse, request: Request) -> None: @@ -91,6 +92,7 @@ class CookieJar: the cookie with the specified name, path and domain is removed. Raises KeyError if no matching cookie exists. + """ def clear_session_cookies(self) -> None: @@ -98,6 +100,7 @@ class CookieJar: Note that the .save() method won't save session cookies anyway, unless you ask otherwise by passing a true ignore_discard argument. + """ def clear_expired_cookies(self) -> None: # undocumented @@ -108,6 +111,7 @@ class CookieJar: this method is called by CookieJar itself every so often, and the .save() method won't save expired cookies anyway (unless you ask otherwise by passing a true ignore_expires argument). + """ def __iter__(self) -> Iterator[Cookie]: ... @@ -120,8 +124,10 @@ class FileCookieJar(CookieJar): filename: str | None delayload: bool def __init__(self, filename: StrPath | None = None, delayload: bool = False, policy: CookiePolicy | None = None) -> None: - """Cookies are NOT loaded from the named file until either the .load() or + """ + Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. + """ def save(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: @@ -135,10 +141,13 @@ class FileCookieJar(CookieJar): Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens. + """ class MozillaCookieJar(FileCookieJar): - """WARNING: you may want to backup your browser's cookies file if you use + """ + + WARNING: you may want to backup your browser's cookies file if you use this class to save cookies. I *think* it works, but there have been bugs in the past! @@ -164,13 +173,15 @@ class MozillaCookieJar(FileCookieJar): Note that though Mozilla and Netscape use the same format, they use slightly different headers. The class saves cookies using the Netscape header by default (Mozilla can cope with that). + """ if sys.version_info < (3, 10): header: ClassVar[str] # undocumented class LWPCookieJar(FileCookieJar): - """The LWPCookieJar saves a sequence of "Set-Cookie3" lines. + """ + The LWPCookieJar saves a sequence of "Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl library, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. @@ -178,12 +189,14 @@ class LWPCookieJar(FileCookieJar): Additional methods as_lwp_str(ignore_discard=True, ignore_expired=True) + """ def as_lwp_str(self, ignore_discard: bool = True, ignore_expires: bool = True) -> str: # undocumented """Return cookies as a string of "\\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save + """ class CookiePolicy: @@ -193,6 +206,7 @@ class CookiePolicy: The subclass DefaultCookiePolicy defines the standard rules for Netscape and RFC 2965 cookies -- override that if you want a customized policy. + """ netscape: bool @@ -203,6 +217,7 @@ class CookiePolicy: Currently, pre-expired cookies never get this far -- the CookieJar class deletes such cookies itself. + """ def return_ok(self, cookie: Cookie, request: Request) -> bool: @@ -289,6 +304,7 @@ class Cookie: Note that the port may be present in the headers, but unspecified ("Port" rather than"Port=80", for example); if this is the case, port is None. + """ version: int | None diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/http/cookies.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/http/cookies.pyi index e1c797e3d1..e07ddcccae 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/http/cookies.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/http/cookies.pyi @@ -188,7 +188,8 @@ class BaseCookie(dict[str, Morsel[_T]], Generic[_T]): """Dictionary style assignment.""" class SimpleCookie(BaseCookie[str]): - """SimpleCookie supports strings as cookie values. When setting + """ + SimpleCookie supports strings as cookie values. When setting the value using the dictionary assignment notation, SimpleCookie calls the builtin str() to convert the value to a string. Values received from HTTP are kept as strings. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/http/server.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/http/server.pyi index c6177b7f00..214d5bb8f8 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/http/server.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/http/server.pyi @@ -196,6 +196,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): where and should be registered MIME types, e.g. "text/html" or "text/plain". + """ client_address: tuple[str, int] @@ -221,6 +222,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. + """ def handle_expect_100(self) -> bool: @@ -235,6 +237,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): This method should either return True (possibly after sending a 100 Continue response) or send an error response and return False. + """ def send_error(self, code: int, message: str | None = None, explain: str | None = None) -> None: @@ -252,6 +255,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends a piece of HTML explaining the error to the user. + """ def send_response(self, code: int, message: str | None = None) -> None: @@ -260,6 +264,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): Also send two standard headers with the server software version and the current date. + """ def send_header(self, keyword: str, value: str) -> None: @@ -276,6 +281,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): """Log an accepted request. This is called by send_response(). + """ def log_error(self, format: str, *args: Any) -> None: @@ -287,6 +293,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): Arguments are the same as for log_message(). XXX This should go to the separate error log. + """ def log_message(self, format: str, *args: Any) -> None: @@ -306,6 +313,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): Unicode control characters are replaced with escaped hex before writing the output to stderr. + """ def version_string(self) -> str: @@ -329,6 +337,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): Return True for success, False for failure; on failure, any relevant error response has already been sent back. + """ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): @@ -340,6 +349,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): The GET and HEAD requests are identical except that the HEAD request omits the actual contents of the file. + """ extensions_map: dict[str, str] @@ -369,6 +379,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. + """ def list_directory(self, path: StrPath) -> io.BytesIO | None: # undocumented @@ -377,6 +388,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head(). + """ def translate_path(self, path: str) -> str: # undocumented @@ -385,6 +397,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): Components that mean special things to the local file system (e.g. drive or directory names) are ignored. (XXX They should probably be diagnosed.) + """ def copyfile(self, source: SupportsRead[AnyStr], outputfile: SupportsWrite[AnyStr]) -> None: # undocumented @@ -399,6 +412,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): the block size or perhaps to replace newlines by CRLF -- note however that this the default server uses this to copy binary data as well. + """ def guess_type(self, path: StrPath) -> str: # undocumented @@ -413,6 +427,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): up in the table self.extensions_map, using application/octet-stream as a default; however it would be permissible (if slow) to look inside the data to make a better guess. + """ def executable(path: StrPath) -> bool: # undocumented @@ -425,6 +440,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): GET and HEAD also support running CGI scripts. The POST command is *only* implemented for CGI scripts. + """ cgi_directories: list[str] @@ -433,6 +449,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): """Serve a POST request. This is only implemented for CGI scripts. + """ def is_cgi(self) -> bool: # undocumented @@ -448,6 +465,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): The default implementation tests whether the normalized url path begins with one of the strings in self.cgi_directories (and the next character is a '/' or the end of the string). + """ def is_executable(self, path: StrPath) -> bool: # undocumented diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/imghdr.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/imghdr.pyi index 7d54851ea8..3b6536960e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/imghdr.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/imghdr.pyi @@ -2,10 +2,11 @@ from _typeshed import StrPath from collections.abc import Callable -from typing import Any, BinaryIO, Protocol, overload +from typing import Any, BinaryIO, Protocol, overload, type_check_only __all__ = ["what"] +@type_check_only class _ReadableBinary(Protocol): def tell(self) -> int: ... def read(self, size: int, /) -> bytes: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/imp.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/imp.pyi index 540eac2943..64fe67d765 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/imp.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/imp.pyi @@ -40,6 +40,7 @@ def new_module(name: str) -> types.ModuleType: Create a new module. The module is not entered into sys.modules. + """ def get_magic() -> bytes: @@ -63,6 +64,7 @@ def cache_from_source(path: StrPath, debug_override: bool | None = None) -> str: place of sys.flags.optimize. If sys.implementation.cache_tag is None then NotImplementedError is raised. + """ def source_from_cache(path: StrPath) -> str: @@ -74,6 +76,7 @@ def source_from_cache(path: StrPath) -> str: the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. + """ def get_suffixes() -> list[tuple[str, str, int]]: @@ -83,6 +86,7 @@ class NullImporter: """**DEPRECATED** Null import object. + """ def __init__(self, path: StrPath) -> None: ... @@ -113,6 +117,7 @@ def load_module(name: str, file: _FileLike | None, filename: str, details: tuple Load a module, given information returned by find_module(). The module name must include the full package name, if any. + """ # IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise. @@ -127,6 +132,7 @@ def find_module( module and continue search in sys.path. The module name cannot contain '.'; to search for a submodule of a package, pass the submodule name and the package's __path__. + """ def reload(module: types.ModuleType) -> types.ModuleType: @@ -135,6 +141,7 @@ def reload(module: types.ModuleType) -> types.ModuleType: Reload the module and return it. The module must have been successfully imported before. + """ def init_builtin(name: str) -> types.ModuleType | None: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/__init__.pyi index c9fa371af1..abd6e4348f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/__init__.pyi @@ -14,6 +14,7 @@ def import_module(name: str, package: str | None = None) -> ModuleType: The 'package' argument is required when performing a relative import. It specifies the package to use as the anchor point from which to resolve the relative import to an absolute import. + """ if sys.version_info < (3, 12): @@ -23,6 +24,7 @@ if sys.version_info < (3, 12): This is a backward-compatible wrapper around find_spec(). This function is deprecated in favor of importlib.util.find_spec(). + """ def invalidate_caches() -> None: @@ -34,4 +36,5 @@ def reload(module: ModuleType) -> ModuleType: """Reload the module and return it. The module must have been successfully imported before. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/_abc.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/_abc.pyi index 94924e66bf..a6c01e6b90 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/_abc.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/_abc.pyi @@ -20,6 +20,7 @@ if sys.version_info >= (3, 10): This method is deprecated in favor of loader.exec_module(). If exec_module() exists then it is used to provide a backwards-compatible functionality for this method. + """ if sys.version_info < (3, 12): def module_repr(self, module: types.ModuleType) -> str: @@ -29,6 +30,7 @@ if sys.version_info >= (3, 10): NotImplementedError. This method is deprecated. + """ def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/abc.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/abc.pyi index b2e75ae586..14f1517613 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/abc.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/abc.pyi @@ -44,6 +44,7 @@ else: This method is deprecated in favor of loader.exec_module(). If exec_module() exists then it is used to provide a backwards-compatible functionality for this method. + """ def module_repr(self, module: types.ModuleType) -> str: @@ -53,6 +54,7 @@ else: NotImplementedError. This method is deprecated. + """ def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: @@ -84,6 +86,7 @@ class ResourceLoader(Loader): back-end storage. This ABC represents one of the optional protocols specified by PEP 302. + """ @abstractmethod @@ -97,6 +100,7 @@ class InspectLoader(Loader): modules they can load. This ABC represents one of the optional protocols specified by PEP 302. + """ def is_package(self, fullname: str) -> bool: @@ -141,6 +145,7 @@ class ExecutionLoader(InspectLoader): modules as scripts. This ABC represents one of the optional protocols specified in PEP 302. + """ @abstractmethod @@ -164,6 +169,7 @@ class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLo * ResourceLoader.get_data * ExecutionLoader.get_filename + """ @deprecated("Deprecated as of Python 3.3: Use importlib.resources.abc.SourceLoader.path_stats instead.") @@ -207,6 +213,7 @@ if sys.version_info >= (3, 10): This method is deprecated since Python 3.4 in favor of finder.find_spec(). If find_spec() exists then backwards-compatible functionality is provided for this method. + """ def invalidate_caches(self) -> None: @@ -227,6 +234,7 @@ if sys.version_info >= (3, 10): self.find_loader(). This method is deprecated in favor of finder.find_spec(). + """ def find_loader(self, fullname: str) -> tuple[Loader | None, Sequence[str]]: @@ -266,6 +274,7 @@ else: This method is deprecated since Python 3.4 in favor of finder.find_spec(). If find_spec() exists then backwards-compatible functionality is provided for this method. + """ def invalidate_caches(self) -> None: @@ -285,6 +294,7 @@ else: self.find_loader(). This method is deprecated in favor of finder.find_spec(). + """ def find_loader(self, fullname: str) -> tuple[Loader | None, Sequence[str]]: @@ -332,6 +342,7 @@ class FileLoader(_bootstrap_external.FileLoader, ResourceLoader, ExecutionLoader """Load a module from a file. This method is deprecated. Use exec_module() instead. + """ if sys.version_info < (3, 11): @@ -372,35 +383,45 @@ if sys.version_info < (3, 11): @runtime_checkable class Traversable(Protocol): - """An object with a subset of pathlib.Path methods suitable for + """ + An object with a subset of pathlib.Path methods suitable for traversing directories and opening files. """ @abstractmethod def is_dir(self) -> bool: - """Return True if self is a dir""" + """ + Return True if self is a dir + """ @abstractmethod def is_file(self) -> bool: - """Return True if self is a file""" + """ + Return True if self is a file + """ @abstractmethod def iterdir(self) -> Iterator[Traversable]: - """Yield Traversable objects in self""" + """ + Yield Traversable objects in self + """ if sys.version_info >= (3, 11): @abstractmethod def joinpath(self, *descendants: str) -> Traversable: ... else: @abstractmethod def joinpath(self, child: str, /) -> Traversable: - """Return Traversable child in self""" + """ + Return Traversable child in self + """ # The documentation and runtime protocol allows *args, **kwargs arguments, # but this would mean that all implementers would have to support them, # which is not the case. @overload @abstractmethod def open(self, mode: Literal["r"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: - """mode may be 'r' or 'rb' to open as text or binary. Return a handle + """ + mode may be 'r' or 'rb' to open as text or binary. Return a handle suitable for reading (same as pathlib.Path.open). When opening as text, accepts encoding parameters such as those @@ -413,25 +434,36 @@ if sys.version_info < (3, 11): @property @abstractmethod def name(self) -> str: - """The base name of this object without any parent references.""" + """ + The base name of this object without any parent references. + """ if sys.version_info >= (3, 10): def __truediv__(self, child: str, /) -> Traversable: - """Return Traversable child in self""" + """ + Return Traversable child in self + """ else: @abstractmethod def __truediv__(self, child: str, /) -> Traversable: - """Return Traversable child in self""" + """ + Return Traversable child in self + """ @abstractmethod def read_bytes(self) -> bytes: - """Read contents of self as bytes""" + """ + Read contents of self as bytes + """ @abstractmethod def read_text(self, encoding: str | None = None) -> str: - """Read contents of self as text""" + """ + Read contents of self as text + """ class TraversableResources(ResourceReader): - """The required interface for providing traversable + """ + The required interface for providing traversable resources. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/__init__.pyi index c52736de1d..2c6f68cd49 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/__init__.pyi @@ -36,7 +36,8 @@ if sys.version_info >= (3, 10): if sys.version_info >= (3, 10): from importlib.metadata._meta import PackageMetadata as PackageMetadata, SimplePath def packages_distributions() -> Mapping[str, list[str]]: - """Return a mapping of top-level packages to their + """ + Return a mapping of top-level packages to their distributions. >>> import collections.abc @@ -60,7 +61,8 @@ if sys.version_info >= (3, 13): _EntryPointBase = object elif sys.version_info >= (3, 11): class DeprecatedTuple: - """Provide subscript item access for backward compatibility. + """ + Provide subscript item access for backward compatibility. >>> recwarn = getfixture('recwarn') >>> ep = EntryPoint(name='name', value='value', group='group') @@ -130,7 +132,8 @@ class EntryPoint(_EntryPointBase): attr: str = ..., extras: list[str] = ..., ) -> bool: # undocumented - """EntryPoint matches the given parameters. + """ + EntryPoint matches the given parameters. >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]') >>> ep.matches(group='foo') @@ -155,14 +158,20 @@ class EntryPoint(_EntryPointBase): def __lt__(self, other: object) -> bool: ... if sys.version_info < (3, 12): def __iter__(self) -> Iterator[Any]: # result of iter((str, Self)), really - """Supply iter so one may construct dicts of EntryPoints by name.""" + """ + Supply iter so one may construct dicts of EntryPoints by name. + """ if sys.version_info >= (3, 12): class EntryPoints(tuple[EntryPoint, ...]): - """An immutable collection of selectable EntryPoint objects.""" + """ + An immutable collection of selectable EntryPoint objects. + """ def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] - """Get the EntryPoint in self matching name.""" + """ + Get the EntryPoint in self matching name. + """ def select( self, @@ -174,21 +183,27 @@ if sys.version_info >= (3, 12): attr: str = ..., extras: list[str] = ..., ) -> EntryPoints: - """Select entry points from self that match the + """ + Select entry points from self that match the given parameters (typically group and/or name). """ @property def names(self) -> set[str]: - """Return the set of all names of all entry points.""" + """ + Return the set of all names of all entry points. + """ @property def groups(self) -> set[str]: - """Return the set of all groups of all entry points.""" + """ + Return the set of all groups of all entry points. + """ elif sys.version_info >= (3, 10): class DeprecatedList(list[_T]): - """Allow an otherwise immutable object to implement mutability + """ + Allow an otherwise immutable object to implement mutability for compatibility. >>> recwarn = getfixture('recwarn') @@ -219,11 +234,15 @@ elif sys.version_info >= (3, 10): """ class EntryPoints(DeprecatedList[EntryPoint]): # use as list is deprecated since 3.10 - """An immutable collection of selectable EntryPoint objects.""" + """ + An immutable collection of selectable EntryPoint objects. + """ # int argument is deprecated since 3.10 def __getitem__(self, name: int | str) -> EntryPoint: # type: ignore[override] - """Get the EntryPoint in self matching name.""" + """ + Get the EntryPoint in self matching name. + """ def select( self, @@ -235,17 +254,21 @@ elif sys.version_info >= (3, 10): attr: str = ..., extras: list[str] = ..., ) -> EntryPoints: - """Select entry points from self that match the + """ + Select entry points from self that match the given parameters (typically group and/or name). """ @property def names(self) -> set[str]: - """Return the set of all names of all entry points.""" + """ + Return the set of all names of all entry points. + """ @property def groups(self) -> set[str]: - """Return the set of all groups of all entry points. + """ + Return the set of all groups of all entry points. For coverage while SelectableGroups is present. >>> EntryPoints().groups @@ -254,7 +277,8 @@ elif sys.version_info >= (3, 10): if sys.version_info >= (3, 10) and sys.version_info < (3, 12): class Deprecated(Generic[_KT, _VT]): - """Compatibility add-in for mapping to indicate that + """ + Compatibility add-in for mapping to indicate that mapping behavior is deprecated. >>> recwarn = getfixture('recwarn') @@ -288,7 +312,8 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 12): def values(self) -> dict_values[_KT, _VT]: ... class SelectableGroups(Deprecated[str, EntryPoints], dict[str, EntryPoints]): # use as dict is deprecated since 3.10 - """A backward- and forward-compatible result from + """ + A backward- and forward-compatible result from entry_points that fully implements the dict interface. """ @@ -298,7 +323,8 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 12): def groups(self) -> set[str]: ... @property def names(self) -> set[str]: - """for coverage: + """ + for coverage: >>> SelectableGroups().names set() """ @@ -341,7 +367,8 @@ else: _distribution_parent = object class Distribution(_distribution_parent): - """An abstract Python distribution package. + """ + An abstract Python distribution package. Custom providers may derive from this class and define the abstract methods to provide a concrete implementation @@ -375,7 +402,8 @@ class Distribution(_distribution_parent): @abc.abstractmethod def locate_file(self, path: StrPath) -> _SimplePath: - """Given a path to a file in this distribution, return a SimplePath + """ + Given a path to a file in this distribution, return a SimplePath to it. """ @@ -431,7 +459,8 @@ class Distribution(_distribution_parent): @property def entry_points(self) -> EntryPoints: - """Return EntryPoints for this distribution. + """ + Return EntryPoints for this distribution. Custom providers may provide the ``entry_points.txt`` file or override this property. @@ -480,14 +509,16 @@ class Distribution(_distribution_parent): def origin(self) -> types.SimpleNamespace: ... class DistributionFinder(MetaPathFinder): - """A MetaPathFinder capable of discovering installed distributions. + """ + A MetaPathFinder capable of discovering installed distributions. Custom providers should implement this interface in order to supply metadata. """ class Context: - """Keyword arguments presented by the caller to + """ + Keyword arguments presented by the caller to ``distributions()`` or ``Distribution.discover()`` to narrow the scope of a search for distributions in all DistributionFinders. @@ -512,7 +543,8 @@ class DistributionFinder(MetaPathFinder): def __init__(self, *, name: str | None = ..., path: list[str] = ..., **kwargs: Any) -> None: ... @property def path(self) -> list[str]: - """The sequence of directory path that a distribution finder + """ + The sequence of directory path that a distribution finder should search. Typically refers to Python installed package paths such as @@ -521,7 +553,8 @@ class DistributionFinder(MetaPathFinder): @abc.abstractmethod def find_distributions(self, context: DistributionFinder.Context = ...) -> Iterable[Distribution]: - """Find distributions. + """ + Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, @@ -531,7 +564,8 @@ class DistributionFinder(MetaPathFinder): class MetadataPathFinder(DistributionFinder): @classmethod def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: - """Find distributions. + """ + Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` @@ -673,7 +707,8 @@ def files(distribution_name: str) -> list[PackagePath] | None: """ def requires(distribution_name: str) -> list[str] | None: - """Return a list of requirements for the named package. + """ + Return a list of requirements for the named package. :return: An iterable of requirements, suitable for packaging.requirement.Requirement. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/_meta.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/_meta.pyi index a9fab3cf46..530e2463fc 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/_meta.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/metadata/_meta.pyi @@ -15,7 +15,9 @@ class PackageMetadata(Protocol): def __iter__(self) -> Iterator[str]: ... @property def json(self) -> dict[str, str | list[str]]: - """A JSON-compatible form of the metadata.""" + """ + A JSON-compatible form of the metadata. + """ @overload def get_all(self, name: str, failobj: None = None) -> list[Any] | None: @@ -33,7 +35,9 @@ class PackageMetadata(Protocol): if sys.version_info >= (3, 13): class SimplePath(Protocol): - """A minimal subset of pathlib.Path required by Distribution.""" + """ + A minimal subset of pathlib.Path required by Distribution. + """ def joinpath(self, other: StrPath, /) -> SimplePath: ... def __truediv__(self, other: StrPath, /) -> SimplePath: ... @@ -46,7 +50,9 @@ if sys.version_info >= (3, 13): elif sys.version_info >= (3, 12): class SimplePath(Protocol[_T_co]): - """A minimal subset of pathlib.Path required by PathDistribution.""" + """ + A minimal subset of pathlib.Path required by PathDistribution. + """ # At runtime this is defined as taking `str | _T`, but that causes trouble. # See #11436. @@ -59,7 +65,9 @@ elif sys.version_info >= (3, 12): else: class SimplePath(Protocol): - """A minimal subset of pathlib.Path required by PathDistribution.""" + """ + A minimal subset of pathlib.Path required by PathDistribution. + """ # Actually takes only self at runtime, but that's clearly wrong def joinpath(self, other: Any, /) -> SimplePath: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/readers.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/readers.pyi index 101a81434d..029111a3c7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/readers.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/readers.pyi @@ -40,7 +40,8 @@ if sys.version_info >= (3, 10): path: pathlib.Path def __init__(self, loader: FileLoader) -> None: ... def resource_path(self, resource: StrPath) -> str: - """Return the file system path to prevent + """ + Return the file system path to prevent `resources.path()` from creating a temporary copy. """ @@ -53,14 +54,16 @@ if sys.version_info >= (3, 10): def __init__(self, loader: zipimporter, module: str) -> None: ... def open_resource(self, resource: str) -> BufferedReader: ... def is_resource(self, path: StrPath) -> bool: - """Workaround for `zipfile.Path.is_file` returning true + """ + Workaround for `zipfile.Path.is_file` returning true for non-existent paths. """ def files(self) -> zipfile.Path: ... class MultiplexedPath(abc.Traversable): - """Given a series of Traversable objects, implement a merged + """ + Given a series of Traversable objects, implement a merged version of the interface across all objects. Useful for namespace packages which may be multihomed at a single name. @@ -91,7 +94,8 @@ if sys.version_info >= (3, 10): path: MultiplexedPath def __init__(self, namespace_path: Iterable[str]) -> None: ... def resource_path(self, resource: str) -> str: - """Return the file system path to prevent + """ + Return the file system path to prevent `resources.path()` from creating a temporary copy. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/__init__.pyi index 0a96883cb9..fb0ac53ac1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/__init__.pyi @@ -111,7 +111,8 @@ if sys.version_info >= (3, 11): from importlib.resources._common import as_file as as_file else: def as_file(path: Traversable) -> AbstractContextManager[Path, Literal[False]]: - """Given a Traversable object, return that object as a + """ + Given a Traversable object, return that object as a path on the local file system in a context manager. """ @@ -119,7 +120,9 @@ if sys.version_info >= (3, 11): from importlib.resources._common import files as files else: def files(package: Package) -> Traversable: - """Get a Traversable resource from a package""" + """ + Get a Traversable resource from a package + """ if sys.version_info >= (3, 11): from importlib.resources.abc import ResourceReader as ResourceReader diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/_common.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/_common.pyi index 7b70c589d4..83371a58a4 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/_common.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/_common.pyi @@ -18,7 +18,8 @@ if sys.version_info >= (3, 11): def package_to_anchor( func: Callable[[Anchor | None], Traversable], ) -> Callable[[Anchor | None, Anchor | None], Traversable]: - """Replace 'package' parameter as 'anchor' and warn about the change. + """ + Replace 'package' parameter as 'anchor' and warn about the change. Other errors should fall through. @@ -31,7 +32,9 @@ if sys.version_info >= (3, 11): @overload def files(anchor: Anchor | None = None) -> Traversable: - """Get a Traversable resource for an anchor.""" + """ + Get a Traversable resource for an anchor. + """ @overload @deprecated("First parameter to files is renamed to 'anchor'") @@ -39,10 +42,14 @@ if sys.version_info >= (3, 11): else: def files(package: Package) -> Traversable: - """Get a Traversable resource from a package""" + """ + Get a Traversable resource from a package + """ def get_resource_reader(package: types.ModuleType) -> ResourceReader | None: - """Return the package's loader if it's a ResourceReader.""" + """ + Return the package's loader if it's a ResourceReader. + """ if sys.version_info >= (3, 12): def resolve(cand: Anchor | None) -> types.ModuleType: ... @@ -57,9 +64,13 @@ if sys.version_info >= (3, 11): """ def from_package(package: types.ModuleType) -> Traversable: - """Return a Traversable object for the given package.""" + """ + Return a Traversable object for the given package. + + """ def as_file(path: Traversable) -> AbstractContextManager[Path, Literal[False]]: - """Given a Traversable object, return that object as a + """ + Given a Traversable object, return that object as a path on the local file system in a context manager. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/abc.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/abc.pyi index bb2a409c9e..af8faaea59 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/abc.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/abc.pyi @@ -38,7 +38,8 @@ if sys.version_info >= (3, 11): @runtime_checkable class Traversable(Protocol): - """An object with a subset of pathlib.Path methods suitable for + """ + An object with a subset of pathlib.Path methods suitable for traversing directories and opening files. Any exceptions that occur when accessing the backing resource @@ -47,19 +48,26 @@ if sys.version_info >= (3, 11): @abstractmethod def is_dir(self) -> bool: - """Return True if self is a directory""" + """ + Return True if self is a directory + """ @abstractmethod def is_file(self) -> bool: - """Return True if self is a file""" + """ + Return True if self is a file + """ @abstractmethod def iterdir(self) -> Iterator[Traversable]: - """Yield Traversable objects in self""" + """ + Yield Traversable objects in self + """ @abstractmethod def joinpath(self, *descendants: str) -> Traversable: - """Return Traversable resolved with any descendants applied. + """ + Return Traversable resolved with any descendants applied. Each descendant should be a path segment relative to self and each may contain multiple levels separated by @@ -71,7 +79,8 @@ if sys.version_info >= (3, 11): @overload @abstractmethod def open(self, mode: Literal["r"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: - """mode may be 'r' or 'rb' to open as text or binary. Return a handle + """ + mode may be 'r' or 'rb' to open as text or binary. Return a handle suitable for reading (same as pathlib.Path.open). When opening as text, accepts encoding parameters such as those @@ -84,21 +93,30 @@ if sys.version_info >= (3, 11): @property @abstractmethod def name(self) -> str: - """The base name of this object without any parent references.""" + """ + The base name of this object without any parent references. + """ def __truediv__(self, child: str, /) -> Traversable: - """Return Traversable child in self""" + """ + Return Traversable child in self + """ @abstractmethod def read_bytes(self) -> bytes: - """Read contents of self as bytes""" + """ + Read contents of self as bytes + """ @abstractmethod def read_text(self, encoding: str | None = None) -> str: - """Read contents of self as text""" + """ + Read contents of self as text + """ class TraversableResources(ResourceReader): - """The required interface for providing traversable + """ + The required interface for providing traversable resources. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/simple.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/simple.pyi index 2ab607fb53..27ded93f6e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/simple.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/resources/simple.pyi @@ -13,34 +13,44 @@ if sys.version_info >= (3, 11): from .abc import Traversable, TraversableResources class SimpleReader(abc.ABC): - """The minimum, low-level interface required from a resource + """ + The minimum, low-level interface required from a resource provider. """ @property @abc.abstractmethod def package(self) -> str: - """The name of the package for which this reader loads resources.""" + """ + The name of the package for which this reader loads resources. + """ @abc.abstractmethod def children(self) -> list[SimpleReader]: - """Obtain an iterable of SimpleReader for available + """ + Obtain an iterable of SimpleReader for available child containers (e.g. directories). """ @abc.abstractmethod def resources(self) -> list[str]: - """Obtain available named resources for this virtual package.""" + """ + Obtain available named resources for this virtual package. + """ @abc.abstractmethod def open_binary(self, resource: str) -> BinaryIO: - """Obtain a File-like for a named resource.""" + """ + Obtain a File-like for a named resource. + """ @property def name(self) -> str: ... class ResourceHandle(Traversable, metaclass=abc.ABCMeta): - """Handle to a named resource in a ResourceReader.""" + """ + Handle to a named resource in a ResourceReader. + """ parent: ResourceContainer def __init__(self, parent: ResourceContainer, name: str) -> None: ... @@ -63,7 +73,9 @@ if sys.version_info >= (3, 11): def joinpath(self, name: Never) -> NoReturn: ... # type: ignore[override] class ResourceContainer(Traversable, metaclass=abc.ABCMeta): - """Traversable container for a package's resources via its reader.""" + """ + Traversable container for a package's resources via its reader. + """ reader: SimpleReader def __init__(self, reader: SimpleReader) -> None: ... @@ -75,7 +87,8 @@ if sys.version_info >= (3, 11): def joinpath(self, *descendants: str) -> Traversable: ... class TraversableReader(TraversableResources, SimpleReader, metaclass=abc.ABCMeta): - """A TraversableResources based on SimpleReader. Resource providers + """ + A TraversableResources based on SimpleReader. Resource providers may derive from this class to provide the TraversableResources interface by supplying the SimpleReader interface. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/util.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/util.pyi index 839e3184a6..3b4f835210 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/importlib/util.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/importlib/util.pyi @@ -35,18 +35,21 @@ if sys.version_info < (3, 12): The decorator assumes that the decorated function takes the module name as the second argument. + """ def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: """Set __loader__ on the returned module. This function is deprecated. + """ def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: """Set __package__ on the returned module. This function is deprecated. + """ def resolve_name(name: str, package: str | None) -> str: @@ -67,6 +70,7 @@ def find_spec(name: str, package: str | None = None) -> importlib.machinery.Modu The name and package arguments work the same as importlib.import_module(). In other words, relative module names (with leading dots) work. + """ class LazyLoader(Loader): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/inspect.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/inspect.pyi index c7e4960d4a..508470d1bd 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/inspect.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/inspect.pyi @@ -53,7 +53,7 @@ from types import ( TracebackType, WrapperDescriptorType, ) -from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload +from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs if sys.version_info >= (3, 14): @@ -286,7 +286,9 @@ def isfunction(object: object) -> TypeIs[FunctionType]: if sys.version_info >= (3, 12): def markcoroutinefunction(func: _F) -> _F: - """Decorator to ensure callable is recognised as a coroutine function.""" + """ + Decorator to ensure callable is recognised as a coroutine function. + """ @overload def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: @@ -350,10 +352,11 @@ def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ... @overload def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ... - +@type_check_only class _SupportsSet(Protocol[_T_contra, _V_contra]): def __set__(self, instance: _T_contra, value: _V_contra, /) -> None: ... +@type_check_only class _SupportsDelete(Protocol[_T_contra]): def __delete__(self, instance: _T_contra, /) -> None: ... @@ -809,7 +812,8 @@ if sys.version_info >= (3, 12): """ def getasyncgenlocals(agen: AsyncGeneratorType[Any, Any]) -> dict[str, Any]: - """Get the mapping of asynchronous generator local variables to their current + """ + Get the mapping of asynchronous generator local variables to their current values. A dict is returned, with the keys the local variable names and values the @@ -1092,7 +1096,8 @@ class ClosureVars(NamedTuple): unbound: AbstractSet[str] def getclosurevars(func: _IntrospectableCallable) -> ClosureVars: - """Get the mapping of free variables to their current values. + """ + Get the mapping of free variables to their current values. Returns a named tuple of dicts mapping the current nonlocal, global and builtin references as seen by the body of the function. A final @@ -1278,14 +1283,16 @@ def getcoroutinestate( """ def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> dict[str, Any]: - """Get the mapping of generator local variables to their current values. + """ + Get the mapping of generator local variables to their current values. A dict is returned, with the keys the local variable names and values the bound values. """ def getcoroutinelocals(coroutine: Coroutine[Any, Any, Any]) -> dict[str, Any]: - """Get the mapping of coroutine local variables to their current values. + """ + Get the mapping of coroutine local variables to their current values. A dict is returned, with the keys the local variable names and values the bound values. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ipaddress.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ipaddress.pyi index ce9fe4bc15..4e8137a5f1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ipaddress.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ipaddress.pyi @@ -34,6 +34,7 @@ def ip_address(address: _RawIPAddress) -> IPv4Address | IPv6Address: Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address + """ def ip_network( @@ -52,6 +53,7 @@ def ip_network( Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. + """ def ip_interface( @@ -75,6 +77,7 @@ def ip_interface( The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. + """ class _IPAddressBase: @@ -95,6 +98,7 @@ class _IPAddressBase: '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' + """ if sys.version_info < (3, 14): @property @@ -213,6 +217,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): TypeError: If self and other are of differing address versions, or if other is not a network object. ValueError: If other is not completely contained by self. + """ @property @@ -247,6 +252,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Raises: TypeError if the IP versions are different. + """ def hosts(self) -> Iterator[_A]: @@ -254,6 +260,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): This is like __iter__ except it doesn't return the network or broadcast addresses. + """ @property @@ -263,6 +270,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry or iana-ipv6-special-registry. + """ @property @@ -271,6 +279,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if the address is reserved per RFC 4291. + """ @property @@ -280,6 +289,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. + """ @property @@ -289,6 +299,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. + """ @property @@ -298,6 +309,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if the network is reserved per iana-ipv4-special-registry or iana-ipv6-special-registry. + """ @property @@ -307,6 +319,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. + """ @property @@ -316,6 +329,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. + """ @property @@ -357,6 +371,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) + """ def supernet(self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Self: @@ -378,6 +393,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) + """ @property @@ -394,6 +410,7 @@ class _BaseV4: The following methods are used by IPv4 objects in both single IP addresses and networks. + """ if sys.version_info >= (3, 14): @@ -409,7 +426,8 @@ class IPv4Address(_BaseV4, _BaseAddress): """Represent and manipulate single IPv4 Addresses.""" def __init__(self, address: object) -> None: - """Args: + """ + Args: address: A string or integer representing the IP Additionally, an integer can be passed, so @@ -420,6 +438,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. + """ @property @@ -444,6 +463,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Returns: A boolean, True if the address is link-local per RFC 3927. + """ @property @@ -452,6 +472,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Returns: A boolean, True if the address is a loopback per RFC 3330. + """ @property @@ -461,6 +482,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Returns: A boolean, True if the address is multicast. See RFC 3171 for details. + """ @property @@ -487,6 +509,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Returns: A boolean, True if the address is within the reserved IPv4 Network range. + """ @property @@ -496,6 +519,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. + """ @property @@ -508,6 +532,7 @@ class IPv4Address(_BaseV4, _BaseAddress): Returns: The IPv4-mapped IPv6 address per RFC 4291. + """ class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): @@ -519,9 +544,10 @@ class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 + """ - def __init__(self, address: object, strict: bool = ...) -> None: + def __init__(self, address: object, strict: bool = True) -> None: """Instantiate a new IPv4 network object. Args: @@ -578,6 +604,7 @@ class _BaseV6: The following methods are used by IPv6 objects in both single IP addresses and networks. + """ if sys.version_info >= (3, 14): @@ -607,6 +634,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Raises: AddressValueError: If address isn't a valid IPv6 address. + """ @property @@ -631,6 +659,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A boolean, True if the address is reserved per RFC 4291. + """ @property @@ -640,6 +669,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. + """ @property @@ -649,6 +679,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. + """ @property @@ -675,6 +706,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. + """ @property @@ -684,6 +716,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. + """ @property @@ -697,6 +730,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. + """ @property @@ -709,6 +743,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. + """ @property @@ -718,6 +753,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. + """ @property @@ -728,6 +764,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) + """ @property @@ -738,6 +775,7 @@ class IPv6Address(_BaseV6, _BaseAddress): Returns: A string identifying the zone of the address if specified, else None. + """ def __hash__(self) -> int: ... @@ -752,9 +790,10 @@ class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]): .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 + """ - def __init__(self, address: object, strict: bool = ...) -> None: + def __init__(self, address: object, strict: bool = True) -> None: """Instantiate a new IPv6 Network object. Args: @@ -796,6 +835,7 @@ class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]): Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. + """ class IPv6Interface(IPv6Address): @@ -826,6 +866,7 @@ def v4_int_to_packed(address: int) -> bytes: Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. + """ def v6_int_to_packed(address: int) -> bytes: @@ -836,6 +877,7 @@ def v6_int_to_packed(address: int) -> bytes: Returns: The integer address packed as 16 bytes in network (big-endian) order. + """ # Third overload is technically incorrect, but convenient when first and last are return values of ip_address() @@ -864,6 +906,7 @@ def summarize_address_range(first: IPv4Address, last: IPv4Address) -> Iterator[I ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. + """ @overload @@ -888,6 +931,7 @@ def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: Raises: TypeError: If passed a list of mixed version objects. + """ @overload @@ -907,6 +951,7 @@ def get_mixed_type_key(obj: _A) -> tuple[int, _A]: obj: either a Network or Address object. Returns: appropriate key. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/json/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/json/__init__.pyi index 0716146683..b911c1315a 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/json/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/json/__init__.pyi @@ -157,6 +157,7 @@ def dumps( To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. + """ def dump( @@ -213,6 +214,7 @@ def dump( To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. + """ def loads( diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/json/decoder.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/json/decoder.pyi index dc31823aac..9f579adab1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/json/decoder.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/json/decoder.pyi @@ -13,6 +13,7 @@ class JSONDecodeError(ValueError): pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos + """ msg: str @@ -49,6 +50,7 @@ class JSONDecoder: It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. + """ object_hook: Callable[[dict[str, Any]], Any] @@ -103,6 +105,7 @@ class JSONDecoder: def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: # _w is undocumented """Return the Python representation of ``s`` (a ``str`` instance containing a JSON document). + """ def raw_decode(self, s: str, idx: int = 0) -> tuple[Any, int]: @@ -112,4 +115,5 @@ class JSONDecoder: This can be used to decode a JSON document from a string that may have extraneous data at the end. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/json/encoder.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/json/encoder.pyi index 86b93864fe..b28d343d59 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/json/encoder.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/json/encoder.pyi @@ -55,6 +55,7 @@ class JSONEncoder: ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). + """ item_separator: str @@ -115,6 +116,7 @@ class JSONEncoder: If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. + """ def default(self, o: Any) -> Any: @@ -134,6 +136,7 @@ class JSONEncoder: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) + """ def encode(self, o: Any) -> str: @@ -142,6 +145,7 @@ class JSONEncoder: >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' + """ def iterencode(self, o: Any, _one_shot: bool = False) -> Iterator[str]: @@ -152,4 +156,5 @@ class JSONEncoder: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/fixes/fix_import.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/fixes/fix_import.pyi index bb89d8e595..87577fd281 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/fixes/fix_import.pyi @@ -18,7 +18,9 @@ from .. import fixer_base from ..pytree import Node def traverse_imports(names) -> Generator[str, None, None]: - """Walks over all the names imported in a dotted_as_names node.""" + """ + Walks over all the names imported in a dotted_as_names node. + """ class FixImport(fixer_base.BaseFix): BM_compatible: ClassVar[Literal[True]] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/main.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/main.pyi index 1912aca72f..1a176b656c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/main.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/main.pyi @@ -13,7 +13,8 @@ def diff_texts(a: str, b: str, filename: str) -> Iterator[str]: """Return a unified diff of two strings.""" class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): - """A refactoring tool that can avoid overwriting its input files. + """ + A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or @@ -34,22 +35,23 @@ class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): output_dir: str = "", append_suffix: str = "", ) -> None: - """Args: - fixers: A list of fixers to import. - options: A dict with RefactoringTool configuration. - explicit: A list of fixers to run even if they are explicit. - nobackups: If true no backup '.bak' files will be created for those - files that are being refactored. - show_diffs: Should diffs of the refactoring be printed to stdout? - input_base_dir: The base directory for all input files. This class - will strip this path prefix off of filenames before substituting - it with output_dir. Only meaningful if output_dir is supplied. - All files processed by refactor() must start with this path. - output_dir: If supplied, all converted files will be written into - this directory tree instead of input_base_dir. - append_suffix: If supplied, all files output by this tool will have - this appended to their filename. Useful for changing .py to - .py3 for example by passing append_suffix='3'. + """ + Args: + fixers: A list of fixers to import. + options: A dict with RefactoringTool configuration. + explicit: A list of fixers to run even if they are explicit. + nobackups: If true no backup '.bak' files will be created for those + files that are being refactored. + show_diffs: Should diffs of the refactoring be printed to stdout? + input_base_dir: The base directory for all input files. This class + will strip this path prefix off of filenames before substituting + it with output_dir. Only meaningful if output_dir is supplied. + All files processed by refactor() must start with this path. + output_dir: If supplied, all converted files will be written into + this directory tree instead of input_base_dir. + append_suffix: If supplied, all files output by this tool will have + this appended to their filename. Useful for changing .py to + .py3 for example by passing append_suffix='3'. """ # Same as super.log_error and Logger.error def log_error( # type: ignore[override] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/grammar.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/grammar.pyi index 7cd50198e5..abfd18b546 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/grammar.pyi @@ -67,6 +67,7 @@ class Grammar: keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. + """ symbol2number: dict[str, int] @@ -85,7 +86,9 @@ class Grammar: """Load the grammar tables from a pickle file.""" def copy(self) -> Self: - """Copy the grammar.""" + """ + Copy the grammar. + """ def report(self) -> None: """Dump the grammar tables to standard output, for debugging.""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/parse.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/parse.pyi index b36641f554..a1841da5f6 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/parse.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/parse.pyi @@ -53,6 +53,7 @@ class Parser: the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). + """ grammar: Grammar @@ -87,6 +88,7 @@ class Parser: An abstract syntax tree node may be anything; this is entirely up to the converter function. + """ def setup(self, start: int | None = None) -> None: @@ -100,6 +102,7 @@ class Parser: You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. + """ def addtoken(self, type: int, value: str | None, context: _Context) -> bool: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi index bc7cfe9193..ec35feb9ad 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi @@ -108,7 +108,8 @@ class TokenError(Exception): ... class StopTokenizing(Exception): ... def tokenize(readline: Callable[[], str], tokeneater: _TokenEater = ...) -> None: - """The tokenize() function accepts two parameters: one representing the + """ + The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides @@ -148,7 +149,8 @@ def untokenize(iterable: Iterable[_TokenInfo]) -> str: """ def generate_tokens(readline: Callable[[], str]) -> Iterator[_TokenInfo]: - """The generate_tokens() generator requires one argument, readline, which + """ + The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pytree.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pytree.pyi index 0d348566bf..1c2a2b4d97 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pytree.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/pytree.pyi @@ -26,7 +26,8 @@ HUGE: Final = 0x7FFFFFFF def type_repr(type_num: int) -> str | int: ... class Base: - """Abstract base class for Node and Leaf. + """ + Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. @@ -41,14 +42,16 @@ class Base: was_changed: bool was_checked: bool def __eq__(self, other: object) -> bool: - """Compare two nodes for equality. + """ + Compare two nodes for equality. This calls the method _eq(). """ __hash__: ClassVar[None] # type: ignore[assignment] @abstractmethod def _eq(self, other: Base) -> bool: - """Compare two nodes for equality. + """ + Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. @@ -58,21 +61,24 @@ class Base: @abstractmethod def clone(self) -> Self: - """Return a cloned (deep) copy of self. + """ + Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. """ @abstractmethod def post_order(self) -> Iterator[Self]: - """Return a post-order iterator for the tree. + """ + Return a post-order iterator for the tree. This must be implemented by the concrete subclass. """ @abstractmethod def pre_order(self) -> Iterator[Self]: - """Return a pre-order iterator for the tree. + """ + Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. """ @@ -85,26 +91,30 @@ class Base: def changed(self) -> None: ... def remove(self) -> int | None: - """Remove the node from the tree. Returns the position of the node in its + """ + Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. """ @property def next_sibling(self) -> _NL | None: - """The node immediately following the invocant in their parent's children + """ + The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None """ @property def prev_sibling(self) -> _NL | None: - """The node immediately preceding the invocant in their parent's children + """ + The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. """ def leaves(self) -> Iterator[Leaf]: ... def depth(self) -> int: ... def get_suffix(self) -> str: - """Return the string immediately following the invocant node. This is + """ + Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix """ @@ -124,7 +134,8 @@ class Node(Base): prefix: str | None = None, fixers_applied: MutableSequence[BaseFix] | None = None, ) -> None: - """Initializer. + """ + Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. @@ -145,22 +156,26 @@ class Node(Base): """Return a pre-order iterator for the tree.""" def set_child(self, i: int, child: _NL) -> None: - """Equivalent to 'node.children[i] = child'. This method also sets the + """ + Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. """ def insert_child(self, i: int, child: _NL) -> None: - """Equivalent to 'node.children.insert(i, child)'. This method also sets + """ + Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. """ def append_child(self, child: _NL) -> None: - """Equivalent to 'node.children.append(child)'. This method also sets the + """ + Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. """ def __unicode__(self) -> str: - """Return a pretty string representation. + """ + Return a pretty string representation. This reproduces the input source exactly. """ @@ -180,7 +195,8 @@ class Leaf(Base): prefix: str | None = None, fixers_applied: MutableSequence[BaseFix] = [], ) -> None: - """Initializer. + """ + Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. @@ -199,13 +215,15 @@ class Leaf(Base): """Return a pre-order iterator for the tree.""" def __unicode__(self) -> str: - """Return a pretty string representation. + """ + Return a pretty string representation. This reproduces the input source exactly. """ def convert(gr: Grammar, raw_node: _RawNode) -> _NL: - """Convert raw node information to a Node or Leaf instance. + """ + Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build @@ -213,7 +231,8 @@ def convert(gr: Grammar, raw_node: _RawNode) -> _NL: """ class BasePattern: - """A pattern is a tree matching pattern. + """ + A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. @@ -230,13 +249,15 @@ class BasePattern: content: str | None name: str | None def optimize(self) -> BasePattern: # sic, subclasses are free to optimize themselves into different patterns - """A subclass can define this as a hook for optimizations. + """ + A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. """ def match(self, node: _NL, results: _Results | None = None) -> bool: - """Does this pattern exactly match a node? + """ + Does this pattern exactly match a node? Returns True if it matches, False if not. @@ -247,20 +268,23 @@ class BasePattern: """ def match_seq(self, nodes: SupportsLenAndGetItem[_NL], results: _Results | None = None) -> bool: - """Does this pattern exactly match a sequence of nodes? + """ + Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. """ def generate_matches(self, nodes: SupportsGetItem[int, _NL]) -> Iterator[tuple[int, _Results]]: - """Generator yielding all matches for this pattern. + """ + Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. """ class LeafPattern(BasePattern): def __init__(self, type: int | None = None, content: str | None = None, name: str | None = None) -> None: - """Initializer. Takes optional type, content, and name. + """ + Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. @@ -274,7 +298,8 @@ class LeafPattern(BasePattern): class NodePattern(BasePattern): wildcards: bool def __init__(self, type: int | None = None, content: str | None = None, name: str | None = None) -> None: - """Initializer. Takes optional type, content, and name. + """ + Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), @@ -290,7 +315,8 @@ class NodePattern(BasePattern): """ class WildcardPattern(BasePattern): - """A wildcard pattern can match zero or more nodes. + """ + A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: @@ -304,7 +330,8 @@ class WildcardPattern(BasePattern): min: int max: int def __init__(self, content: str | None = None, min: int = 0, max: int = 0x7FFFFFFF, name: str | None = None) -> None: - """Initializer. + """ + Initializer. Args: content: optional sequence of subsequences of patterns; @@ -328,7 +355,8 @@ class WildcardPattern(BasePattern): class NegatedPattern(BasePattern): def __init__(self, content: str | None = None) -> None: - """Initializer. + """ + Initializer. The argument is either a pattern or None. If it is None, this only matches an empty sequence (effectively '$' in regex @@ -339,7 +367,8 @@ class NegatedPattern(BasePattern): def generate_matches( patterns: SupportsGetItem[int | slice, BasePattern] | None, nodes: SupportsGetItem[int | slice, _NL] ) -> Iterator[tuple[int, _Results]]: - """Generator yielding matches for a sequence of patterns and nodes. + """ + Generator yielding matches for a sequence of patterns and nodes. Args: patterns: a sequence of patterns diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/refactor.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/refactor.pyi index 2bc4725c31..cd788ee2dc 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/refactor.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lib2to3/refactor.pyi @@ -22,7 +22,9 @@ def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = True) -> list[str]: """Return a sorted list of all available fix names in the given package.""" def get_fixers_from_package(pkg_name: str) -> list[str]: - """Return the fully qualified names for fixers in the package pkg_name.""" + """ + Return the fully qualified names for fixers in the package pkg_name. + """ class FixerError(Exception): """A fixer could not be loaded.""" @@ -96,7 +98,9 @@ class RefactoringTool: """ def _read_python_source(self, filename: FileDescriptorOrPath) -> tuple[str, str]: - """Do our best to decode a Python source file correctly.""" + """ + Do our best to decode a Python source file correctly. + """ def refactor_file(self, filename: StrPath, write: bool = False, doctests_only: bool = False) -> None: """Refactors a file.""" @@ -146,7 +150,9 @@ class RefactoringTool: def processed_file( self, new_text: str, filename: StrPath, old_text: str | None = None, write: bool = False, encoding: str | None = None ) -> None: - """Called when a file has been refactored and there may be changes.""" + """ + Called when a file has been refactored and there may be changes. + """ def write_file(self, new_text: str, filename: FileDescriptorOrPath, old_text: str, encoding: str | None = None) -> None: """Writes a string to a file. @@ -176,6 +182,7 @@ class RefactoringTool: A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). + """ def summarize(self) -> None: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/locale.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/locale.pyi index f4cf197498..c121dabe86 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/locale.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/locale.pyi @@ -160,6 +160,7 @@ def getdefaultlocale(envvars: tuple[_str, ...] = ("LC_ALL", "LC_CTYPE", "LANG", Except for the code 'C', the language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined. + """ def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: @@ -172,6 +173,7 @@ def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: Except for the code 'C', the language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined. + """ def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None) -> _str: @@ -183,6 +185,7 @@ def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None) engine. Locale strings are passed directly to the C lib. category may be given as one of the LC_* values. + """ def getpreferredencoding(do_setlocale: bool = True) -> _str: @@ -203,6 +206,7 @@ def normalize(localename: _str) -> _str: If the given encoding is not known, the function defaults to the default encoding for the locale code just like setlocale() does. + """ if sys.version_info < (3, 13): @@ -211,6 +215,7 @@ if sys.version_info < (3, 13): The default setting is determined by calling getdefaultlocale(). category defaults to LC_ALL. + """ if sys.version_info < (3, 12): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/logging/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/logging/__init__.pyi index ef10f345d3..2edd351345 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/logging/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/logging/__init__.pyi @@ -98,19 +98,25 @@ _levelToName: dict[int, str] _nameToLevel: dict[str, int] class Filterer: - """A base class for loggers and handlers which allows them to share + """ + A base class for loggers and handlers which allows them to share common code. """ filters: list[_FilterType] def addFilter(self, filter: _FilterType) -> None: - """Add the specified filter to this handler.""" + """ + Add the specified filter to this handler. + """ def removeFilter(self, filter: _FilterType) -> None: - """Remove the specified filter from this handler.""" + """ + Remove the specified filter from this handler. + """ if sys.version_info >= (3, 12): def filter(self, record: LogRecord) -> bool | LogRecord: - """Determine if a record is loggable by consulting all the filters. + """ + Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this by returning a false value. @@ -135,7 +141,8 @@ class Filterer: """ else: def filter(self, record: LogRecord) -> bool: - """Determine if a record is loggable by consulting all the filters. + """ + Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record @@ -147,7 +154,8 @@ class Filterer: """ class Manager: # undocumented - """There is [under normal circumstances] just one Manager instance, which + """ + There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers. """ @@ -158,10 +166,13 @@ class Manager: # undocumented loggerClass: type[Logger] | None logRecordFactory: Callable[..., LogRecord] | None def __init__(self, rootnode: RootLogger) -> None: - """Initialize the manager with the root node of the logger hierarchy.""" + """ + Initialize the manager with the root node of the logger hierarchy. + """ def getLogger(self, name: str) -> Logger: - """Get a logger with the specified name (channel name), creating it + """ + Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separated hierarchical name, such as "a", "a.b", "a.b.c" or similar. @@ -172,15 +183,19 @@ class Manager: # undocumented """ def setLoggerClass(self, klass: type[Logger]) -> None: - """Set the class to be used when instantiating a logger with this Manager.""" + """ + Set the class to be used when instantiating a logger with this Manager. + """ def setLogRecordFactory(self, factory: Callable[..., LogRecord]) -> None: - """Set the factory to be used when instantiating a log record with this + """ + Set the factory to be used when instantiating a log record with this Manager. """ class Logger(Filterer): - """Instances of the Logger class represent a single logging channel. A + """ + Instances of the Logger class represent a single logging channel. A "logging channel" indicates an area of an application. Exactly how an "area" is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified @@ -203,23 +218,31 @@ class Logger(Filterer): root: ClassVar[RootLogger] # undocumented manager: Manager # undocumented def __init__(self, name: str, level: _Level = 0) -> None: - """Initialize the logger with a name and an optional level.""" + """ + Initialize the logger with a name and an optional level. + """ def setLevel(self, level: _Level) -> None: - """Set the logging level of this logger. level must be an int or a str.""" + """ + Set the logging level of this logger. level must be an int or a str. + """ def isEnabledFor(self, level: int) -> bool: - """Is this logger enabled for level 'level'?""" + """ + Is this logger enabled for level 'level'? + """ def getEffectiveLevel(self) -> int: - """Get the effective level for this logger. + """ + Get the effective level for this logger. Loop through this logger and its parents in the logger hierarchy, looking for a non-zero logging level. Return the first one found. """ def getChild(self, suffix: str) -> Self: # see python/typing#980 - """Get a logger which is a descendant to this one. + """ + Get a logger which is a descendant to this one. This is a convenience method, such that @@ -244,7 +267,8 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with severity 'DEBUG'. + """ + Log 'msg % args' with severity 'DEBUG'. To pass exception information, use the keyword argument exc_info with a true value, e.g. @@ -261,7 +285,8 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with severity 'INFO'. + """ + Log 'msg % args' with severity 'INFO'. To pass exception information, use the keyword argument exc_info with a true value, e.g. @@ -278,7 +303,8 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with severity 'WARNING'. + """ + Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. @@ -305,7 +331,8 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with severity 'ERROR'. + """ + Log 'msg % args' with severity 'ERROR'. To pass exception information, use the keyword argument exc_info with a true value, e.g. @@ -322,7 +349,9 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Convenience method for logging an ERROR with exception information.""" + """ + Convenience method for logging an ERROR with exception information. + """ def critical( self, @@ -333,7 +362,8 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with severity 'CRITICAL'. + """ + Log 'msg % args' with severity 'CRITICAL'. To pass exception information, use the keyword argument exc_info with a true value, e.g. @@ -351,7 +381,8 @@ class Logger(Filterer): stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with the integer severity 'level'. + """ + Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. @@ -369,23 +400,30 @@ class Logger(Filterer): stack_info: bool = False, stacklevel: int = 1, ) -> None: # undocumented - """Low-level logging routine which creates a LogRecord and then calls + """ + Low-level logging routine which creates a LogRecord and then calls all the handlers of this logger to handle the record. """ fatal = critical def addHandler(self, hdlr: Handler) -> None: - """Add the specified handler to this logger.""" + """ + Add the specified handler to this logger. + """ def removeHandler(self, hdlr: Handler) -> None: - """Remove the specified handler from this logger.""" + """ + Remove the specified handler from this logger. + """ def findCaller(self, stack_info: bool = False, stacklevel: int = 1) -> tuple[str, int, str, str | None]: - """Find the stack frame of the caller so that we can note the source + """ + Find the stack frame of the caller so that we can note the source file name, line number and function name. """ def handle(self, record: LogRecord) -> None: - """Call the handlers for the specified record. + """ + Call the handlers for the specified record. This method is used for unpickled records received from a socket, as well as those created locally. Logger-level filtering is applied. @@ -404,12 +442,14 @@ class Logger(Filterer): extra: Mapping[str, object] | None = None, sinfo: str | None = None, ) -> LogRecord: - """A factory method which can be overridden in subclasses to create + """ + A factory method which can be overridden in subclasses to create specialized LogRecords. """ def hasHandlers(self) -> bool: - """See if this logger has any handlers configured. + """ + See if this logger has any handlers configured. Loop through all handlers for this logger and its parents in the logger hierarchy. Return True if a handler was found, else False. @@ -419,7 +459,8 @@ class Logger(Filterer): """ def callHandlers(self, record: LogRecord) -> None: # undocumented - """Pass a record to all relevant handlers. + """ + Pass a record to all relevant handlers. Loop through all handlers for this logger and its parents in the logger hierarchy. If no handler was found, output a one-off error @@ -438,7 +479,8 @@ DEBUG: Final = 10 NOTSET: Final = 0 class Handler(Filterer): - """Handler instances dispatch logging events to specific destinations. + """ + Handler instances dispatch logging events to specific destinations. The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format @@ -451,36 +493,49 @@ class Handler(Filterer): lock: threading.Lock | None # undocumented name: str | None # undocumented def __init__(self, level: _Level = 0) -> None: - """Initializes the instance - basically setting the formatter to None + """ + Initializes the instance - basically setting the formatter to None and the filter list to empty. """ def get_name(self) -> str: ... # undocumented def set_name(self, name: str) -> None: ... # undocumented def createLock(self) -> None: - """Acquire a thread lock for serializing access to the underlying I/O.""" + """ + Acquire a thread lock for serializing access to the underlying I/O. + """ def acquire(self) -> None: - """Acquire the I/O thread lock.""" + """ + Acquire the I/O thread lock. + """ def release(self) -> None: - """Release the I/O thread lock.""" + """ + Release the I/O thread lock. + """ def setLevel(self, level: _Level) -> None: - """Set the logging level of this handler. level must be an int or a str.""" + """ + Set the logging level of this handler. level must be an int or a str. + """ def setFormatter(self, fmt: Formatter | None) -> None: - """Set the formatter for this handler.""" + """ + Set the formatter for this handler. + """ def flush(self) -> None: - """Ensure all logging output has been flushed. + """ + Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. """ def close(self) -> None: - """Tidy up any resources used by the handler. + """ + Tidy up any resources used by the handler. This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses @@ -489,7 +544,8 @@ class Handler(Filterer): """ def handle(self, record: LogRecord) -> bool: - """Conditionally emit the specified logging record. + """ + Conditionally emit the specified logging record. Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of @@ -500,7 +556,8 @@ class Handler(Filterer): """ def handleError(self, record: LogRecord) -> None: - """Handle errors which occur during an emit() call. + """ + Handle errors which occur during an emit() call. This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, @@ -512,14 +569,16 @@ class Handler(Filterer): """ def format(self, record: LogRecord) -> str: - """Format the specified record. + """ + Format the specified record. If a formatter is set, use it. Otherwise, use the default formatter for the module. """ def emit(self, record: LogRecord) -> None: - """Do whatever it takes to actually log the specified logging record. + """ + Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a NotImplementedError. @@ -527,15 +586,19 @@ class Handler(Filterer): if sys.version_info >= (3, 12): def getHandlerByName(name: str) -> Handler | None: - """Get a handler with the specified *name*, or None if there isn't one with + """ + Get a handler with the specified *name*, or None if there isn't one with that name. """ def getHandlerNames() -> frozenset[str]: - """Return all known handler names as an immutable set.""" + """ + Return all known handler names as an immutable set. + """ class Formatter: - """Formatter instances are used to convert a LogRecord to text. + """ + Formatter instances are used to convert a LogRecord to text. Formatters need to know how a LogRecord is constructed. They are responsible for converting a LogRecord to (usually) a string which can @@ -595,7 +658,8 @@ class Formatter: *, defaults: Mapping[str, Any] | None = None, ) -> None: - """Initialize the formatter with specified format strings. + """ + Initialize the formatter with specified format strings. Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with @@ -613,7 +677,8 @@ class Formatter: def __init__( self, fmt: str | None = None, datefmt: str | None = None, style: _FormatStyle = "%", validate: bool = True ) -> None: - """Initialize the formatter with specified format strings. + """ + Initialize the formatter with specified format strings. Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with @@ -629,7 +694,8 @@ class Formatter: """ def format(self, record: LogRecord) -> str: - """Format the specified record as text. + """ + Format the specified record as text. The record's attribute dictionary is used as the operand to a string formatting operation which yields the returned string. @@ -642,7 +708,8 @@ class Formatter: """ def formatTime(self, record: LogRecord, datefmt: str | None = None) -> str: - """Return the creation time of the specified LogRecord as formatted text. + """ + Return the creation time of the specified LogRecord as formatted text. This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden @@ -660,7 +727,8 @@ class Formatter: """ def formatException(self, ei: _SysExcInfoType) -> str: - """Format and return the specified exception information as a string. + """ + Format and return the specified exception information as a string. This default implementation just uses traceback.print_exception() @@ -668,7 +736,8 @@ class Formatter: def formatMessage(self, record: LogRecord) -> str: ... # undocumented def formatStack(self, stack_info: str) -> str: - """This method is provided as an extension point for specialized + """ + This method is provided as an extension point for specialized formatting of stack information. The input data is a string as returned from a call to @@ -679,28 +748,40 @@ class Formatter: """ def usesTime(self) -> bool: # undocumented - """Check if the format uses the creation time of the record.""" + """ + Check if the format uses the creation time of the record. + """ class BufferingFormatter: - """A formatter suitable for formatting a number of records.""" + """ + A formatter suitable for formatting a number of records. + """ linefmt: Formatter def __init__(self, linefmt: Formatter | None = None) -> None: - """Optionally specify a formatter which will be used to format each + """ + Optionally specify a formatter which will be used to format each individual record. """ def formatHeader(self, records: Sequence[LogRecord]) -> str: - """Return the header string for the specified records.""" + """ + Return the header string for the specified records. + """ def formatFooter(self, records: Sequence[LogRecord]) -> str: - """Return the footer string for the specified records.""" + """ + Return the footer string for the specified records. + """ def format(self, records: Sequence[LogRecord]) -> str: - """Format the specified records and return the result as a string.""" + """ + Format the specified records and return the result as a string. + """ class Filter: - """Filter instances are used to perform arbitrary filtering of LogRecords. + """ + Filter instances are used to perform arbitrary filtering of LogRecords. Loggers and Handlers can optionally use Filter instances to filter records as desired. The base filter class only allows events which are @@ -713,7 +794,8 @@ class Filter: name: str # undocumented nlen: int # undocumented def __init__(self, name: str = "") -> None: - """Initialize a filter. + """ + Initialize a filter. Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no @@ -721,21 +803,24 @@ class Filter: """ if sys.version_info >= (3, 12): def filter(self, record: LogRecord) -> bool | LogRecord: - """Determine if the specified record is to be logged. + """ + Determine if the specified record is to be logged. Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place. """ else: def filter(self, record: LogRecord) -> bool: - """Determine if the specified record is to be logged. + """ + Determine if the specified record is to be logged. Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place. """ class LogRecord: - """A LogRecord instance represents an event being logged. + """ + A LogRecord instance represents an event being logged. LogRecord instances are created every time something is logged. They contain all the information pertinent to the event being logged. The @@ -786,10 +871,13 @@ class LogRecord: func: str | None = None, sinfo: str | None = None, ) -> None: - """Initialize a logging record with interesting information.""" + """ + Initialize a logging record with interesting information. + """ def getMessage(self) -> str: - """Return the message for this LogRecord. + """ + Return the message for this LogRecord. Return the message for this LogRecord after merging any user-supplied arguments with the message. @@ -800,7 +888,8 @@ class LogRecord: _L = TypeVar("_L", bound=Logger | LoggerAdapter[Any]) class LoggerAdapter(Generic[_L]): - """An adapter for loggers which makes it easier to specify contextual + """ + An adapter for loggers which makes it easier to specify contextual information in logging output. """ @@ -809,7 +898,8 @@ class LoggerAdapter(Generic[_L]): if sys.version_info >= (3, 13): def __init__(self, logger: _L, extra: Mapping[str, object] | None = None, merge_extra: bool = False) -> None: - """Initialize the adapter with a logger and a dict-like object which + """ + Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. @@ -830,7 +920,8 @@ class LoggerAdapter(Generic[_L]): """ elif sys.version_info >= (3, 10): def __init__(self, logger: _L, extra: Mapping[str, object] | None = None) -> None: - """Initialize the adapter with a logger and a dict-like object which + """ + Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. @@ -841,7 +932,8 @@ class LoggerAdapter(Generic[_L]): """ else: def __init__(self, logger: _L, extra: Mapping[str, object]) -> None: - """Initialize the adapter with a logger and a dict-like object which + """ + Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired. @@ -859,7 +951,8 @@ class LoggerAdapter(Generic[_L]): merge_extra: bool def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> tuple[Any, MutableMapping[str, Any]]: - """Process the logging message and keyword arguments passed in to + """ + Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs. @@ -878,7 +971,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate a debug call to the underlying logger.""" + """ + Delegate a debug call to the underlying logger. + """ def info( self, @@ -890,7 +985,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate an info call to the underlying logger.""" + """ + Delegate an info call to the underlying logger. + """ def warning( self, @@ -902,7 +999,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate a warning call to the underlying logger.""" + """ + Delegate a warning call to the underlying logger. + """ @deprecated("Deprecated; use warning() instead.") def warn( @@ -925,7 +1024,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate an error call to the underlying logger.""" + """ + Delegate an error call to the underlying logger. + """ def exception( self, @@ -937,7 +1038,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate an exception call to the underlying logger.""" + """ + Delegate an exception call to the underlying logger. + """ def critical( self, @@ -949,7 +1052,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate a critical call to the underlying logger.""" + """ + Delegate a critical call to the underlying logger. + """ def log( self, @@ -962,21 +1067,30 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, **kwargs: object, ) -> None: - """Delegate a log call to the underlying logger, after adding + """ + Delegate a log call to the underlying logger, after adding contextual information from this adapter instance. """ def isEnabledFor(self, level: int) -> bool: - """Is this logger enabled for level 'level'?""" + """ + Is this logger enabled for level 'level'? + """ def getEffectiveLevel(self) -> int: - """Get the effective level for the underlying logger.""" + """ + Get the effective level for the underlying logger. + """ def setLevel(self, level: _Level) -> None: - """Set the specified level on the underlying logger.""" + """ + Set the specified level on the underlying logger. + """ def hasHandlers(self) -> bool: - """See if the underlying logger has any handlers.""" + """ + See if the underlying logger has any handlers. + """ if sys.version_info >= (3, 11): def _log( self, @@ -988,7 +1102,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, stack_info: bool = False, ) -> None: # undocumented - """Low-level log implementation, proxied to allow nested logger adapters.""" + """ + Low-level log implementation, proxied to allow nested logger adapters. + """ else: def _log( self, @@ -999,7 +1115,9 @@ class LoggerAdapter(Generic[_L]): extra: Mapping[str, object] | None = None, stack_info: bool = False, ) -> None: # undocumented - """Low-level log implementation, proxied to allow nested logger adapters.""" + """ + Low-level log implementation, proxied to allow nested logger adapters. + """ @property def name(self) -> str: ... # undocumented @@ -1011,16 +1129,21 @@ class LoggerAdapter(Generic[_L]): """ def getLogger(name: str | None = None) -> Logger: - """Return a logger with the specified name, creating it if necessary. + """ + Return a logger with the specified name, creating it if necessary. If no name is specified, return the root logger. """ def getLoggerClass() -> type[Logger]: - """Return the class to be used when instantiating a logger.""" + """ + Return the class to be used when instantiating a logger. + """ def getLogRecordFactory() -> Callable[..., LogRecord]: - """Return the factory to be used when instantiating a log record.""" + """ + Return the factory to be used when instantiating a log record. + """ def debug( msg: object, @@ -1030,7 +1153,8 @@ def debug( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log a message with severity 'DEBUG' on the root logger. If the logger has + """ + Log a message with severity 'DEBUG' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. """ @@ -1043,7 +1167,8 @@ def info( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log a message with severity 'INFO' on the root logger. If the logger has + """ + Log a message with severity 'INFO' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. """ @@ -1056,7 +1181,8 @@ def warning( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log a message with severity 'WARNING' on the root logger. If the logger has + """ + Log a message with severity 'WARNING' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. """ @@ -1078,7 +1204,8 @@ def error( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log a message with severity 'ERROR' on the root logger. If the logger has + """ + Log a message with severity 'ERROR' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. """ @@ -1091,7 +1218,8 @@ def critical( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log a message with severity 'CRITICAL' on the root logger. If the logger + """ + Log a message with severity 'CRITICAL' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. """ @@ -1104,7 +1232,8 @@ def exception( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log a message with severity 'ERROR' on the root logger, with exception + """ + Log a message with severity 'ERROR' on the root logger, with exception information. If the logger has no handlers, basicConfig() is called to add a console handler with a pre-defined format. """ @@ -1118,7 +1247,8 @@ def log( stacklevel: int = 1, extra: Mapping[str, object] | None = None, ) -> None: - """Log 'msg % args' with the integer severity 'level' on the root logger. If + """ + Log 'msg % args' with the integer severity 'level' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format. """ @@ -1126,17 +1256,21 @@ def log( fatal = critical def disable(level: int = 50) -> None: - """Disable all logging calls of severity 'level' and below.""" + """ + Disable all logging calls of severity 'level' and below. + """ def addLevelName(level: int, levelName: str) -> None: - """Associate 'levelName' with 'level'. + """ + Associate 'levelName' with 'level'. This is used when converting levels to text during message formatting. """ @overload def getLevelName(level: int) -> str: - """Return the textual or numeric representation of logging level 'level'. + """ + Return the textual or numeric representation of logging level 'level'. If the level is one of the predefined levels (CRITICAL, ERROR, WARNING, INFO, DEBUG) then you get the corresponding string. If you have @@ -1161,7 +1295,8 @@ if sys.version_info >= (3, 11): def getLevelNamesMapping() -> dict[str, int]: ... def makeLogRecord(dict: Mapping[str, object]) -> LogRecord: - """Make a LogRecord whose attributes are defined by the specified dictionary, + """ + Make a LogRecord whose attributes are defined by the specified dictionary, This function is useful for converting a logging event received over a socket connection (which is sent as a dictionary) into a LogRecord instance. @@ -1181,7 +1316,8 @@ def basicConfig( encoding: str | None = ..., errors: str | None = ..., ) -> None: - """Do basic configuration for the logging system. + """ + Do basic configuration for the logging system. This function does nothing if the root logger already has handlers configured, unless the keyword argument *force* is set to ``True``. @@ -1249,26 +1385,30 @@ def basicConfig( """ def shutdown(handlerList: Sequence[Any] = ...) -> None: # handlerList is undocumented - """Perform any cleanup actions in the logging system (e.g. flushing + """ + Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. """ def setLoggerClass(klass: type[Logger]) -> None: - """Set the class to be used when instantiating a logger. The class should + """ + Set the class to be used when instantiating a logger. The class should define __init__() such that only a name argument is required, and the __init__() should call Logger.__init__() """ def captureWarnings(capture: bool) -> None: - """If capture is true, redirect all warnings to the logging package. + """ + If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations. """ def setLogRecordFactory(factory: Callable[..., LogRecord]) -> None: - """Set the factory to be used when instantiating a log record. + """ + Set the factory to be used when instantiating a log record. :param factory: A callable which will be called to instantiate a log record. @@ -1279,7 +1419,8 @@ lastResort: Handler | None _StreamT = TypeVar("_StreamT", bound=SupportsWrite[str]) class StreamHandler(Handler, Generic[_StreamT]): - """A handler class which writes logging records, appropriately formatted, + """ + A handler class which writes logging records, appropriately formatted, to a stream. Note that this class does not close the stream, as sys.stdout or sys.stderr may be used. """ @@ -1288,7 +1429,8 @@ class StreamHandler(Handler, Generic[_StreamT]): terminator: str @overload def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: - """Initialize the handler. + """ + Initialize the handler. If stream is not specified, sys.stderr is used. """ @@ -1296,7 +1438,8 @@ class StreamHandler(Handler, Generic[_StreamT]): @overload def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780 def setStream(self, stream: _StreamT) -> _StreamT | None: - """Sets the StreamHandler's stream to the specified value, + """ + Sets the StreamHandler's stream to the specified value, if it is different. Returns the old stream, if the stream was changed, or None @@ -1310,7 +1453,9 @@ class StreamHandler(Handler, Generic[_StreamT]): """ class FileHandler(StreamHandler[TextIOWrapper]): - """A handler class which writes formatted logging records to disk files.""" + """ + A handler class which writes formatted logging records to disk files. + """ baseFilename: str # undocumented mode: str # undocumented @@ -1320,15 +1465,19 @@ class FileHandler(StreamHandler[TextIOWrapper]): def __init__( self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False, errors: str | None = None ) -> None: - """Open the specified file and use it as the stream for logging.""" + """ + Open the specified file and use it as the stream for logging. + """ def _open(self) -> TextIOWrapper: # undocumented - """Open the current base file with the (original) mode and encoding. + """ + Open the current base file with the (original) mode and encoding. Return the resulting stream. """ class NullHandler(Handler): - """This handler does nothing. It's intended to be used to avoid the + """ + This handler does nothing. It's intended to be used to avoid the "No handlers could be found for logger XXX" one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off warning might be @@ -1338,28 +1487,36 @@ class NullHandler(Handler): """ class PlaceHolder: # undocumented - """PlaceHolder instances are used in the Manager logger hierarchy to take + """ + PlaceHolder instances are used in the Manager logger hierarchy to take the place of nodes for which no loggers have been defined. This class is intended for internal use only and not as part of the public API. """ loggerMap: dict[Logger, None] def __init__(self, alogger: Logger) -> None: - """Initialize with the specified logger being a child of this placeholder.""" + """ + Initialize with the specified logger being a child of this placeholder. + """ def append(self, alogger: Logger) -> None: - """Add the specified logger as a child of this placeholder.""" + """ + Add the specified logger as a child of this placeholder. + """ # Below aren't in module docs but still visible class RootLogger(Logger): - """A root logger is not that different to any other logger, except that + """ + A root logger is not that different to any other logger, except that it must have a logging level and there is only one instance of it in the hierarchy. """ def __init__(self, level: int) -> None: - """Initialize the logger with the name "root".""" + """ + Initialize the logger with the name "root". + """ root: RootLogger diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/logging/config.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/logging/config.pyi index bcc1846189..51f3439661 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/logging/config.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/logging/config.pyi @@ -83,7 +83,8 @@ if sys.version_info >= (3, 10): disable_existing_loggers: bool = True, encoding: str | None = None, ) -> None: - """Read the logging configuration from a ConfigParser-format file. + """ + Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the @@ -97,7 +98,8 @@ else: defaults: Mapping[str, str] | None = None, disable_existing_loggers: bool = True, ) -> None: - """Read the logging configuration from a ConfigParser-format file. + """ + Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the @@ -107,7 +109,8 @@ else: def valid_ident(s: str) -> Literal[True]: ... # undocumented def listen(port: int = 9030, verify: Callable[[bytes], bytes | None] | None = None) -> Thread: - """Start up a socket server on the specified port, and listen for new + """ + Start up a socket server on the specified port, and listen for new configurations. These will be sent as a file suitable for processing by fileConfig(). @@ -126,7 +129,9 @@ def listen(port: int = 9030, verify: Callable[[bytes], bytes | None] | None = No """ def stopListening() -> None: - """Stop the listening server which was created with a call to listen().""" + """ + Stop the listening server which was created with a call to listen(). + """ class ConvertingMixin: # undocumented """For ConvertingXXX's, this mixin class provides common functions""" @@ -159,7 +164,9 @@ class ConvertingTuple(tuple[Any, ...], ConvertingMixin): # undocumented def __getitem__(self, key: slice) -> Any: ... class BaseConfigurator: # undocumented - """The configurator base class which defines some useful defaults.""" + """ + The configurator base class which defines some useful defaults. + """ CONVERT_PATTERN: Pattern[str] WORD_PATTERN: Pattern[str] @@ -171,7 +178,8 @@ class BaseConfigurator: # undocumented def __init__(self, config: _DictConfigArgs | dict[str, Any]) -> None: ... def resolve(self, s: str) -> Any: - """Resolve strings to objects using standard import and attribute + """ + Resolve strings to objects using standard import and attribute syntax. """ @@ -182,7 +190,8 @@ class BaseConfigurator: # undocumented """Default converter for the cfg:// protocol.""" def convert(self, value: Any) -> Any: - """Convert values to an appropriate type. dicts, lists and tuples are + """ + Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. """ @@ -194,7 +203,8 @@ class BaseConfigurator: # undocumented """Utility function which converts lists to tuples.""" class DictConfigurator(BaseConfigurator): - """Configure logging using a dictionary-like object to describe the + """ + Configure logging using a dictionary-like object to describe the configuration. """ @@ -219,7 +229,9 @@ class DictConfigurator(BaseConfigurator): def common_logger_config( self, logger: Logger, config: _LoggerConfiguration, incremental: bool = False ) -> None: # undocumented - """Perform configuration which is common to root and non-root loggers.""" + """ + Perform configuration which is common to root and non-root loggers. + """ def configure_logger(self, name: str, config: _LoggerConfiguration, incremental: bool = False) -> None: # undocumented """Configure a non-root logger from a dictionary.""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/logging/handlers.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/logging/handlers.pyi index 075832a21e..ce2ef4bfa6 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/logging/handlers.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/logging/handlers.pyi @@ -31,7 +31,8 @@ SYSLOG_UDP_PORT: Final[int] SYSLOG_TCP_PORT: Final[int] class WatchedFileHandler(FileHandler): - """A handler for logging to a file, which watches the file + """ + A handler for logging to a file, which watches the file to see if it has changed while in use. This can happen because of usage of programs such as newsyslog and logrotate which perform log file rotation. This handler, intended for use under Unix, @@ -56,7 +57,8 @@ class WatchedFileHandler(FileHandler): ) -> None: ... def _statstream(self) -> None: ... # undocumented def reopenIfNeeded(self) -> None: - """Reopen log file if needed. + """ + Reopen log file if needed. Checks if the underlying file has changed, and if it has, close the old stream and reopen the file to get the @@ -64,7 +66,8 @@ class WatchedFileHandler(FileHandler): """ class BaseRotatingHandler(FileHandler): - """Base class for handlers that rotate log files at a certain point. + """ + Base class for handlers that rotate log files at a certain point. Not meant to be instantiated directly. Instead, use RotatingFileHandler or TimedRotatingFileHandler. """ @@ -74,10 +77,13 @@ class BaseRotatingHandler(FileHandler): def __init__( self, filename: StrPath, mode: str, encoding: str | None = None, delay: bool = False, errors: str | None = None ) -> None: - """Use the specified filename for streamed logging""" + """ + Use the specified filename for streamed logging + """ def rotation_filename(self, default_name: str) -> str: - """Modify the filename of a log file when rotating. + """ + Modify the filename of a log file when rotating. This is provided so that a custom filename can be provided. @@ -90,7 +96,8 @@ class BaseRotatingHandler(FileHandler): """ def rotate(self, source: str, dest: str) -> None: - """When rotating, rotate the current log. + """ + When rotating, rotate the current log. The default implementation calls the 'rotator' attribute of the handler, if it's callable, passing the source and dest arguments to @@ -104,7 +111,8 @@ class BaseRotatingHandler(FileHandler): """ class RotatingFileHandler(BaseRotatingHandler): - """Handler for logging to a set of files, which switches from one file + """ + Handler for logging to a set of files, which switches from one file to the next when the current file reaches a certain size. """ @@ -120,7 +128,8 @@ class RotatingFileHandler(BaseRotatingHandler): delay: bool = False, errors: str | None = None, ) -> None: - """Open the specified file and use it as the stream for logging. + """ + Open the specified file and use it as the stream for logging. By default, the file grows indefinitely. You can specify particular values of maxBytes and backupCount to allow the file to rollover at @@ -141,17 +150,21 @@ class RotatingFileHandler(BaseRotatingHandler): """ def doRollover(self) -> None: - """Do a rollover, as described in __init__().""" + """ + Do a rollover, as described in __init__(). + """ def shouldRollover(self, record: LogRecord) -> int: # undocumented - """Determine if rollover should occur. + """ + Determine if rollover should occur. Basically, see if the supplied record would cause the file to exceed the size limit we have. """ class TimedRotatingFileHandler(BaseRotatingHandler): - """Handler for logging to a file, rotating the log file at certain timed + """ + Handler for logging to a file, rotating the log file at certain timed intervals. If backupCount is > 0, when rollover is done, no more than backupCount @@ -180,7 +193,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler): errors: str | None = None, ) -> None: ... def doRollover(self) -> None: - """do a rollover; in this case, a date/time stamp is appended to the filename + """ + do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove @@ -188,23 +202,28 @@ class TimedRotatingFileHandler(BaseRotatingHandler): """ def shouldRollover(self, record: LogRecord) -> int: # undocumented - """Determine if rollover should occur. + """ + Determine if rollover should occur. record is not used, as we are just comparing times, but it is needed so the method signatures are the same """ def computeRollover(self, currentTime: int) -> int: # undocumented - """Work out the rollover time based on the specified time.""" + """ + Work out the rollover time based on the specified time. + """ def getFilesToDelete(self) -> list[str]: # undocumented - """Determine the files to delete when rolling over. + """ + Determine the files to delete when rolling over. More specific than the earlier method, which just used glob.glob(). """ class SocketHandler(Handler): - """A handler class which writes logging records, in pickle format, to + """ + A handler class which writes logging records, in pickle format, to a streaming socket. The socket is kept open across logging calls. If the peer resets it, an attempt is made to reconnect on the next call. The pickle which is sent is that of the LogRecord's attribute dictionary @@ -225,7 +244,8 @@ class SocketHandler(Handler): retryFactor: float # undocumented retryMax: float # undocumented def __init__(self, host: str, port: int | None) -> None: - """Initializes the handler with a specific host address and port. + """ + Initializes the handler with a specific host address and port. When the attribute *closeOnError* is set to True - if a socket error occurs, the socket is silently closed and then reopened on the next @@ -233,45 +253,53 @@ class SocketHandler(Handler): """ def makeSocket(self, timeout: float = 1) -> socket: # timeout is undocumented - """A factory method which allows subclasses to define the precise + """ + A factory method which allows subclasses to define the precise type of socket they want. """ def makePickle(self, record: LogRecord) -> bytes: - """Pickles the record in binary format with a length prefix, and + """ + Pickles the record in binary format with a length prefix, and returns it ready for transmission across the socket. """ def send(self, s: ReadableBuffer) -> None: - """Send a pickled string to the socket. + """ + Send a pickled string to the socket. This function allows for partial sends which can happen when the network is busy. """ def createSocket(self) -> None: - """Try to create a socket, using an exponential backoff with + """ + Try to create a socket, using an exponential backoff with a max retry time. Thanks to Robert Olson for the original patch (SF #815911) which has been slightly refactored. """ class DatagramHandler(SocketHandler): - """A handler class which writes logging records, in pickle format, to + """ + A handler class which writes logging records, in pickle format, to a datagram socket. The pickle which is sent is that of the LogRecord's attribute dictionary (__dict__), so that the receiver does not need to have the logging module installed in order to process the logging event. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord function. + """ def makeSocket(self) -> socket: # type: ignore[override] - """The factory method of SocketHandler is here overridden to create + """ + The factory method of SocketHandler is here overridden to create a UDP socket (SOCK_DGRAM). """ class SysLogHandler(Handler): - """A handler class which sends formatted logging records to a syslog + """ + A handler class which sends formatted logging records to a syslog server. Based on Sam Rushing's syslog module: http://www.nightmare.com/squirl/python-ext/misc/syslog.py Contributed by Nicolas Untz (after which minor refactoring changes @@ -329,7 +357,8 @@ class SysLogHandler(Handler): socktype: SocketKind | None = None, timeout: float | None = None, ) -> None: - """Initialize a handler. + """ + Initialize a handler. If address is specified as a string, a UNIX socket is used. To log to a local syslogd, "SysLogHandler(address="/dev/log")" can be used. @@ -343,7 +372,8 @@ class SysLogHandler(Handler): def __init__( self, address: tuple[str, int] | str = ("localhost", 514), facility: str | int = 1, socktype: SocketKind | None = None ) -> None: - """Initialize a handler. + """ + Initialize a handler. If address is specified as a string, a UNIX socket is used. To log to a local syslogd, "SysLogHandler(address="/dev/log")" can be used. @@ -355,7 +385,8 @@ class SysLogHandler(Handler): """ if sys.version_info >= (3, 11): def createSocket(self) -> None: - """Try to create a socket and, if it's not a datagram socket, connect it + """ + Try to create a socket and, if it's not a datagram socket, connect it to the other end. This method is called during handler initialization, but it's not regarded as an error if the other end isn't listening yet --- the method will be called again when emitting an event, @@ -363,14 +394,16 @@ class SysLogHandler(Handler): """ def encodePriority(self, facility: int | str, priority: int | str) -> int: - """Encode the facility and priority. You can pass in strings or + """ + Encode the facility and priority. You can pass in strings or integers - if strings are passed, the facility_names and priority_names mapping dictionaries are used to convert them to integers. """ def mapPriority(self, levelName: str) -> str: - """Map a logging level name to a key in the priority_names map. + """ + Map a logging level name to a key in the priority_names map. This is useful in two scenarios: when custom levels are being used, and in the case where you can't do a straightforward mapping by lowercasing the logging level name because of locale- @@ -378,7 +411,8 @@ class SysLogHandler(Handler): """ class NTEventLogHandler(Handler): - """A handler class which sends events to the NT Event Log. Adds a + """ + A handler class which sends events to the NT Event Log. Adds a registry entry for the specified application name. If no dllname is provided, win32service.pyd (which contains some basic message placeholders) is used. Note that use of these placeholders will make @@ -389,14 +423,16 @@ class NTEventLogHandler(Handler): def __init__(self, appname: str, dllname: str | None = None, logtype: str = "Application") -> None: ... def getEventCategory(self, record: LogRecord) -> int: - """Return the event category for the record. + """ + Return the event category for the record. Override this if you want to specify your own categories. This version returns 0. """ # TODO: correct return value? def getEventType(self, record: LogRecord) -> int: - """Return the event type for the record. + """ + Return the event type for the record. Override this if you want to specify your own types. This version does a mapping using the handler's typemap attribute, which is set up in @@ -407,7 +443,8 @@ class NTEventLogHandler(Handler): """ def getMessageID(self, record: LogRecord) -> int: - """Return the message ID for the event record. If you are using your + """ + Return the message ID for the event record. If you are using your own messages, you could do this by having the msg passed to the logger being an ID rather than a formatting string. Then, in here, you could use a dictionary lookup to get the message ID. This @@ -415,7 +452,9 @@ class NTEventLogHandler(Handler): """ class SMTPHandler(Handler): - """A handler class which sends an SMTP email for each logging event.""" + """ + A handler class which sends an SMTP email for each logging event. + """ mailhost: str # undocumented mailport: int | None # undocumented @@ -437,7 +476,8 @@ class SMTPHandler(Handler): secure: tuple[()] | tuple[str] | tuple[str, str] | None = None, timeout: float = 5.0, ) -> None: - """Initialize the handler. + """ + Initialize the handler. Initialize the instance with the from and to addresses and subject line of the email. To specify a non-standard SMTP port, use the @@ -455,14 +495,16 @@ class SMTPHandler(Handler): """ def getSubject(self, record: LogRecord) -> str: - """Determine the subject for the email. + """ + Determine the subject for the email. If you want to specify a subject line which is record-dependent, override this method. """ class BufferingHandler(Handler): - """A handler class which buffers logging records in memory. Whenever each + """ + A handler class which buffers logging records in memory. Whenever each record is added to the buffer, a check is made to see if the buffer should be flushed. If it should, then flush() is expected to do what's needed. """ @@ -470,17 +512,21 @@ class BufferingHandler(Handler): capacity: int # undocumented buffer: list[LogRecord] # undocumented def __init__(self, capacity: int) -> None: - """Initialize the handler with the buffer size.""" + """ + Initialize the handler with the buffer size. + """ def shouldFlush(self, record: LogRecord) -> bool: - """Should the handler flush its buffer? + """ + Should the handler flush its buffer? Returns true if the buffer is up to capacity. This method can be overridden to implement custom flushing strategies. """ class MemoryHandler(BufferingHandler): - """A handler class which buffers logging records in memory, periodically + """ + A handler class which buffers logging records in memory, periodically flushing them to a target handler. Flushing occurs whenever the buffer is full, or when an event of a certain severity or greater is seen. """ @@ -489,7 +535,8 @@ class MemoryHandler(BufferingHandler): target: Handler | None # undocumented flushOnClose: bool # undocumented def __init__(self, capacity: int, flushLevel: int = 40, target: Handler | None = None, flushOnClose: bool = True) -> None: - """Initialize the handler with the buffer size, the level at which + """ + Initialize the handler with the buffer size, the level at which flushing should occur and an optional target. Note that without a target being set either here or via setTarget(), @@ -502,10 +549,13 @@ class MemoryHandler(BufferingHandler): """ def setTarget(self, target: Handler | None) -> None: - """Set the target handler for this handler.""" + """ + Set the target handler for this handler. + """ class HTTPHandler(Handler): - """A class which sends records to a web server, using either GET or + """ + A class which sends records to a web server, using either GET or POST semantics. """ @@ -524,18 +574,21 @@ class HTTPHandler(Handler): credentials: tuple[str, str] | None = None, context: ssl.SSLContext | None = None, ) -> None: - """Initialize the instance with the host, the request URL, and the method + """ + Initialize the instance with the host, the request URL, and the method ("GET" or "POST") """ def mapLogRecord(self, record: LogRecord) -> dict[str, Any]: - """Default implementation of mapping the log record into a dict + """ + Default implementation of mapping the log record into a dict that is sent as the CGI data. Overwrite in your class. Contributed by Franz Glasner. """ def getConnection(self, host: str, secure: bool) -> http.client.HTTPConnection: # undocumented - """get a HTTP[S]Connection. + """ + get a HTTP[S]Connection. Override when a custom connection is required, for example if there is a proxy. @@ -546,7 +599,8 @@ class _QueueLike(Protocol[_T]): def put_nowait(self, item: _T, /) -> None: ... class QueueHandler(Handler): - """This handler sends events to a queue. Typically, it would be used together + """ + This handler sends events to a queue. Typically, it would be used together with a multiprocessing Queue to centralise logging to file in one process (in a multi-process application), so as to avoid file write contention between processes. @@ -557,10 +611,13 @@ class QueueHandler(Handler): queue: _QueueLike[Any] def __init__(self, queue: _QueueLike[Any]) -> None: - """Initialise an instance, using the passed queue.""" + """ + Initialise an instance, using the passed queue. + """ def prepare(self, record: LogRecord) -> Any: - """Prepare a record for queuing. The object returned by this method is + """ + Prepare a record for queuing. The object returned by this method is enqueued. The base implementation formats the record to merge the message and @@ -576,7 +633,8 @@ class QueueHandler(Handler): """ def enqueue(self, record: LogRecord) -> None: - """Enqueue a record. + """ + Enqueue a record. The base implementation uses put_nowait. You may want to override this method if you want to use blocking, timeouts or custom queue @@ -586,7 +644,8 @@ class QueueHandler(Handler): listener: QueueListener | None class QueueListener: - """This class implements an internal threaded listener which watches for + """ + This class implements an internal threaded listener which watches for LogRecords being added to a queue, removes them and passes them to a list of handlers for processing. """ @@ -596,19 +655,22 @@ class QueueListener: queue: _QueueLike[Any] # undocumented _thread: Thread | None # undocumented def __init__(self, queue: _QueueLike[Any], *handlers: Handler, respect_handler_level: bool = False) -> None: - """Initialise an instance with the specified queue and + """ + Initialise an instance with the specified queue and handlers. """ def dequeue(self, block: bool) -> LogRecord: - """Dequeue a record and return it, optionally blocking. + """ + Dequeue a record and return it, optionally blocking. The base implementation uses get. You may want to override this method if you want to use timeouts or work with custom queue implementations. """ def prepare(self, record: LogRecord) -> Any: - """Prepare a record for handling. + """ + Prepare a record for handling. This method just returns the passed-in record. You may want to override this method if you need to do any custom marshalling or @@ -616,14 +678,16 @@ class QueueListener: """ def start(self) -> None: - """Start the listener. + """ + Start the listener. This starts up a background thread to monitor the queue for LogRecords to process. """ def stop(self) -> None: - """Stop the listener. + """ + Stop the listener. This asks the thread to terminate, and then waits for it to do so. Note that if you don't call this before your application exits, there @@ -631,7 +695,8 @@ class QueueListener: """ def enqueue_sentinel(self) -> None: - """This is used to enqueue the sentinel record. + """ + This is used to enqueue the sentinel record. The base implementation uses put_nowait. You may want to override this method if you want to use timeouts or work with custom queue @@ -639,16 +704,21 @@ class QueueListener: """ def handle(self, record: LogRecord) -> None: - """Handle a record. + """ + Handle a record. This just loops through the handlers offering them the record to handle. """ if sys.version_info >= (3, 14): def __enter__(self) -> Self: - """For use as a context manager. Starts the listener.""" + """ + For use as a context manager. Starts the listener. + """ def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: - """For use as a context manager. Stops the listener.""" + """ + For use as a context manager. Stops the listener. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/lzma.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/lzma.pyi index 927c76c55f..65b1f1898f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/lzma.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/lzma.pyi @@ -251,6 +251,7 @@ def open( For text mode, an LZMAFile object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/mailcap.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/mailcap.pyi index 403aaa4ae5..6848c9929c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/mailcap.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/mailcap.pyi @@ -16,6 +16,7 @@ def findmatch( used; (None, None) if no match is found. This may invoke the 'test' command of several matching entries before deciding which entry to use. + """ def getcaps() -> dict[str, list[_Cap]]: @@ -26,4 +27,5 @@ def getcaps() -> dict[str, list[_Cap]]: collects all the entries for that MIME type from all available mailcap files. Each dictionary contains key-value pairs for that MIME type, where the viewing command is stored with the key "view". + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/math.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/math.pyi index a1d0d7a060..e8ee56217c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/math.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/math.pyi @@ -5,7 +5,7 @@ defined by the C standard. import sys from _typeshed import SupportsMul, SupportsRMul from collections.abc import Iterable -from typing import Any, Final, Literal, Protocol, SupportsFloat, SupportsIndex, TypeVar, overload +from typing import Any, Final, Literal, Protocol, SupportsFloat, SupportsIndex, TypeVar, overload, type_check_only from typing_extensions import TypeAlias _T = TypeVar("_T") @@ -56,6 +56,7 @@ if sys.version_info >= (3, 11): def cbrt(x: _SupportsFloatOrIndex, /) -> float: """Return the cube root of x.""" +@type_check_only class _SupportsCeil(Protocol[_T_co]): def __ceil__(self) -> _T_co: ... @@ -133,6 +134,7 @@ def fabs(x: _SupportsFloatOrIndex, /) -> float: def factorial(x: SupportsIndex, /) -> int: """Find n!.""" +@type_check_only class _SupportsFloor(Protocol[_T_co]): def __floor__(self) -> _T_co: ... @@ -297,6 +299,7 @@ _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 _MultiplicableT1 = TypeVar("_MultiplicableT1", bound=SupportsMul[Any, Any]) _MultiplicableT2 = TypeVar("_MultiplicableT2", bound=SupportsMul[Any, Any]) +@type_check_only class _SupportsProdWithNoDefaultGiven(SupportsMul[Any, Any], SupportsRMul[int, Any], Protocol): ... _SupportsProdNoDefaultT = TypeVar("_SupportsProdNoDefaultT", bound=_SupportsProdWithNoDefaultGiven) @@ -360,6 +363,7 @@ def tanh(x: _SupportsFloatOrIndex, /) -> float: """Return the hyperbolic tangent of x.""" # Is different from `_typeshed.SupportsTrunc`, which is not generic +@type_check_only class _SupportsTrunc(Protocol[_T_co]): def __trunc__(self) -> _T_co: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/mimetypes.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/mimetypes.pyi index 9c02ef733a..4e54a0eb85 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/mimetypes.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/mimetypes.pyi @@ -197,7 +197,8 @@ class MimeTypes: """ def read(self, filename: str, strict: bool = True) -> None: - """Read a single mime.types-format file, specified by pathname. + """ + Read a single mime.types-format file, specified by pathname. If strict is true, information will be added to list of standard types, else to the list of non-standard @@ -205,7 +206,8 @@ class MimeTypes: """ def readfp(self, fp: IO[str], strict: bool = True) -> None: - """Read a single mime.types-format file. + """ + Read a single mime.types-format file. If strict is true, information will be added to list of standard types, else to the list of non-standard @@ -213,7 +215,8 @@ class MimeTypes: """ def read_windows_registry(self, strict: bool = True) -> None: - """Load the MIME types database from Windows registry. + """ + Load the MIME types database from Windows registry. If strict is true, information will be added to list of standard types, else to the list of non-standard diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/connection.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/connection.pyi index fc69783184..3fe3d082c3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/connection.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/connection.pyi @@ -42,10 +42,13 @@ class _ConnectionBase(Generic[_SendT_contra, _RecvT_co]): """Send a (picklable) object""" def recv_bytes(self, maxlength: int | None = None) -> bytes: - """Receive bytes data as a bytes object.""" + """ + Receive bytes data as a bytes object. + """ def recv_bytes_into(self, buf: Any, offset: int = 0) -> int: - """Receive bytes data into a writeable bytes-like object. + """ + Receive bytes data into a writeable bytes-like object. Return the number of bytes read. """ @@ -62,19 +65,22 @@ class _ConnectionBase(Generic[_SendT_contra, _RecvT_co]): def __del__(self) -> None: ... class Connection(_ConnectionBase[_SendT_contra, _RecvT_co]): - """Connection class based on an arbitrary file descriptor (Unix only), or + """ + Connection class based on an arbitrary file descriptor (Unix only), or a socket handle (Windows). """ if sys.platform == "win32": class PipeConnection(_ConnectionBase[_SendT_contra, _RecvT_co]): - """Connection class based on a Windows named pipe. + """ + Connection class based on a Windows named pipe. Overlapped I/O is used, so the handles must have been created with FILE_FLAG_OVERLAPPED. """ class Listener: - """Returns a listener object. + """ + Returns a listener object. This is a wrapper for a bound socket which is 'listening' for connections, or for a Windows named pipe. @@ -84,13 +90,16 @@ class Listener: self, address: _Address | None = None, family: str | None = None, backlog: int = 1, authkey: bytes | None = None ) -> None: ... def accept(self) -> Connection[Incomplete, Incomplete]: - """Accept a connection on the bound socket or named pipe of `self`. + """ + Accept a connection on the bound socket or named pipe of `self`. Returns a `Connection` object. """ def close(self) -> None: - """Close the bound socket or named pipe of `self`.""" + """ + Close the bound socket or named pipe of `self`. + """ @property def address(self) -> _Address: ... @@ -112,13 +121,16 @@ def answer_challenge(connection: Connection[Any, Any], authkey: bytes) -> None: def wait( object_list: Iterable[Connection[_SendT_contra, _RecvT_co] | socket.socket | int], timeout: float | None = None ) -> list[Connection[_SendT_contra, _RecvT_co] | socket.socket | int]: - """Wait till an object in object_list is ready/readable. + """ + Wait till an object in object_list is ready/readable. Returns list of those objects in object_list which are ready/readable. """ def Client(address: _Address, family: str | None = None, authkey: bytes | None = None) -> Connection[Any, Any]: - """Returns a connection to the address of a `Listener`""" + """ + Returns a connection to the address of a `Listener` + """ # N.B. Keep this in sync with multiprocessing.context.BaseContext.Pipe. # _ConnectionBase is the common base class of Connection and PipeConnection @@ -128,8 +140,12 @@ def Client(address: _Address, family: str | None = None, authkey: bytes | None = # However, TypeVars scoped entirely within a return annotation is unspecified in the spec. if sys.platform != "win32": def Pipe(duplex: bool = True) -> tuple[Connection[Any, Any], Connection[Any, Any]]: - """Returns pair of connection objects at either end of a pipe""" + """ + Returns pair of connection objects at either end of a pipe + """ else: def Pipe(duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]: - """Returns pair of connection objects at either end of a pipe""" + """ + Returns pair of connection objects at either end of a pipe + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/context.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/context.pyi index 824798fef4..21be42237d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/context.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/context.pyi @@ -38,15 +38,21 @@ class BaseContext: # multiprocessing.*, so the signatures should be identical (modulo self). @staticmethod def current_process() -> BaseProcess: - """Return process object representing the current process""" + """ + Return process object representing the current process + """ @staticmethod def parent_process() -> BaseProcess | None: - """Return process object representing the parent process""" + """ + Return process object representing the parent process + """ @staticmethod def active_children() -> list[BaseProcess]: - """Return list of process objects corresponding to live child processes""" + """ + Return list of process objects corresponding to live child processes + """ def cpu_count(self) -> int: """Returns the number of CPUs in the system""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/heap.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/heap.pyi index 83721c52f3..dc1da4d251 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/heap.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/heap.pyi @@ -8,7 +8,9 @@ from typing_extensions import TypeAlias __all__ = ["BufferWrapper"] class Arena: - """A shared memory area backed by a temporary file (POSIX).""" + """ + A shared memory area backed by a temporary file (POSIX). + """ size: int buffer: mmap diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi index 852116d318..049d0bc8b1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi @@ -38,7 +38,9 @@ class Namespace: _Namespace: TypeAlias = Namespace class Token: - """Type to uniquely identify a shared object""" + """ + Type to uniquely identify a shared object + """ typeid: str | bytes | None address: _Address | None @@ -48,7 +50,9 @@ class Token: def __setstate__(self, state: tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]) -> None: ... class BaseProxy: - """A base for proxies of shared objects""" + """ + A base for proxies of shared objects + """ _address_to_local: dict[_Address, Any] _mutex: Any @@ -64,10 +68,14 @@ class BaseProxy: ) -> None: ... def __deepcopy__(self, memo: Any | None) -> Any: ... def _callmethod(self, methodname: str, args: tuple[Any, ...] = (), kwds: dict[Any, Any] = {}) -> None: - """Try to call a method of the referent and return a copy of the result""" + """ + Try to call a method of the referent and return a copy of the result + """ def _getvalue(self) -> Any: - """Get a copy of the value of the referent""" + """ + Get a copy of the value of the referent + """ def __reduce__(self) -> tuple[Any, tuple[Any, Any, str, dict[Any, Any]]]: ... @@ -230,7 +238,9 @@ _ServerConnection: TypeAlias = Connection[tuple[str, Any], tuple[str, str, Itera # Returned by BaseManager.get_server() class Server: - """Server class which runs in a process controlled by a manager object""" + """ + Server class which runs in a process controlled by a manager object + """ address: _Address | None id_to_obj: dict[str, tuple[Any, set[str], dict[str, str]]] @@ -245,46 +255,68 @@ class Server: serializer: str, ) -> None: ... def serve_forever(self) -> None: - """Run the server forever""" + """ + Run the server forever + """ def accepter(self) -> None: ... if sys.version_info >= (3, 10): def handle_request(self, conn: _ServerConnection) -> None: - """Handle a new connection""" + """ + Handle a new connection + """ else: def handle_request(self, c: _ServerConnection) -> None: - """Handle a new connection""" + """ + Handle a new connection + """ def serve_client(self, conn: _ServerConnection) -> None: - """Handle requests from the proxies in a particular process/thread""" + """ + Handle requests from the proxies in a particular process/thread + """ def fallback_getvalue(self, conn: _ServerConnection, ident: str, obj: _T) -> _T: ... def fallback_str(self, conn: _ServerConnection, ident: str, obj: Any) -> str: ... def fallback_repr(self, conn: _ServerConnection, ident: str, obj: Any) -> str: ... def dummy(self, c: _ServerConnection) -> None: ... def debug_info(self, c: _ServerConnection) -> str: - """Return some info --- useful to spot problems with refcounting""" + """ + Return some info --- useful to spot problems with refcounting + """ def number_of_objects(self, c: _ServerConnection) -> int: - """Number of shared objects""" + """ + Number of shared objects + """ def shutdown(self, c: _ServerConnection) -> None: - """Shutdown this process""" + """ + Shutdown this process + """ def create(self, c: _ServerConnection, typeid: str, /, *args: Any, **kwds: Any) -> tuple[str, tuple[str, ...]]: - """Create a new shared object and return its id""" + """ + Create a new shared object and return its id + """ def get_methods(self, c: _ServerConnection, token: Token) -> set[str]: - """Return the methods of the shared object indicated by token""" + """ + Return the methods of the shared object indicated by token + """ def accept_connection(self, c: _ServerConnection, name: str) -> None: - """Spawn a new thread to serve this connection""" + """ + Spawn a new thread to serve this connection + """ def incref(self, c: _ServerConnection, ident: str) -> None: ... def decref(self, c: _ServerConnection, ident: str) -> None: ... class BaseManager: - """Base class for managers""" + """ + Base class for managers + """ if sys.version_info >= (3, 11): def __init__( @@ -306,16 +338,24 @@ class BaseManager: ) -> None: ... def get_server(self) -> Server: - """Return server object with serve_forever() method and address attribute""" + """ + Return server object with serve_forever() method and address attribute + """ def connect(self) -> None: - """Connect manager object to the server process""" + """ + Connect manager object to the server process + """ def start(self, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ()) -> None: - """Spawn a server process for this manager object""" + """ + Spawn a server process for this manager object + """ shutdown: _Finalize # only available after start() was called def join(self, timeout: float | None = None) -> None: # undocumented - """Join the manager process (if it has been spawned)""" + """ + Join the manager process (if it has been spawned) + """ @property def address(self) -> _Address | None: ... @@ -329,7 +369,9 @@ class BaseManager: method_to_typeid: Mapping[str, str] | None = None, create_method: bool = True, ) -> None: - """Register a typeid with the manager type""" + """ + Register a typeid with the manager type + """ def __enter__(self) -> Self: ... def __exit__( @@ -337,7 +379,8 @@ class BaseManager: ) -> None: ... class SyncManager(BaseManager): - """Subclass of `BaseManager` which supports a number of shared object types. + """ + Subclass of `BaseManager` which supports a number of shared object types. The types registered are those intended for the synchronization of threads, plus `dict`, `list` and `Namespace`. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/pool.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/pool.pyi index a228cee5f5..c8c6ff3d31 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/pool.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/pool.pyi @@ -45,7 +45,9 @@ class IMapIterator(Generic[_T]): class IMapUnorderedIterator(IMapIterator[_T]): ... class Pool: - """Class which supports an async version of applying functions to arguments.""" + """ + Class which supports an async version of applying functions to arguments. + """ def __init__( self, @@ -58,7 +60,8 @@ class Pool: @staticmethod def Process(ctx: DefaultContext, *args: Any, **kwds: Any) -> Process: ... def apply(self, func: Callable[..., _T], args: Iterable[Any] = (), kwds: Mapping[str, Any] = {}) -> _T: - """Equivalent of `func(*args, **kwds)`. + """ + Equivalent of `func(*args, **kwds)`. Pool must be running. """ @@ -70,10 +73,13 @@ class Pool: callback: Callable[[_T], object] | None = None, error_callback: Callable[[BaseException], object] | None = None, ) -> AsyncResult[_T]: - """Asynchronous version of `apply()` method.""" + """ + Asynchronous version of `apply()` method. + """ def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = None) -> list[_T]: - """Apply `func` to each element in `iterable`, collecting the results + """ + Apply `func` to each element in `iterable`, collecting the results in a list that is returned. """ @@ -85,16 +91,23 @@ class Pool: callback: Callable[[list[_T]], object] | None = None, error_callback: Callable[[BaseException], object] | None = None, ) -> MapResult[_T]: - """Asynchronous version of `map()` method.""" + """ + Asynchronous version of `map()` method. + """ def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1) -> IMapIterator[_T]: - """Equivalent of `map()` -- can be MUCH slower than `Pool.map()`.""" + """ + Equivalent of `map()` -- can be MUCH slower than `Pool.map()`. + """ def imap_unordered(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1) -> IMapIterator[_T]: - """Like `imap()` method but ordering of results is arbitrary.""" + """ + Like `imap()` method but ordering of results is arbitrary. + """ def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = None) -> list[_T]: - """Like `map()` method but the elements of the `iterable` are expected to + """ + Like `map()` method but the elements of the `iterable` are expected to be iterables as well and will be unpacked as arguments. Hence `func` and (a, b) becomes func(a, b). """ @@ -107,7 +120,9 @@ class Pool: callback: Callable[[list[_T]], object] | None = None, error_callback: Callable[[BaseException], object] | None = None, ) -> AsyncResult[list[_T]]: - """Asynchronous version of `starmap()` method.""" + """ + Asynchronous version of `starmap()` method. + """ def close(self) -> None: ... def terminate(self) -> None: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi index 31ba0c6892..632a7657fd 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi @@ -13,7 +13,9 @@ if sys.platform == "win32": WINENV: Final[bool] class Popen: - """Start a subprocess to run the code of a process object""" + """ + Start a subprocess to run the code of a process object + """ finalizer: Finalize method: ClassVar[str] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/process.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/process.pyi index 53b3acad26..f740eb50c0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/process.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/process.pyi @@ -4,7 +4,8 @@ from typing import Any __all__ = ["BaseProcess", "current_process", "active_children", "parent_process"] class BaseProcess: - """Process objects represent activity that is run in a separate process + """ + Process objects represent activity that is run in a separate process The class is analogous to `threading.Thread` """ @@ -24,53 +25,79 @@ class BaseProcess: daemon: bool | None = None, ) -> None: ... def run(self) -> None: - """Method to be run in sub-process; can be overridden in sub-class""" + """ + Method to be run in sub-process; can be overridden in sub-class + """ def start(self) -> None: - """Start child process""" + """ + Start child process + """ def terminate(self) -> None: - """Terminate process; sends SIGTERM signal or uses TerminateProcess()""" + """ + Terminate process; sends SIGTERM signal or uses TerminateProcess() + """ def kill(self) -> None: - """Terminate process; sends SIGKILL signal or uses TerminateProcess()""" + """ + Terminate process; sends SIGKILL signal or uses TerminateProcess() + """ def close(self) -> None: - """Close the Process object. + """ + Close the Process object. This method releases resources held by the Process object. It is an error to call this method if the child process is still running. """ def join(self, timeout: float | None = None) -> None: - """Wait until child process terminates""" + """ + Wait until child process terminates + """ def is_alive(self) -> bool: - """Return whether process is alive""" + """ + Return whether process is alive + """ @property def exitcode(self) -> int | None: - """Return exit code of process or `None` if it has yet to stop""" + """ + Return exit code of process or `None` if it has yet to stop + """ @property def ident(self) -> int | None: - """Return identifier (PID) of process or `None` if it has yet to start""" + """ + Return identifier (PID) of process or `None` if it has yet to start + """ @property def pid(self) -> int | None: - """Return identifier (PID) of process or `None` if it has yet to start""" + """ + Return identifier (PID) of process or `None` if it has yet to start + """ @property def sentinel(self) -> int: - """Return a file descriptor (Unix) or handle (Windows) suitable for + """ + Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination. """ def current_process() -> BaseProcess: - """Return process object representing the current process""" + """ + Return process object representing the current process + """ def active_children() -> list[BaseProcess]: - """Return list of process objects corresponding to live child processes""" + """ + Return list of process objects corresponding to live child processes + """ def parent_process() -> BaseProcess | None: - """Return process object representing the parent process""" + """ + Return process object representing the parent process + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/sharedctypes.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/sharedctypes.pyi index 7f437c7c24..9ebd2de2f9 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/sharedctypes.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/sharedctypes.pyi @@ -14,19 +14,25 @@ _CT = TypeVar("_CT", bound=_CData) @overload def RawValue(typecode_or_type: type[_CT], *args: Any) -> _CT: - """Returns a ctypes object allocated from shared memory""" + """ + Returns a ctypes object allocated from shared memory + """ @overload def RawValue(typecode_or_type: str, *args: Any) -> Any: ... @overload def RawArray(typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any]) -> ctypes.Array[_CT]: - """Returns a ctypes array allocated from shared memory""" + """ + Returns a ctypes array allocated from shared memory + """ @overload def RawArray(typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ... @overload def Value(typecode_or_type: type[_CT], *args: Any, lock: Literal[False], ctx: BaseContext | None = None) -> _CT: - """Return a synchronization wrapper for a Value""" + """ + Return a synchronization wrapper for a Value + """ @overload def Value( @@ -44,7 +50,9 @@ def Value( def Array( typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False], ctx: BaseContext | None = None ) -> _CT: - """Return a synchronization wrapper for a RawArray""" + """ + Return a synchronization wrapper for a RawArray + """ @overload def Array( diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi index 97d3cdb32c..99f1fc3278 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi @@ -18,26 +18,40 @@ WINSERVICE: Final[bool] def set_executable(exe: str) -> None: ... def get_executable() -> str: ... def is_forking(argv: Sequence[str]) -> bool: - """Return whether commandline indicates we are forking""" + """ + Return whether commandline indicates we are forking + """ def freeze_support() -> None: - """Run code for process object if this in not the main process""" + """ + Run code for process object if this in not the main process + """ def get_command_line(**kwds: Any) -> list[str]: - """Returns prefix of command line used for spawning a child process""" + """ + Returns prefix of command line used for spawning a child process + """ def spawn_main(pipe_handle: int, parent_pid: int | None = None, tracker_fd: int | None = None) -> None: - """Run code specified by data received over pipe""" + """ + Run code specified by data received over pipe + """ # undocumented def _main(fd: int, parent_sentinel: int) -> int: ... def get_preparation_data(name: str) -> dict[str, Any]: - """Return info about parent needed by child to unpickle process object""" + """ + Return info about parent needed by child to unpickle process object + """ old_main_modules: list[ModuleType] def prepare(data: Mapping[str, Any]) -> None: - """Try to get current process ready to unpickle process object""" + """ + Try to get current process ready to unpickle process object + """ def import_main_path(main_path: str) -> None: - """Set sys.modules['__main__'] to module at main_path""" + """ + Set sys.modules['__main__'] to module at main_path + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/util.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/util.pyi index 3b4ccdc194..fefd35a607 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/util.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/multiprocessing/util.pyi @@ -49,10 +49,14 @@ if sys.version_info >= (3, 14): def sub_warning(msg: object, *args: object) -> None: ... def get_logger() -> Logger: - """Returns logger used by multiprocessing""" + """ + Returns logger used by multiprocessing + """ def log_to_stderr(level: _LoggingLevel | None = None) -> Logger: - """Turn on logging and add a handler which prints to stderr""" + """ + Turn on logging and add a handler which prints to stderr + """ def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ... @@ -62,7 +66,9 @@ def get_temp_dir() -> str: ... def register_after_fork(obj: _T, func: Callable[[_T], object]) -> None: ... class Finalize(Generic[_R_co]): - """Class which supports object finalization using weakrefs""" + """ + Class which supports object finalization using weakrefs + """ # "args" and "kwargs" are passed as arguments to "callback". @overload @@ -95,16 +101,24 @@ class Finalize(Generic[_R_co]): sub_debug: Callable[..., object] = ..., getpid: Callable[[], int] = ..., ) -> _R_co: - """Run the callback unless it has already been called or cancelled""" + """ + Run the callback unless it has already been called or cancelled + """ def cancel(self) -> None: - """Cancel finalization of the object""" + """ + Cancel finalization of the object + """ def still_active(self) -> bool: - """Return whether this finalizer is still waiting to invoke callback""" + """ + Return whether this finalizer is still waiting to invoke callback + """ def is_exiting() -> bool: - """Returns true if the process is shutting down""" + """ + Returns true if the process is shutting down + """ class ForkAwareThreadLock: acquire: Callable[[bool, float], bool] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/numbers.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/numbers.pyi index ae3aeedb59..3b68484ed7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/numbers.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/numbers.pyi @@ -299,6 +299,7 @@ class Rational(Real): It's important that this conversion use the integer's "true" division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing. + """ # See comment at the top of the file diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/optparse.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/optparse.pyi index 2b72698ddd..f2cd353e92 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/optparse.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/optparse.pyi @@ -47,8 +47,7 @@ __all__ = [ "BadOptionError", "check_choice", ] -# pytype is not happy with `NO_DEFAULT: Final = ("NO", "DEFAULT")` -NO_DEFAULT: Final[tuple[Literal["NO"], Literal["DEFAULT"]]] +NO_DEFAULT: Final = ("NO", "DEFAULT") SUPPRESS_HELP: Final = "SUPPRESSHELP" SUPPRESS_USAGE: Final = "SUPPRESSUSAGE" @@ -61,19 +60,24 @@ class OptParseError(Exception): def __init__(self, msg: str) -> None: ... class BadOptionError(OptParseError): - """Raised if an invalid option is seen on the command line.""" + """ + Raised if an invalid option is seen on the command line. + """ opt_str: str def __init__(self, opt_str: str) -> None: ... class AmbiguousOptionError(BadOptionError): - """Raised if an ambiguous option is seen on the command line.""" + """ + Raised if an ambiguous option is seen on the command line. + """ possibilities: Iterable[str] def __init__(self, opt_str: str, possibilities: Sequence[str]) -> None: ... class OptionError(OptParseError): - """Raised if an Option instance is created with invalid or + """ + Raised if an Option instance is created with invalid or inconsistent arguments. """ @@ -81,15 +85,19 @@ class OptionError(OptParseError): def __init__(self, msg: str, option: Option) -> None: ... class OptionConflictError(OptionError): - """Raised if conflicting options are added to an OptionParser.""" + """ + Raised if conflicting options are added to an OptionParser. + """ class OptionValueError(OptParseError): - """Raised if an invalid option value is encountered on the command + """ + Raised if an invalid option value is encountered on the command line. """ class HelpFormatter: - """Abstract base class for formatting option help. OptionParser + """ + Abstract base class for formatting option help. OptionParser instances should use one of the HelpFormatter subclasses for formatting help; by default IndentedHelpFormatter is used. @@ -191,22 +199,23 @@ class TitledHelpFormatter(HelpFormatter): def format_usage(self, usage: str) -> str: ... class Option: - """Instance attributes: - _short_opts : [string] - _long_opts : [string] + """ + Instance attributes: + _short_opts : [string] + _long_opts : [string] - action : string - type : string - dest : string - default : any - nargs : int - const : any - choices : [string] - callback : function - callback_args : (any*) - callback_kwargs : { string : any } - help : string - metavar : string + action : string + type : string + dest : string + default : any + nargs : int + const : any + choices : [string] + callback : function + callback_args : (any*) + callback_kwargs : { string : any } + help : string + metavar : string """ ACTIONS: tuple[str, ...] @@ -273,7 +282,8 @@ class Option: make_option = Option class OptionContainer: - """Abstract base class. + """ + Abstract base class. Class attributes: standard_option_list : [Option] @@ -299,6 +309,7 @@ class OptionContainer: [1] These mappings are common to (shared by) all components of the controlling OptionParser, where they are initially created. + """ _long_opt: dict[str, Option] @@ -365,14 +376,16 @@ class Values: def __init__(self, defaults: Mapping[str, object] | None = None) -> None: ... def _update(self, dict: Mapping[str, object], mode: Literal["careful", "loose"]) -> None: ... def _update_careful(self, dict: Mapping[str, object]) -> None: - """Update the option values from an arbitrary dictionary, but only + """ + Update the option values from an arbitrary dictionary, but only use keys from dict that already have a corresponding attribute in self. Any keys in dict without a corresponding attribute are silently ignored. """ def _update_loose(self, dict: Mapping[str, object]) -> None: - """Update the option values from an arbitrary dictionary, + """ + Update the option values from an arbitrary dictionary, using all keys from the dictionary regardless of whether they have a corresponding attribute in self or not. """ @@ -389,7 +402,8 @@ class Values: def __eq__(self, other: object) -> bool: ... class OptionParser(OptionContainer): - """Class attributes: + """ + Class attributes: standard_option_list : [Option] list of standard options that will be accepted by all instances of this parser class (intended to be overridden by subclasses). @@ -453,6 +467,7 @@ class OptionParser(OptionContainer): OptionParser is not thread-safe. If, for some perverse reason, you need to parse command-line arguments simultaneously in different threads, use different OptionParser instances. + """ allow_interspersed_args: bool @@ -514,7 +529,8 @@ class OptionParser(OptionContainer): @overload def add_option_group(self, title: str, /, description: str | None = None) -> OptionGroup: ... def check_values(self, values: Values, args: list[str]) -> tuple[Values, list[str]]: - """check_values(values : Values, args : [string]) + """ + check_values(values : Values, args : [string]) -> (values : Values, args : [string]) Check that the supplied option values and leftover arguments are @@ -558,7 +574,8 @@ class OptionParser(OptionContainer): def get_usage(self) -> str: ... def get_version(self) -> str: ... def parse_args(self, args: list[str] | None = None, values: Values | None = None) -> tuple[Values, list[str]]: - """parse_args(args : [string] = sys.argv[1:], + """ + parse_args(args : [string] = sys.argv[1:], values : Values = None) -> (values : Values, args : [string]) diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/os/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/os/__init__.pyi index 8684b80b38..2baacc6175 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/os/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/os/__init__.pyi @@ -1727,7 +1727,7 @@ def chdir(path: FileDescriptorOrPath) -> None: path may always be specified as a string. On some platforms, path may also be specified as an open file descriptor. - If this functionality is unavailable, using it raises an exception. + If this functionality is unavailable, using it raises an exception. """ if sys.platform != "win32": @@ -1886,6 +1886,7 @@ def makedirs(name: StrOrBytesPath, mode: int = 0o777, exist_ok: bool = False) -> will be created if it does not exist. If the target directory already exists, raise an OSError if exist_ok is False. Otherwise no exception is raised. This is recursive. + """ if sys.platform != "win32": @@ -1950,6 +1951,7 @@ def removedirs(name: StrOrBytesPath) -> None: segments will be pruned away until either the whole path is consumed or an error occurs. Errors during this latter phase are ignored -- they generally mean that a directory was not empty. + """ def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: @@ -1975,6 +1977,7 @@ def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: Note: this function can fail with the new directory structure made if you lack permissions needed to unlink the leaf directory or file. + """ def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: @@ -2181,6 +2184,7 @@ def walk( print("bytes in", len(files), "non-directory files") if '__pycache__' in dirs: dirs.remove('__pycache__') # don't visit __pycache__ directories + """ if sys.platform != "win32": @@ -2896,7 +2900,8 @@ if sys.version_info >= (3, 13): # available. See https://github.com/python/cpython/blob/417c130/Lib/os.py#L1175-L1186. if sys.platform != "win32" and sys.platform != "darwin": def process_cpu_count() -> int: - """Get the number of CPUs of the current process. + """ + Get the number of CPUs of the current process. Return the number of logical CPUs usable by the calling thread of the current process. Return None if indeterminable. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/pathlib/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/pathlib/__init__.pyi index fe026e1ead..b55211baf7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/pathlib/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/pathlib/__init__.pyi @@ -48,7 +48,8 @@ class PurePath(PathLike[str]): if sys.version_info >= (3, 13): parser: ClassVar[types.ModuleType] def full_match(self, pattern: StrPath, *, case_sensitive: bool | None = None) -> bool: - """Return True if this path matches the given glob-style pattern. The + """ + Return True if this path matches the given glob-style pattern. The pattern is matched against the entire path. """ @@ -76,14 +77,16 @@ class PurePath(PathLike[str]): @property def suffix(self) -> str: - """The final component's last suffix, if any. + """ + The final component's last suffix, if any. This includes the leading period. For example: '.txt' """ @property def suffixes(self) -> list[str]: - """A list of the final component's suffixes, if any. + """ + A list of the final component's suffixes, if any. These include the leading periods. For example: ['.tar', '.gz'] """ @@ -149,14 +152,17 @@ class PurePath(PathLike[str]): """Return True if the path is relative to another path or False.""" if sys.version_info >= (3, 12): def match(self, path_pattern: str, *, case_sensitive: bool | None = None) -> bool: - """Return True if this path matches the given pattern. If the pattern is + """ + Return True if this path matches the given pattern. If the pattern is relative, matching is done from the right; otherwise, the entire path is matched. The recursive wildcard '**' is *not* supported by this method. """ else: def match(self, path_pattern: str) -> bool: - """Return True if this path matches the given pattern.""" + """ + Return True if this path matches the given pattern. + """ if sys.version_info >= (3, 14): def relative_to(self, other: StrPath, *, walk_up: bool = False) -> Self: """Return the relative path to another path identified by the passed @@ -252,48 +258,64 @@ class Path(PurePath): """Return a new path pointing to the current working directory.""" if sys.version_info >= (3, 10): def stat(self, *, follow_symlinks: bool = True) -> stat_result: - """Return the result of the stat() system call on this path, like + """ + Return the result of the stat() system call on this path, like os.stat() does. """ def chmod(self, mode: int, *, follow_symlinks: bool = True) -> None: - """Change the permissions of the path, like os.chmod().""" + """ + Change the permissions of the path, like os.chmod(). + """ else: def stat(self) -> stat_result: - """Return the result of the stat() system call on this path, like + """ + Return the result of the stat() system call on this path, like os.stat() does. """ def chmod(self, mode: int) -> None: - """Change the permissions of the path, like os.chmod().""" + """ + Change the permissions of the path, like os.chmod(). + """ if sys.version_info >= (3, 13): @classmethod def from_uri(cls, uri: str) -> Self: """Return a new path from the given 'file' URI.""" def is_dir(self, *, follow_symlinks: bool = True) -> bool: - """Whether this path is a directory.""" + """ + Whether this path is a directory. + """ def is_file(self, *, follow_symlinks: bool = True) -> bool: - """Whether this path is a regular file (also True for symlinks pointing + """ + Whether this path is a regular file (also True for symlinks pointing to regular files). """ def read_text(self, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> str: - """Open the file in text mode, read it, and close the file.""" + """ + Open the file in text mode, read it, and close the file. + """ else: def __enter__(self) -> Self: ... def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... def is_dir(self) -> bool: - """Whether this path is a directory.""" + """ + Whether this path is a directory. + """ def is_file(self) -> bool: - """Whether this path is a regular file (also True for symlinks pointing + """ + Whether this path is a regular file (also True for symlinks pointing to regular files). """ def read_text(self, encoding: str | None = None, errors: str | None = None) -> str: - """Open the file in text mode, read it, and close the file.""" + """ + Open the file in text mode, read it, and close the file. + """ if sys.version_info >= (3, 13): def glob(self, pattern: str, *, case_sensitive: bool | None = None, recurse_symlinks: bool = False) -> Iterator[Self]: """Iterate over this subtree and yield all existing files (of any @@ -329,32 +351,47 @@ class Path(PurePath): """ if sys.version_info >= (3, 12): def exists(self, *, follow_symlinks: bool = True) -> bool: - """Whether this path exists. + """ + Whether this path exists. This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False. """ else: def exists(self) -> bool: - """Whether this path exists.""" + """ + Whether this path exists. + """ def is_symlink(self) -> bool: - """Whether this path is a symbolic link.""" + """ + Whether this path is a symbolic link. + """ def is_socket(self) -> bool: - """Whether this path is a socket.""" + """ + Whether this path is a socket. + """ def is_fifo(self) -> bool: - """Whether this path is a FIFO.""" + """ + Whether this path is a FIFO. + """ def is_block_device(self) -> bool: - """Whether this path is a block device.""" + """ + Whether this path is a block device. + """ def is_char_device(self) -> bool: - """Whether this path is a character device.""" + """ + Whether this path is a character device. + """ if sys.version_info >= (3, 12): def is_junction(self) -> bool: - """Whether this path is a junction.""" + """ + Whether this path is a junction. + """ def iterdir(self) -> Generator[Self, None, None]: """Yield path objects of the directory contents. @@ -364,46 +401,59 @@ class Path(PurePath): """ def lchmod(self, mode: int) -> None: - """Like chmod(), except if the path points to a symlink, the symlink's + """ + Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's. """ def lstat(self) -> stat_result: - """Like stat(), except if the path points to a symlink, the symlink's + """ + Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's. """ def mkdir(self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False) -> None: - """Create a new directory at this given path.""" + """ + Create a new directory at this given path. + """ if sys.version_info >= (3, 14): @property def info(self) -> PathInfo: - """A PathInfo object that exposes the file type and other file attributes + """ + A PathInfo object that exposes the file type and other file attributes of this path. """ @overload def move_into(self, target_dir: _PathT) -> _PathT: # type: ignore[overload-overlap] - """Move this file or directory tree into the given existing directory.""" + """ + Move this file or directory tree into the given existing directory. + """ @overload def move_into(self, target_dir: StrPath) -> Self: ... # type: ignore[overload-overlap] @overload def move(self, target: _PathT) -> _PathT: # type: ignore[overload-overlap] - """Recursively move this file or directory tree to the given destination.""" + """ + Recursively move this file or directory tree to the given destination. + """ @overload def move(self, target: StrPath) -> Self: ... # type: ignore[overload-overlap] @overload def copy_into(self, target_dir: _PathT, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> _PathT: # type: ignore[overload-overlap] - """Copy this file or directory tree into the given existing directory.""" + """ + Copy this file or directory tree into the given existing directory. + """ @overload def copy_into(self, target_dir: StrPath, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> Self: ... # type: ignore[overload-overlap] @overload def copy(self, target: _PathT, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> _PathT: # type: ignore[overload-overlap] - """Recursively copy this file or directory tree to the given destination.""" + """ + Recursively copy this file or directory tree to the given destination. + """ @overload def copy(self, target: StrPath, *, follow_symlinks: bool = True, preserve_metadata: bool = False) -> Self: ... # type: ignore[overload-overlap] @@ -420,7 +470,8 @@ class Path(PurePath): errors: str | None = None, newline: str | None = None, ) -> TextIOWrapper: - """Open the file pointed to by this path and return a file object, as + """ + Open the file pointed to by this path and return a file object, as the built-in open() function does. """ # Unbuffered binary mode: returns a FileIO @@ -471,37 +522,56 @@ class Path(PurePath): if sys.platform == "win32": if sys.version_info < (3, 13): def owner(self: Never) -> str: # type: ignore[misc] - """Return the login name of the file owner.""" + """ + Return the login name of the file owner. + """ def group(self: Never) -> str: # type: ignore[misc] - """Return the group name of the file gid.""" + """ + Return the group name of the file gid. + """ else: if sys.version_info >= (3, 13): def owner(self, *, follow_symlinks: bool = True) -> str: - """Return the login name of the file owner.""" + """ + Return the login name of the file owner. + """ def group(self, *, follow_symlinks: bool = True) -> str: - """Return the group name of the file gid.""" + """ + Return the group name of the file gid. + """ else: def owner(self) -> str: - """Return the login name of the file owner.""" + """ + Return the login name of the file owner. + """ def group(self) -> str: - """Return the group name of the file gid.""" + """ + Return the group name of the file gid. + """ # This method does "exist" on Windows on <3.12, but always raises NotImplementedError # On py312+, it works properly on Windows, as with all other platforms if sys.platform == "win32" and sys.version_info < (3, 12): def is_mount(self: Never) -> bool: # type: ignore[misc] - """Check if this path is a POSIX mount point""" + """ + Check if this path is a POSIX mount point + """ else: def is_mount(self) -> bool: - """Check if this path is a mount point""" + """ + Check if this path is a mount point + """ def readlink(self) -> Self: - """Return the path to which the symbolic link points.""" + """ + Return the path to which the symbolic link points. + """ if sys.version_info >= (3, 10): def rename(self, target: StrPath) -> Self: - """Rename this path to the target path. + """ + Rename this path to the target path. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the @@ -511,7 +581,8 @@ class Path(PurePath): """ def replace(self, target: StrPath) -> Self: - """Rename this path to the target path, overwriting if that path exists. + """ + Rename this path to the target path, overwriting if that path exists. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the @@ -521,7 +592,8 @@ class Path(PurePath): """ else: def rename(self, target: str | PurePath) -> Self: - """Rename this path to the target path. + """ + Rename this path to the target path. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the @@ -531,7 +603,8 @@ class Path(PurePath): """ def replace(self, target: str | PurePath) -> Self: - """Rename this path to the target path, overwriting if that path exists. + """ + Rename this path to the target path, overwriting if that path exists. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the @@ -541,29 +614,37 @@ class Path(PurePath): """ def resolve(self, strict: bool = False) -> Self: - """Make the path absolute, resolving all symlinks on the way and also + """ + Make the path absolute, resolving all symlinks on the way and also normalizing it. """ def rmdir(self) -> None: - """Remove this directory. The directory must be empty.""" + """ + Remove this directory. The directory must be empty. + """ def symlink_to(self, target: StrOrBytesPath, target_is_directory: bool = False) -> None: - """Make this path a symlink pointing to the target path. + """ + Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink. """ if sys.version_info >= (3, 10): def hardlink_to(self, target: StrOrBytesPath) -> None: - """Make this path a hard link pointing to the same file as *target*. + """ + Make this path a hard link pointing to the same file as *target*. Note the order of arguments (self, target) is the reverse of os.link's. """ def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: - """Create this file with the given access mode, if it doesn't exist.""" + """ + Create this file with the given access mode, if it doesn't exist. + """ def unlink(self, missing_ok: bool = False) -> None: - """Remove this file or link. + """ + Remove this file or link. If the path is a directory, use rmdir() instead. """ @@ -584,7 +665,9 @@ class Path(PurePath): """ def read_bytes(self) -> bytes: - """Open the file in bytes mode, read it, and close the file.""" + """ + Open the file in bytes mode, read it, and close the file. + """ def samefile(self, other_path: StrPath) -> bool: """Return whether other_path is the same or not as this file @@ -592,20 +675,27 @@ class Path(PurePath): """ def write_bytes(self, data: ReadableBuffer) -> int: - """Open the file in bytes mode, write to it, and close the file.""" + """ + Open the file in bytes mode, write to it, and close the file. + """ if sys.version_info >= (3, 10): def write_text( self, data: str, encoding: str | None = None, errors: str | None = None, newline: str | None = None ) -> int: - """Open the file in text mode, write to it, and close the file.""" + """ + Open the file in text mode, write to it, and close the file. + """ else: def write_text(self, data: str, encoding: str | None = None, errors: str | None = None) -> int: - """Open the file in text mode, write to it, and close the file.""" + """ + Open the file in text mode, write to it, and close the file. + """ if sys.version_info < (3, 12): if sys.version_info >= (3, 10): @deprecated("Deprecated as of Python 3.10 and removed in Python 3.12. Use hardlink_to() instead.") def link_to(self, target: StrOrBytesPath) -> None: - """Make the target path a hard link pointing to this path. + """ + Make the target path a hard link pointing to this path. Note this function does not make this path a hard link to *target*, despite the implication of the function and argument names. The order @@ -617,12 +707,14 @@ class Path(PurePath): """ else: def link_to(self, target: StrOrBytesPath) -> None: - """Make the target path a hard link pointing to this path. + """ + Make the target path a hard link pointing to this path. Note this function does not make this path a hard link to *target*, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link. + """ if sys.version_info >= (3, 12): def walk( diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/pickletools.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/pickletools.pyi index 8544e035d6..17f51626d1 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/pickletools.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/pickletools.pyi @@ -34,7 +34,8 @@ class ArgumentDescriptor: def __init__(self, name: str, n: int, reader: _Reader, doc: str) -> None: ... def read_uint1(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_uint1(io.BytesIO(b'\\xff')) 255 """ @@ -42,7 +43,8 @@ def read_uint1(f: IO[bytes]) -> int: uint1: ArgumentDescriptor def read_uint2(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_uint2(io.BytesIO(b'\\xff\\x00')) 255 >>> read_uint2(io.BytesIO(b'\\xff\\xff')) @@ -52,7 +54,8 @@ def read_uint2(f: IO[bytes]) -> int: uint2: ArgumentDescriptor def read_int4(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_int4(io.BytesIO(b'\\xff\\x00\\x00\\x00')) 255 >>> read_int4(io.BytesIO(b'\\x00\\x00\\x00\\x80')) == -(2**31) @@ -62,7 +65,8 @@ def read_int4(f: IO[bytes]) -> int: int4: ArgumentDescriptor def read_uint4(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_uint4(io.BytesIO(b'\\xff\\x00\\x00\\x00')) 255 >>> read_uint4(io.BytesIO(b'\\x00\\x00\\x00\\x80')) == 2**31 @@ -72,7 +76,8 @@ def read_uint4(f: IO[bytes]) -> int: uint4: ArgumentDescriptor def read_uint8(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_uint8(io.BytesIO(b'\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00')) 255 >>> read_uint8(io.BytesIO(b'\\xff' * 8)) == 2**64-1 @@ -83,7 +88,8 @@ uint8: ArgumentDescriptor if sys.version_info >= (3, 12): def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True, *, encoding: str = "latin-1") -> bytes | str: - """>>> import io + """ + >>> import io >>> read_stringnl(io.BytesIO(b"'abcd'\\nefg\\n")) 'abcd' @@ -110,7 +116,8 @@ if sys.version_info >= (3, 12): else: def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: - """>>> import io + """ + >>> import io >>> read_stringnl(io.BytesIO(b"'abcd'\\nefg\\n")) 'abcd' @@ -142,7 +149,8 @@ def read_stringnl_noescape(f: IO[bytes]) -> str: ... stringnl_noescape: ArgumentDescriptor def read_stringnl_noescape_pair(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\\nEmpty\\njunk")) 'Queue Empty' """ @@ -150,7 +158,8 @@ def read_stringnl_noescape_pair(f: IO[bytes]) -> str: stringnl_noescape_pair: ArgumentDescriptor def read_string1(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> read_string1(io.BytesIO(b"\\x00")) '' >>> read_string1(io.BytesIO(b"\\x03abcdef")) @@ -160,7 +169,8 @@ def read_string1(f: IO[bytes]) -> str: string1: ArgumentDescriptor def read_string4(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> read_string4(io.BytesIO(b"\\x00\\x00\\x00\\x00abc")) '' >>> read_string4(io.BytesIO(b"\\x03\\x00\\x00\\x00abcdef")) @@ -174,7 +184,8 @@ def read_string4(f: IO[bytes]) -> str: string4: ArgumentDescriptor def read_bytes1(f: IO[bytes]) -> bytes: - """>>> import io + """ + >>> import io >>> read_bytes1(io.BytesIO(b"\\x00")) b'' >>> read_bytes1(io.BytesIO(b"\\x03abcdef")) @@ -184,7 +195,8 @@ def read_bytes1(f: IO[bytes]) -> bytes: bytes1: ArgumentDescriptor def read_bytes4(f: IO[bytes]) -> bytes: - """>>> import io + """ + >>> import io >>> read_bytes4(io.BytesIO(b"\\x00\\x00\\x00\\x00abc")) b'' >>> read_bytes4(io.BytesIO(b"\\x03\\x00\\x00\\x00abcdef")) @@ -198,7 +210,8 @@ def read_bytes4(f: IO[bytes]) -> bytes: bytes4: ArgumentDescriptor def read_bytes8(f: IO[bytes]) -> bytes: - """>>> import io, struct, sys + """ + >>> import io, struct, sys >>> read_bytes8(io.BytesIO(b"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00abc")) b'' >>> read_bytes8(io.BytesIO(b"\\x03\\x00\\x00\\x00\\x00\\x00\\x00\\x00abcdef")) @@ -213,7 +226,8 @@ def read_bytes8(f: IO[bytes]) -> bytes: bytes8: ArgumentDescriptor def read_unicodestringnl(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> read_unicodestringnl(io.BytesIO(b"abc\\\\uabcd\\njunk")) == 'abc\\uabcd' True """ @@ -221,7 +235,8 @@ def read_unicodestringnl(f: IO[bytes]) -> str: unicodestringnl: ArgumentDescriptor def read_unicodestring1(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> s = 'abcd\\uabcd' >>> enc = s.encode('utf-8') >>> enc @@ -240,7 +255,8 @@ def read_unicodestring1(f: IO[bytes]) -> str: unicodestring1: ArgumentDescriptor def read_unicodestring4(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> s = 'abcd\\uabcd' >>> enc = s.encode('utf-8') >>> enc @@ -259,7 +275,8 @@ def read_unicodestring4(f: IO[bytes]) -> str: unicodestring4: ArgumentDescriptor def read_unicodestring8(f: IO[bytes]) -> str: - """>>> import io + """ + >>> import io >>> s = 'abcd\\uabcd' >>> enc = s.encode('utf-8') >>> enc @@ -278,7 +295,8 @@ def read_unicodestring8(f: IO[bytes]) -> str: unicodestring8: ArgumentDescriptor def read_decimalnl_short(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_decimalnl_short(io.BytesIO(b"1234\\n56")) 1234 @@ -289,7 +307,8 @@ def read_decimalnl_short(f: IO[bytes]) -> int: """ def read_decimalnl_long(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_decimalnl_long(io.BytesIO(b"1234L\\n56")) 1234 @@ -302,7 +321,8 @@ decimalnl_short: ArgumentDescriptor decimalnl_long: ArgumentDescriptor def read_floatnl(f: IO[bytes]) -> float: - """>>> import io + """ + >>> import io >>> read_floatnl(io.BytesIO(b"-1.25\\n6")) -1.25 """ @@ -310,7 +330,8 @@ def read_floatnl(f: IO[bytes]) -> float: floatnl: ArgumentDescriptor def read_float8(f: IO[bytes]) -> float: - """>>> import io, struct + """ + >>> import io, struct >>> raw = struct.pack(">d", -1.25) >>> raw b'\\xbf\\xf4\\x00\\x00\\x00\\x00\\x00\\x00' @@ -321,7 +342,8 @@ def read_float8(f: IO[bytes]) -> float: float8: ArgumentDescriptor def read_long1(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_long1(io.BytesIO(b"\\x00")) 0 >>> read_long1(io.BytesIO(b"\\x02\\xff\\x00")) @@ -337,7 +359,8 @@ def read_long1(f: IO[bytes]) -> int: long1: ArgumentDescriptor def read_long4(f: IO[bytes]) -> int: - """>>> import io + """ + >>> import io >>> read_long4(io.BytesIO(b"\\x02\\x00\\x00\\x00\\xff\\x00")) 255 >>> read_long4(io.BytesIO(b"\\x02\\x00\\x00\\x00\\xff\\x7f")) diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/pkgutil.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/pkgutil.pyi index 4b348d324d..3aef575b3b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/pkgutil.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/pkgutil.pyi @@ -191,7 +191,8 @@ def get_data(package: str, resource: str) -> bytes | None: """ def resolve_name(name: str) -> Any: - """Resolve a name to an object. + """ + Resolve a name to an object. It is expected that `name` will be a string in one of the following formats, where W is shorthand for a valid Python identifier and dot stands diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/platform.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/platform.pyi index c80a20d581..f4646f70ec 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/platform.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/platform.pyi @@ -23,6 +23,7 @@ def libc_ver(executable: str | None = None, lib: str = "", version: str = "", ch only usable for executables compiled using gcc. The file is read and scanned in chunks of chunksize bytes. + """ def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ... @@ -50,6 +51,7 @@ def java_ver( Values which cannot be determined are set to the defaults given as parameters (which all default to ''). + """ def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: @@ -58,6 +60,7 @@ def system_alias(system: str, release: str, version: str) -> tuple[str, str, str It also does some reordering of the information in some cases where it would otherwise cause confusion. + """ def architecture(executable: str = sys.executable, bits: str = "", linkage: str = "") -> tuple[str, str]: @@ -78,6 +81,7 @@ def architecture(executable: str = sys.executable, bits: str = "", linkage: str platforms. On some non-Unix platforms where the "file" command does not exist and the executable is set to the Python interpreter binary defaults from _default_architecture are used. + """ # This class is not exposed. It calls itself platform.uname_result_base. @@ -97,7 +101,8 @@ class _uname_result_base(NamedTuple): # uname_result emulates a 6-field named tuple, but the processor field # is lazily evaluated rather than being passed in to the constructor. class uname_result(_uname_result_base): - """A uname_result that's largely compatible with a + """ + A uname_result that's largely compatible with a simple namedtuple except that 'processor' is resolved late and cached to avoid calling "uname" except when needed. @@ -121,12 +126,14 @@ def uname() -> uname_result: possible processor information as an additional tuple entry. Entries which cannot be determined are set to ''. + """ def system() -> str: """Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. An empty string is returned if the value cannot be determined. + """ def node() -> str: @@ -134,24 +141,28 @@ def node() -> str: qualified) An empty string is returned if the value cannot be determined. + """ def release() -> str: """Returns the system's release, e.g. '2.2.0' or 'NT' An empty string is returned if the value cannot be determined. + """ def version() -> str: """Returns the system's release version, e.g. '#3 on degas' An empty string is returned if the value cannot be determined. + """ def machine() -> str: """Returns the machine type, e.g. 'i386' An empty string is returned if the value cannot be determined. + """ def processor() -> str: @@ -161,6 +172,7 @@ def processor() -> str: determined. Note that many platforms do not provide this information or simply return the same value as for machine(), e.g. NetBSD does this. + """ def python_implementation() -> str: @@ -170,6 +182,7 @@ def python_implementation() -> str: 'CPython' (C implementation of Python), 'Jython' (Java implementation of Python), 'PyPy' (Python implementation of Python). + """ def python_version() -> str: @@ -177,6 +190,7 @@ def python_version() -> str: Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0). + """ def python_version_tuple() -> tuple[str, str, str]: @@ -185,6 +199,7 @@ def python_version_tuple() -> tuple[str, str, str]: Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0). + """ def python_branch() -> str: @@ -195,6 +210,7 @@ def python_branch() -> str: Python binary was built. If not available, an empty string is returned. + """ def python_revision() -> str: @@ -205,16 +221,19 @@ def python_revision() -> str: Python binary was built. If not available, an empty string is returned. + """ def python_build() -> tuple[str, str]: """Returns a tuple (buildno, builddate) stating the Python build number and date as strings. + """ def python_compiler() -> str: """Returns a string identifying the compiler used for compiling Python. + """ def platform(aliased: bool = ..., terse: bool = ...) -> str: @@ -233,6 +252,7 @@ def platform(aliased: bool = ..., terse: bool = ...) -> str: Setting terse to true causes the function to return only the absolute minimum information needed to identify the platform. + """ if sys.version_info >= (3, 10): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/pprint.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/pprint.pyi index e9e8a78d2f..6146ea8d58 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/pprint.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/pprint.pyi @@ -25,6 +25,8 @@ saferepr() """ import sys +from _typeshed import SupportsWrite +from collections import deque from typing import IO __all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"] @@ -57,26 +59,26 @@ else: if sys.version_info >= (3, 10): def pp( object: object, - stream: IO[str] | None = ..., - indent: int = ..., - width: int = ..., - depth: int | None = ..., + stream: IO[str] | None = None, + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., + compact: bool = False, sort_dicts: bool = False, - underscore_numbers: bool = ..., + underscore_numbers: bool = False, ) -> None: """Pretty-print a Python object""" else: def pp( object: object, - stream: IO[str] | None = ..., - indent: int = ..., - width: int = ..., - depth: int | None = ..., + stream: IO[str] | None = None, + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., + compact: bool = False, sort_dicts: bool = False, ) -> None: """Pretty-print a Python object""" @@ -154,6 +156,7 @@ class PrettyPrinter: underscore_numbers If true, digit groups are separated with underscores. + """ else: def __init__( @@ -187,6 +190,7 @@ class PrettyPrinter: sort_dicts If true, dict keys are sorted. + """ def pformat(self, object: object) -> str: ... @@ -198,3 +202,49 @@ class PrettyPrinter: and flags indicating whether the representation is 'readable' and whether the object represents a recursive construct. """ + + def _format( + self, object: object, stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int + ) -> None: ... + def _pprint_dict( + self, + object: dict[object, object], + stream: SupportsWrite[str], + indent: int, + allowance: int, + context: dict[int, int], + level: int, + ) -> None: ... + def _pprint_list( + self, object: list[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int + ) -> None: ... + def _pprint_tuple( + self, + object: tuple[object, ...], + stream: SupportsWrite[str], + indent: int, + allowance: int, + context: dict[int, int], + level: int, + ) -> None: ... + def _pprint_set( + self, object: set[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int + ) -> None: ... + def _pprint_deque( + self, object: deque[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int + ) -> None: ... + def _format_dict_items( + self, + items: list[tuple[object, object]], + stream: SupportsWrite[str], + indent: int, + allowance: int, + context: dict[int, int], + level: int, + ) -> None: ... + def _format_items( + self, items: list[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int + ) -> None: ... + def _repr(self, object: object, context: dict[int, int], level: int) -> str: ... + if sys.version_info >= (3, 10): + def _safe_repr(self, object: object, context: dict[int, int], maxlevels: int, level: int) -> tuple[str, bool, bool]: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/py_compile.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/py_compile.pyi index c593bb8188..65c5f48879 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/py_compile.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/py_compile.pyi @@ -34,6 +34,7 @@ class PyCompileError(Exception): given, consistent with 'standard' py_compile output. message (or default) can be accesses as class variable 'msg' + """ exc_type_name: str @@ -116,4 +117,5 @@ else: structure to locate source files; it only compiles files named explicitly. If '-' is the only parameter in args, the list of files is taken from standard input. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/random.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/random.pyi index bb90244087..b46488f02e 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/random.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/random.pyi @@ -97,6 +97,7 @@ class Random(_random.Random): methods: random(), seed(), getstate(), and setstate(). Optionally, implement a getrandbits() method so that randrange() can cover arbitrarily large ranges. + """ VERSION: ClassVar[int] @@ -123,6 +124,7 @@ class Random(_random.Random): bytes, or bytearray. For version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for str and bytes generates a narrower range of seeds. + """ def getstate(self) -> tuple[Any, ...]: @@ -136,6 +138,7 @@ class Random(_random.Random): Roughly equivalent to ``choice(range(start, stop, step))`` but supports arbitrarily large ranges and is optimized for common cases. + """ def randint(self, a: int, b: int) -> int: @@ -159,6 +162,7 @@ class Random(_random.Random): If the relative weights or cumulative weights are not specified, the selections are made with equal probability. + """ if sys.version_info >= (3, 11): def shuffle(self, x: MutableSequence[Any]) -> None: @@ -170,6 +174,7 @@ class Random(_random.Random): Optional argument random is a 0-argument function returning a random float in [0.0, 1.0); if it is the default None, the standard random.random will be used. + """ if sys.version_info >= (3, 11): def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: @@ -199,6 +204,7 @@ class Random(_random.Random): for sampling from a large population: sample(range(10000000), 60) + """ else: def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: @@ -228,6 +234,7 @@ class Random(_random.Random): for sampling from a large population: sample(range(10000000), 60) + """ def uniform(self, a: float, b: float) -> float: @@ -237,6 +244,7 @@ class Random(_random.Random): E[X] = (a + b) / 2 Var[X] = (b - a) ** 2 / 12 + """ def triangular(self, low: float = 0.0, high: float = 1.0, mode: float | None = None) -> float: @@ -251,6 +259,7 @@ class Random(_random.Random): E[X] = (low + high + mode) / 3 Var[X] = (low**2 + high**2 + mode**2 - low*high - low*mode - high*mode) / 18 + """ if sys.version_info >= (3, 12): def binomialvariate(self, n: int = 1, p: float = 0.5) -> int: @@ -273,6 +282,7 @@ class Random(_random.Random): E[X] = n * p Var[X] = n * p * (1 - p) + """ def betavariate(self, alpha: float, beta: float) -> float: @@ -285,6 +295,7 @@ class Random(_random.Random): E[X] = alpha / (alpha + beta) Var[X] = alpha * beta / ((alpha + beta)**2 * (alpha + beta + 1)) + """ if sys.version_info >= (3, 12): def expovariate(self, lambd: float = 1.0) -> float: @@ -300,6 +311,7 @@ class Random(_random.Random): E[X] = 1 / lambd Var[X] = 1 / lambd ** 2 + """ else: def expovariate(self, lambd: float) -> float: @@ -310,6 +322,7 @@ class Random(_random.Random): a reserved word in Python.) Returned values range from 0 to positive infinity if lambd is positive, and from negative infinity to 0 if lambd is negative. + """ def gammavariate(self, alpha: float, beta: float) -> float: @@ -327,6 +340,7 @@ class Random(_random.Random): E[X] = alpha * beta Var[X] = alpha * beta ** 2 + """ if sys.version_info >= (3, 11): def gauss(self, mu: float = 0.0, sigma: float = 1.0) -> float: @@ -336,12 +350,14 @@ class Random(_random.Random): slightly faster than the normalvariate() function. Not thread-safe without a lock around calls. + """ def normalvariate(self, mu: float = 0.0, sigma: float = 1.0) -> float: """Normal distribution. mu is the mean, and sigma is the standard deviation. + """ else: def gauss(self, mu: float, sigma: float) -> float: @@ -351,12 +367,14 @@ class Random(_random.Random): slightly faster than the normalvariate() function. Not thread-safe without a lock around calls. + """ def normalvariate(self, mu: float, sigma: float) -> float: """Normal distribution. mu is the mean, and sigma is the standard deviation. + """ def lognormvariate(self, mu: float, sigma: float) -> float: @@ -365,6 +383,7 @@ class Random(_random.Random): If you take the natural logarithm of this distribution, you'll get a normal distribution with mean mu and standard deviation sigma. mu can have any value, and sigma must be greater than zero. + """ def vonmisesvariate(self, mu: float, kappa: float) -> float: @@ -374,6 +393,7 @@ class Random(_random.Random): kappa is the concentration parameter, which must be greater than or equal to zero. If kappa is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2*pi. + """ def paretovariate(self, alpha: float) -> float: @@ -383,6 +403,7 @@ class Random(_random.Random): """Weibull distribution. alpha is the scale parameter and beta is the shape parameter. + """ # SystemRandom is not implemented for all OS's; good on Windows & Linux @@ -392,6 +413,7 @@ class SystemRandom(Random): CryptGenRandom on Windows). Not available on all systems (see os.urandom() for details). + """ def getrandbits(self, k: int) -> int: # k can be passed by keyword diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/re.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/re.pyi index a1a60bc77e..19d5fdade7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/re.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/re.pyi @@ -435,9 +435,7 @@ if sys.version_info < (3, 13): T: Final = RegexFlag.T TEMPLATE: Final = RegexFlag.TEMPLATE if sys.version_info >= (3, 11): - # pytype chokes on `NOFLAG: Final = RegexFlag.NOFLAG` with `LiteralValueError` - # mypy chokes on `NOFLAG: Final[Literal[RegexFlag.NOFLAG]]` with `Literal[...] is invalid` - NOFLAG = RegexFlag.NOFLAG + NOFLAG: Final = RegexFlag.NOFLAG _FlagsType: TypeAlias = int | RegexFlag # Type-wise the compile() overloads are unnecessary, they could also be modeled using @@ -558,7 +556,9 @@ def subn( flags: _FlagsType = 0, ) -> tuple[bytes, int]: ... def escape(pattern: AnyStr) -> AnyStr: - """Escape special characters in a string.""" + """ + Escape special characters in a string. + """ def purge() -> None: """Clear the regular expression caches""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/rlcompleter.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/rlcompleter.pyi index daeec2a458..37185ea5d7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/rlcompleter.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/rlcompleter.pyi @@ -54,6 +54,7 @@ class Completer: This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. + """ def attr_matches(self, text: str) -> list[str]: @@ -66,6 +67,7 @@ class Completer: WARNING: this can still invoke arbitrary C code, if an object with a __getattr__ hook is evaluated. + """ def global_matches(self, text: str) -> list[str]: @@ -73,4 +75,5 @@ class Completer: Return a list of all keywords, built-in functions and names currently defined in self.namespace that match. + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/sched.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/sched.pyi index 2dd182cdbe..0567d514ac 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/sched.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/sched.pyi @@ -71,6 +71,7 @@ class scheduler: Returns an ID for the event which can be used to remove it, if necessary. + """ def enter( @@ -79,6 +80,7 @@ class scheduler: """A variant that specifies the time as a relative time. This is actually the more commonly used interface. + """ def run(self, blocking: bool = True) -> float | None: @@ -103,6 +105,7 @@ class scheduler: just after an event is executed, a delay of 0 is executed, to avoid monopolizing the CPU when other threads are also runnable. + """ def cancel(self, event: Event) -> None: @@ -110,6 +113,7 @@ class scheduler: This must be presented the ID as returned by enter(). If the event is not in the queue, this raises ValueError. + """ def empty(self) -> bool: @@ -121,4 +125,5 @@ class scheduler: Events are named tuples with fields for: time, priority, action, arguments, kwargs + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/secrets.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/secrets.pyi index 42594b4ca3..d6c5de9b37 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/secrets.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/secrets.pyi @@ -32,6 +32,7 @@ def token_bytes(nbytes: int | None = None) -> bytes: >>> token_bytes(16) #doctest:+SKIP b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b' + """ def token_hex(nbytes: int | None = None) -> str: @@ -43,6 +44,7 @@ def token_hex(nbytes: int | None = None) -> str: >>> token_hex(16) #doctest:+SKIP 'f9bf78b9a18ce6d46a0cd2b0b86df9da' + """ def token_urlsafe(nbytes: int | None = None) -> str: @@ -53,4 +55,5 @@ def token_urlsafe(nbytes: int | None = None) -> str: >>> token_urlsafe(16) #doctest:+SKIP 'Drmhze6EPcv0fN_81Bj-nA' + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/shutil.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/shutil.pyi index ea1a71c440..81fb8d8616 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/shutil.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/shutil.pyi @@ -79,6 +79,7 @@ def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: boo If follow_symlinks is not set and src is a symbolic link, a new symlink will be created instead of copying the file it points to. + """ def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: @@ -87,6 +88,7 @@ def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool If follow_symlinks is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. If `lchmod` isn't available (e.g. Linux) this method does nothing. + """ def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: @@ -113,6 +115,7 @@ def copy(src: StrPath, dst: _StrPathT, *, follow_symlinks: bool = True) -> _StrP If source and destination are the same file, a SameFileError will be raised. + """ @overload @@ -270,6 +273,7 @@ def move(src: StrPath, dst: _StrPathT, copy_function: _CopyFn = ...) -> _StrPath A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. + """ class _ntuple_diskusage(NamedTuple): @@ -357,6 +361,7 @@ if sys.platform == "win32" and sys.version_info < (3, 12): `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. + """ @overload @@ -368,6 +373,7 @@ def which(cmd: StrPath, mode: int = 1, path: StrPath | None = None) -> str | Non `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/signal.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/signal.pyi index cae043159e..0f6009add2 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/signal.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/signal.pyi @@ -311,7 +311,7 @@ def valid_signals() -> set[Signals]: def raise_signal(signalnum: _SIGNUM, /) -> None: """Send a signal to the executing process.""" -def set_wakeup_fd(fd: int, /, *, warn_on_full_buffer: bool = ...) -> int: +def set_wakeup_fd(fd: int, /, *, warn_on_full_buffer: bool = True) -> int: """Sets the fd to be written to (with the signal number) when a signal comes in. A library can use this to wakeup select or poll. @@ -321,5 +321,5 @@ def set_wakeup_fd(fd: int, /, *, warn_on_full_buffer: bool = ...) -> int: """ if sys.platform == "linux": - def pidfd_send_signal(pidfd: int, sig: int, siginfo: None = None, flags: int = ..., /) -> None: + def pidfd_send_signal(pidfd: int, sig: int, siginfo: None = None, flags: int = 0, /) -> None: """Send a signal to a process referred to by a pid file descriptor.""" diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/site.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/site.pyi index 9b30fd9014..9c302c7617 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/site.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/site.pyi @@ -186,6 +186,7 @@ def setquit() -> None: # undocumented These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. + """ def venv(known_paths: set[str] | None) -> set[str] | None: ... # undocumented diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/smtpd.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/smtpd.pyi index 2dbad45be3..242544fb72 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/smtpd.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/smtpd.pyi @@ -151,6 +151,7 @@ class SMTPServer(asyncore.dispatcher): This function should return None for a normal `250 Ok' response; otherwise, it should return the desired response string in RFC 821 format. + """ class DebuggingServer(SMTPServer): ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/smtplib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/smtplib.pyi index 58a99483f1..b134010a9b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/smtplib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/smtplib.pyi @@ -225,6 +225,7 @@ class SMTP: port) for the socket to bind to as its source address before connecting. If the host is '' and port is 0, the OS default behavior will be used. + """ def __enter__(self) -> Self: ... @@ -236,6 +237,7 @@ class SMTP: A non-false value results in debug messages for connection and for all messages sent to and received from the server. + """ def connect(self, host: str = "localhost", port: int = 0, source_address: _SourceAddress | None = None) -> _Reply: @@ -247,6 +249,7 @@ class SMTP: Note: This method is automatically invoked by __init__, if a host is specified during instantiation. + """ def send(self, s: ReadableBuffer | str) -> None: @@ -511,6 +514,7 @@ In the above example, the message was accepted for delivery to three of the four addresses, and one was rejected, with the error code 550. If all addresses are accepted, then the method will return an empty dictionary. + """ def send_message( @@ -538,6 +542,7 @@ empty dictionary. If the server does not support SMTPUTF8, an SMTPNotSupported error is raised. Otherwise the generator is called without modifying the policy. + """ def close(self) -> None: @@ -554,6 +559,7 @@ class SMTP_SSL(SMTP): (465) is used. local_hostname and source_address have the same meaning as they do in the SMTP class. context also optional, can contain a SSLContext. + """ keyfile: str | None diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/socket.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/socket.pyi index 2538a37a0e..7bed33aec3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/socket.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/socket.pyi @@ -183,7 +183,7 @@ from _typeshed import ReadableBuffer, Unused, WriteableBuffer from collections.abc import Iterable from enum import IntEnum, IntFlag from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper -from typing import Any, Literal, Protocol, SupportsIndex, overload +from typing import Any, Literal, Protocol, SupportsIndex, overload, type_check_only from typing_extensions import Self __all__ = [ @@ -1345,6 +1345,7 @@ if sys.platform != "win32" and sys.platform != "linux": if sys.platform == "win32": errorTab: dict[int, str] # undocumented +@type_check_only class _SendableFile(Protocol): def read(self, size: int, /) -> bytes: ... def seek(self, offset: int, /) -> object: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/socketserver.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/socketserver.pyi index 2ff9e24f67..efd9834491 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/socketserver.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/socketserver.pyi @@ -200,6 +200,7 @@ class BaseServer: - RequestHandlerClass - socket + """ server_address: _Address @@ -236,6 +237,7 @@ class BaseServer: """Called to clean-up the server. May be overridden. + """ def finish_request(self, request: _RequestType, client_address: _RetAddress) -> None: @@ -246,6 +248,7 @@ class BaseServer: """Handle an error gracefully. May be overridden. The default is to print a traceback and continue. + """ def handle_timeout(self) -> None: @@ -258,18 +261,21 @@ class BaseServer: """Call finish_request. Overridden by ForkingMixIn and ThreadingMixIn. + """ def server_activate(self) -> None: """Called by constructor to activate the server. May be overridden. + """ def verify_request(self, request: _RequestType, client_address: _RetAddress) -> bool: """Verify the request. May be overridden. Return True if we should proceed with this request. + """ def __enter__(self) -> Self: ... @@ -333,6 +339,7 @@ class TCPServer(BaseServer): - server_address - RequestHandlerClass - socket + """ address_family: int @@ -355,18 +362,21 @@ class TCPServer(BaseServer): """Return socket file number. Interface required by selector. + """ def get_request(self) -> tuple[_socket, _RetAddress]: """Get the request and client address from the socket. May be overridden. + """ def server_bind(self) -> None: """Called by constructor to bind the socket. May be overridden. + """ class UDPServer(TCPServer): @@ -433,6 +443,7 @@ class ThreadingMixIn: """Same as in BaseServer but as a thread. In addition, exception handling is done here. + """ def process_request(self, request: _RequestType, client_address: _RetAddress) -> None: @@ -468,6 +479,7 @@ class BaseRequestHandler: needs access to per-server information) as self.server. Since a separate instance is created for each request, the handle() method can define other arbitrary instance variables. + """ # `request` is technically of type _RequestType, diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/sqlite3/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/sqlite3/__init__.pyi index 779778c6dc..ff9fec4735 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/sqlite3/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/sqlite3/__init__.pyi @@ -254,6 +254,8 @@ _SqliteData: TypeAlias = str | ReadableBuffer | int | float | None _AdaptedInputData: TypeAlias = _SqliteData | Any # The Mapping must really be a dict, but making it invariant is too annoying. _Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData] +# Controls the legacy transaction handling mode of sqlite3. +_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None class _AnyParamWindowAggregateClass(Protocol): def step(self, *args: Any) -> object: ... @@ -321,7 +323,7 @@ class Connection: def Warning(self) -> type[Warning]: ... @property def in_transaction(self) -> bool: ... - isolation_level: str | None # one of '', 'DEFERRED', 'IMMEDIATE' or 'EXCLUSIVE' + isolation_level: _IsolationLevel @property def total_changes(self) -> int: ... if sys.version_info >= (3, 12): @@ -335,26 +337,26 @@ class Connection: def __init__( self, database: StrOrBytesPath, - timeout: float = ..., - detect_types: int = ..., - isolation_level: str | None = ..., - check_same_thread: bool = ..., + timeout: float = 5.0, + detect_types: int = 0, + isolation_level: _IsolationLevel = "DEFERRED", + check_same_thread: bool = True, factory: type[Connection] | None = ..., - cached_statements: int = ..., - uri: bool = ..., + cached_statements: int = 128, + uri: bool = False, autocommit: bool = ..., ) -> None: ... else: def __init__( self, database: StrOrBytesPath, - timeout: float = ..., - detect_types: int = ..., - isolation_level: str | None = ..., - check_same_thread: bool = ..., + timeout: float = 5.0, + detect_types: int = 0, + isolation_level: _IsolationLevel = "DEFERRED", + check_same_thread: bool = True, factory: type[Connection] | None = ..., - cached_statements: int = ..., - uri: bool = ..., + cached_statements: int = 128, + uri: bool = False, ) -> None: ... def close(self) -> None: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/ssl.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/ssl.pyi index 78c46e4610..bb22a067e3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/ssl.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/ssl.pyi @@ -187,6 +187,7 @@ class SSLCertVerificationError(SSLError, ValueError): CertificateError = SSLCertVerificationError if sys.version_info < (3, 12): + @deprecated("Deprecated since Python 3.7. Removed in Python 3.12. Use `SSLContext.wrap_socket()` instead.") def wrap_socket( sock: socket.socket, keyfile: StrOrBytesPath | None = None, @@ -199,66 +200,7 @@ if sys.version_info < (3, 12): suppress_ragged_eofs: bool = True, ciphers: str | None = None, ) -> SSLSocket: ... - -def create_default_context( - purpose: Purpose = ..., - *, - cafile: StrOrBytesPath | None = None, - capath: StrOrBytesPath | None = None, - cadata: str | ReadableBuffer | None = None, -) -> SSLContext: - """Create a SSLContext object with default settings. - - NOTE: The protocol and settings may change anytime without prior - deprecation. The values represent a fair balance between maximum - compatibility and security. - """ - -if sys.version_info >= (3, 10): - def _create_unverified_context( - protocol: int | None = None, - *, - cert_reqs: int = ..., - check_hostname: bool = False, - purpose: Purpose = ..., - certfile: StrOrBytesPath | None = None, - keyfile: StrOrBytesPath | None = None, - cafile: StrOrBytesPath | None = None, - capath: StrOrBytesPath | None = None, - cadata: str | ReadableBuffer | None = None, - ) -> SSLContext: - """Create a SSLContext object for Python stdlib modules - - All Python stdlib modules shall use this function to create SSLContext - objects in order to keep common settings in one place. The configuration - is less restrict than create_default_context()'s to increase backward - compatibility. - """ - -else: - def _create_unverified_context( - protocol: int = ..., - *, - cert_reqs: int = ..., - check_hostname: bool = False, - purpose: Purpose = ..., - certfile: StrOrBytesPath | None = None, - keyfile: StrOrBytesPath | None = None, - cafile: StrOrBytesPath | None = None, - capath: StrOrBytesPath | None = None, - cadata: str | ReadableBuffer | None = None, - ) -> SSLContext: - """Create a SSLContext object for Python stdlib modules - - All Python stdlib modules shall use this function to create SSLContext - objects in order to keep common settings in one place. The configuration - is less restrict than create_default_context()'s to increase backward - compatibility. - """ - -_create_default_https_context: Callable[..., SSLContext] - -if sys.version_info < (3, 12): + @deprecated("Deprecated since Python 3.7. Removed in Python 3.12.") def match_hostname(cert: _PeerCertRetDictType, hostname: str) -> None: """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 @@ -609,7 +551,7 @@ class SSLSocket(socket.socket): of the peers. """ if sys.version_info >= (3, 10): - @deprecated("Deprecated in 3.10. Use ALPN instead.") + @deprecated("Deprecated since Python 3.10. Use ALPN instead.") def selected_npn_protocol(self) -> str | None: """Return the currently selected NPN protocol as a string, or ``None`` if a next protocol was not negotiated or if NPN is not supported by one @@ -692,13 +634,15 @@ class SSLContext(_SSLContext): if sys.version_info >= (3, 10): security_level: int if sys.version_info >= (3, 10): - # Using the default (None) for the `protocol` parameter is deprecated, - # but there isn't a good way of marking that in the stub unless/until PEP 702 is accepted - def __new__(cls, protocol: int | None = None, *args: Any, **kwargs: Any) -> Self: ... + @overload + def __new__(cls, protocol: int, *args: Any, **kwargs: Any) -> Self: ... + @overload + @deprecated("Deprecated since Python 3.10. Use a specific version of the SSL protocol.") + def __new__(cls, protocol: None = None, *args: Any, **kwargs: Any) -> Self: ... else: def __new__(cls, protocol: int = ..., *args: Any, **kwargs: Any) -> Self: ... - def load_default_certs(self, purpose: Purpose = ...) -> None: ... + def load_default_certs(self, purpose: Purpose = Purpose.SERVER_AUTH) -> None: ... def load_verify_locations( self, cafile: StrOrBytesPath | None = None, @@ -725,7 +669,7 @@ class SSLContext(_SSLContext): def set_ciphers(self, cipherlist: str, /) -> None: ... def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ... if sys.version_info >= (3, 10): - @deprecated("Deprecated in 3.10. Use ALPN instead.") + @deprecated("Deprecated since Python 3.10. Use ALPN instead.") def set_npn_protocols(self, npn_protocols: Iterable[str]) -> None: ... else: def set_npn_protocols(self, npn_protocols: Iterable[str]) -> None: ... @@ -751,6 +695,64 @@ class SSLContext(_SSLContext): session: SSLSession | None = None, ) -> SSLObject: ... +def create_default_context( + purpose: Purpose = Purpose.SERVER_AUTH, + *, + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, +) -> SSLContext: + """Create a SSLContext object with default settings. + + NOTE: The protocol and settings may change anytime without prior + deprecation. The values represent a fair balance between maximum + compatibility and security. + """ + +if sys.version_info >= (3, 10): + def _create_unverified_context( + protocol: int | None = None, + *, + cert_reqs: int = ..., + check_hostname: bool = False, + purpose: Purpose = Purpose.SERVER_AUTH, + certfile: StrOrBytesPath | None = None, + keyfile: StrOrBytesPath | None = None, + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, + ) -> SSLContext: + """Create a SSLContext object for Python stdlib modules + + All Python stdlib modules shall use this function to create SSLContext + objects in order to keep common settings in one place. The configuration + is less restrict than create_default_context()'s to increase backward + compatibility. + """ + +else: + def _create_unverified_context( + protocol: int = ..., + *, + cert_reqs: int = ..., + check_hostname: bool = False, + purpose: Purpose = Purpose.SERVER_AUTH, + certfile: StrOrBytesPath | None = None, + keyfile: StrOrBytesPath | None = None, + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, + ) -> SSLContext: + """Create a SSLContext object for Python stdlib modules + + All Python stdlib modules shall use this function to create SSLContext + objects in order to keep common settings in one place. The configuration + is less restrict than create_default_context()'s to increase backward + compatibility. + """ + +_create_default_https_context = create_default_context + class SSLObject: """This class implements an interface on top of a low-level SSL object as implemented by OpenSSL. This object captures the state of an SSL connection @@ -816,7 +818,7 @@ class SSLObject: of the peers. """ if sys.version_info >= (3, 10): - @deprecated("Deprecated in 3.10. Use ALPN instead.") + @deprecated("Deprecated since Python 3.10. Use ALPN instead.") def selected_npn_protocol(self) -> str | None: """Return the currently selected NPN protocol as a string, or ``None`` if a next protocol was not negotiated or if NPN is not supported by one diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/statistics.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/statistics.pyi index 69499be6b3..67deb3720b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/statistics.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/statistics.pyi @@ -158,6 +158,7 @@ if sys.version_info >= (3, 11): >>> fmean([3.5, 4.0, 5.25]) 4.25 + """ else: @@ -184,6 +185,7 @@ def geometric_mean(data: Iterable[SupportsFloat]) -> float: >>> round(geometric_mean([54, 24, 36]), 9) 36.0 + """ def mean(data: Iterable[_NumberT]) -> _NumberT: @@ -201,6 +203,7 @@ def mean(data: Iterable[_NumberT]) -> _NumberT: Decimal('0.5625') If ``data`` is empty, StatisticsError will be raised. + """ if sys.version_info >= (3, 10): @@ -226,6 +229,7 @@ if sys.version_info >= (3, 10): If ``data`` is empty, or any element is less than zero, ``harmonic_mean`` will raise ``StatisticsError``. + """ else: @@ -262,6 +266,7 @@ def median(data: Iterable[_NumberT]) -> _NumberT: 3 >>> median([1, 3, 5, 7]) 4.0 + """ def median_low(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparisonT: @@ -274,6 +279,7 @@ def median_low(data: Iterable[SupportsRichComparisonT]) -> SupportsRichCompariso 3 >>> median_low([1, 3, 5, 7]) 3 + """ def median_high(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparisonT: @@ -286,6 +292,7 @@ def median_high(data: Iterable[SupportsRichComparisonT]) -> SupportsRichComparis 3 >>> median_high([1, 3, 5, 7]) 5 + """ if sys.version_info >= (3, 11): @@ -330,6 +337,7 @@ if sys.version_info >= (3, 11): Inputs may be any numeric type that can be coerced to a float during the interpolation step. + """ else: @@ -381,6 +389,7 @@ def mode(data: Iterable[_HashableT]) -> _HashableT: 'red' If *data* is empty, ``mode``, raises StatisticsError. + """ def multimode(data: Iterable[_HashableT]) -> list[_HashableT]: @@ -395,6 +404,7 @@ def multimode(data: Iterable[_HashableT]) -> list[_HashableT]: ['b', 'd', 'f'] >>> multimode('') [] + """ def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: @@ -404,6 +414,7 @@ def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 0.986893273527251 + """ def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: @@ -439,6 +450,7 @@ def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: >>> from fractions import Fraction as F >>> pvariance([F(1, 4), F(5, 4), F(1, 2)]) Fraction(13, 72) + """ def quantiles(data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = "exclusive") -> list[_NumberT]: @@ -456,6 +468,7 @@ def quantiles(data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusiv If *method* is set to *inclusive*, *data* is treated as population data. The minimum value is treated as the 0th percentile and the maximum value is treated as the 100th percentile. + """ def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: @@ -465,6 +478,7 @@ def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 1.0810874155219827 + """ def variance(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: @@ -503,6 +517,7 @@ def variance(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT >>> from fractions import Fraction as F >>> variance([F(1, 6), F(1, 2), F(5, 3)]) Fraction(67, 108) + """ class NormalDist: @@ -663,6 +678,7 @@ if sys.version_info >= (3, 12): Spearman's rank correlation coefficient is appropriate for ordinal data or for continuous data that doesn't meet the linear proportion requirement for Pearson's correlation coefficient. + """ elif sys.version_info >= (3, 10): @@ -681,6 +697,7 @@ elif sys.version_info >= (3, 10): 1.0 >>> correlation(x, y) -1.0 + """ if sys.version_info >= (3, 10): @@ -699,6 +716,7 @@ if sys.version_info >= (3, 10): -7.5 >>> covariance(z, x) -7.5 + """ class LinearRegression(NamedTuple): @@ -746,6 +764,7 @@ if sys.version_info >= (3, 11): >>> y = [3 * x[i] + noise[i] for i in range(5)] >>> linear_regression(x, y, proportional=True) #doctest: +ELLIPSIS LinearRegression(slope=2.90475..., intercept=0.0) + """ elif sys.version_info >= (3, 10): @@ -772,6 +791,7 @@ elif sys.version_info >= (3, 10): >>> y = [3 * x[i] + 2 + noise[i] for i in range(5)] >>> linear_regression(x, y) #doctest: +ELLIPSIS LinearRegression(slope=3.09078914170..., intercept=1.75684970486...) + """ if sys.version_info >= (3, 13): @@ -887,6 +907,7 @@ if sys.version_info >= (3, 13): Kernel estimation of cumulative distribution function of a random variable with bounded support https://www.econstor.eu/bitstream/10419/207829/1/10.21307_stattrans-2016-037.pdf + """ def kde_random( @@ -907,4 +928,5 @@ if sys.version_info >= (3, 13): >>> new_selections = [rand() for i in range(10)] >>> [round(x, 1) for x in new_selections] [0.7, 6.2, 1.2, 6.9, 7.0, 1.8, 2.5, -0.5, -1.8, 5.6] + """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/string/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/string/__init__.pyi index 302c661a9f..e539981969 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/string/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/string/__init__.pyi @@ -55,6 +55,7 @@ def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = None) -> StrOrLit runs of whitespace characters are replaced by a single space and leading and trailing whitespace are removed, otherwise sep is used to split and join the words. + """ class Template: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/string/templatelib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/string/templatelib.pyi index 2d30224ce5..8690a8093b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/string/templatelib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/string/templatelib.pyi @@ -2,9 +2,9 @@ from collections.abc import Iterator from types import GenericAlias -from typing import Any, Literal, final +from typing import Any, Literal, TypeVar, final, overload -__all__ = ["Interpolation", "Template"] +_T = TypeVar("_T") @final class Template: # TODO: consider making `Template` generic on `TypeVarTuple` @@ -17,7 +17,7 @@ class Template: # TODO: consider making `Template` generic on `TypeVarTuple` def __iter__(self) -> Iterator[str | Interpolation]: """Implement iter(self).""" - def __add__(self, other: Template | str) -> Template: + def __add__(self, other: Template, /) -> Template: """Return self+value.""" def __class_getitem__(cls, item: Any, /) -> GenericAlias: @@ -43,3 +43,10 @@ class Interpolation: ) -> Interpolation: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: """See PEP 585""" + +@overload +def convert(obj: _T, /, conversion: None) -> _T: + """Convert *obj* using formatted string literal semantics.""" + +@overload +def convert(obj: object, /, conversion: Literal["r", "s", "a"]) -> str: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/subprocess.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/subprocess.pyi index 6fdaf89d19..a199b8714b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/subprocess.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/subprocess.pyi @@ -2503,7 +2503,8 @@ else: """ def list2cmdline(seq: Iterable[StrOrBytesPath]) -> str: # undocumented - """Translate a sequence of arguments into a command line + """ + Translate a sequence of arguments into a command line string, using the same rules as the MS C runtime: 1) Arguments are delimited by white space, which is either a diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/sysconfig.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/sysconfig.pyi index 32cebed9e6..747771c9e9 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/sysconfig.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/sysconfig.pyi @@ -87,6 +87,7 @@ def get_platform() -> str: win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. + """ if sys.version_info >= (3, 11): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tabnanny.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tabnanny.pyi index ddc1e8ae0d..84a7f691ae 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tabnanny.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tabnanny.pyi @@ -19,7 +19,8 @@ verbose: int filename_only: int class NannyNag(Exception): - """Raised by process_tokens() if detecting an ambiguous indent. + """ + Raised by process_tokens() if detecting an ambiguous indent. Captured and handled in check(). """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tarfile.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tarfile.pyi index d23520cfcb..1faae7bb4d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tarfile.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tarfile.pyi @@ -8,7 +8,7 @@ from builtins import list as _list # aliases to avoid name clashes with fields from collections.abc import Callable, Iterable, Iterator, Mapping from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj from types import TracebackType -from typing import IO, ClassVar, Literal, Protocol, overload +from typing import IO, ClassVar, Final, Literal, Protocol, overload, type_check_only from typing_extensions import Self, TypeAlias, deprecated if sys.version_info >= (3, 14): @@ -49,6 +49,7 @@ if sys.version_info >= (3, 13): _FilterFunction: TypeAlias = Callable[[TarInfo, str], TarInfo | None] _TarfileFilter: TypeAlias = Literal["fully_trusted", "tar", "data"] | _FilterFunction +@type_check_only class _Fileobj(Protocol): def read(self, size: int, /) -> bytes: ... def write(self, b: bytes, /) -> object: ... @@ -59,58 +60,61 @@ class _Fileobj(Protocol): # name: str | bytes # mode: Literal["rb", "r+b", "wb", "xb"] +@type_check_only class _Bz2ReadableFileobj(bz2._ReadableFileobj): def close(self) -> object: ... +@type_check_only class _Bz2WritableFileobj(bz2._WritableFileobj): def close(self) -> object: ... # tar constants -NUL: bytes -BLOCKSIZE: int -RECORDSIZE: int -GNU_MAGIC: bytes -POSIX_MAGIC: bytes +NUL: Final = b"\0" +BLOCKSIZE: Final = 512 +RECORDSIZE: Final = 10240 +GNU_MAGIC: Final = b"ustar \0" +POSIX_MAGIC: Final = b"ustar\x0000" -LENGTH_NAME: int -LENGTH_LINK: int -LENGTH_PREFIX: int +LENGTH_NAME: Final = 100 +LENGTH_LINK: Final = 100 +LENGTH_PREFIX: Final = 155 -REGTYPE: bytes -AREGTYPE: bytes -LNKTYPE: bytes -SYMTYPE: bytes -CONTTYPE: bytes -BLKTYPE: bytes -DIRTYPE: bytes -FIFOTYPE: bytes -CHRTYPE: bytes +REGTYPE: Final = b"0" +AREGTYPE: Final = b"\0" +LNKTYPE: Final = b"1" +SYMTYPE: Final = b"2" +CHRTYPE: Final = b"3" +BLKTYPE: Final = b"4" +DIRTYPE: Final = b"5" +FIFOTYPE: Final = b"6" +CONTTYPE: Final = b"7" -GNUTYPE_LONGNAME: bytes -GNUTYPE_LONGLINK: bytes -GNUTYPE_SPARSE: bytes +GNUTYPE_LONGNAME: Final = b"L" +GNUTYPE_LONGLINK: Final = b"K" +GNUTYPE_SPARSE: Final = b"S" -XHDTYPE: bytes -XGLTYPE: bytes -SOLARIS_XHDTYPE: bytes +XHDTYPE: Final = b"x" +XGLTYPE: Final = b"g" +SOLARIS_XHDTYPE: Final = b"X" -USTAR_FORMAT: int -GNU_FORMAT: int -PAX_FORMAT: int -DEFAULT_FORMAT: int +_TarFormat: TypeAlias = Literal[0, 1, 2] # does not exist at runtime +USTAR_FORMAT: Final = 0 +GNU_FORMAT: Final = 1 +PAX_FORMAT: Final = 2 +DEFAULT_FORMAT: Final = PAX_FORMAT # tarfile constants -SUPPORTED_TYPES: tuple[bytes, ...] -REGULAR_TYPES: tuple[bytes, ...] -GNU_TYPES: tuple[bytes, ...] -PAX_FIELDS: tuple[str, ...] -PAX_NUMBER_FIELDS: dict[str, type] -PAX_NAME_FIELDS: set[str] +SUPPORTED_TYPES: Final[tuple[bytes, ...]] +REGULAR_TYPES: Final[tuple[bytes, ...]] +GNU_TYPES: Final[tuple[bytes, ...]] +PAX_FIELDS: Final[tuple[str, ...]] +PAX_NUMBER_FIELDS: Final[dict[str, type]] +PAX_NAME_FIELDS: Final[set[str]] -ENCODING: str +ENCODING: Final[str] -class ExFileObject(io.BufferedReader): +class ExFileObject(io.BufferedReader): # undocumented def __init__(self, tarfile: TarFile, tarinfo: TarInfo) -> None: ... class TarFile: @@ -120,13 +124,13 @@ class TarFile: name: StrOrBytesPath | None mode: Literal["r", "a", "w", "x"] fileobj: _Fileobj | None - format: int | None + format: _TarFormat | None tarinfo: type[TarInfo] dereference: bool | None ignore_zeros: bool | None encoding: str | None errors: str - fileobject: type[ExFileObject] + fileobject: type[ExFileObject] # undocumented pax_headers: Mapping[str, str] | None debug: int | None errorlevel: int | None @@ -816,7 +820,7 @@ class TarFile: the same order as the list returned by getmembers(). """ - def list(self, verbose: bool = True, *, members: _list[TarInfo] | None = None) -> None: + def list(self, verbose: bool = True, *, members: Iterable[TarInfo] | None = None) -> None: """Print a table of contents to sys.stdout. If 'verbose' is False, only the names of the members are printed. If it is True, an 'ls -l'-like output is produced. 'members' is optional and must be a subset of the @@ -1060,7 +1064,7 @@ class TarInfo: offset_data: int sparse: bytes | None mode: int - type: bytes + type: bytes # usually one of the TYPE constants, but could be an arbitrary byte linkname: str uid: int gid: int @@ -1115,7 +1119,7 @@ class TarInfo: def get_info(self) -> Mapping[str, str | int | bytes | Mapping[str, str]]: """Return the TarInfo's attributes as a dictionary.""" - def tobuf(self, format: int | None = 2, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: + def tobuf(self, format: _TarFormat | None = 2, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: """Return a tar header as a string of 512 byte blocks.""" def create_ustar_header(self, info: Mapping[str, str | int | bytes | Mapping[str, str]], encoding: str, errors: str) -> bytes: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/telnetlib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/telnetlib.pyi index 8ed0c33f06..02a97056df 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/telnetlib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/telnetlib.pyi @@ -170,6 +170,7 @@ class Telnet: callback(telnet socket, command, option) option will be chr(0) when there is no option. No other action is done afterwards by telnetlib. + """ host: str | None # undocumented @@ -196,12 +197,14 @@ class Telnet: If extra arguments are present, they are substituted in the message using the standard string formatting operator. + """ def set_debuglevel(self, debuglevel: int) -> None: """Set the debug level. The higher it is, the more debug output you get (on sys.stdout). + """ def close(self) -> None: @@ -218,6 +221,7 @@ class Telnet: Can block if the connection is blocked. May raise OSError if the connection is closed. + """ def read_until(self, match: bytes, timeout: float | None = None) -> bytes: @@ -226,6 +230,7 @@ class Telnet: When no match is found, return whatever is available instead, possibly the empty string. Raise EOFError if the connection is closed and no cooked data is available. + """ def read_all(self) -> bytes: @@ -236,6 +241,7 @@ class Telnet: Return b'' if EOF is hit. Block if no data is immediately available. + """ def read_very_eager(self) -> bytes: @@ -244,6 +250,7 @@ class Telnet: Raise EOFError if connection closed and no cooked data available. Return b'' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence. + """ def read_eager(self) -> bytes: @@ -252,6 +259,7 @@ class Telnet: Raise EOFError if connection closed and no cooked data available. Return b'' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence. + """ def read_lazy(self) -> bytes: @@ -260,6 +268,7 @@ class Telnet: Raise EOFError if connection closed and no data available. Return b'' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence. + """ def read_very_lazy(self) -> bytes: @@ -267,6 +276,7 @@ class Telnet: Raise EOFError if connection closed and no data available. Return b'' if no cooked data available otherwise. Don't block. + """ def read_sb_data(self) -> bytes: @@ -275,6 +285,7 @@ class Telnet: Return b'' if no SB ... SE available. Should only be called after seeing a SB or SE command. When a new SB command is found, old unread SB data will be discarded. Don't block. + """ def set_option_negotiation_callback(self, callback: Callable[[socket.socket, bytes, bytes], object] | None) -> None: @@ -285,6 +296,7 @@ class Telnet: Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence. + """ def rawq_getchar(self) -> bytes: @@ -292,6 +304,7 @@ class Telnet: Block if no data is immediately available. Raise EOFError when connection is closed. + """ def fill_rawq(self) -> None: @@ -299,6 +312,7 @@ class Telnet: Block if no data is immediately available. Set self.eof when connection is closed. + """ def sock_avail(self) -> bool: @@ -335,6 +349,7 @@ class Telnet: If a regular expression ends with a greedy match (e.g. '.*') or if more than one expression can match the same input, the results are undeterministic, and may depend on the I/O timing. + """ def __enter__(self) -> Self: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tempfile.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tempfile.pyi index 68700c49dc..a3b369f602 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tempfile.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tempfile.pyi @@ -40,7 +40,7 @@ from _typeshed import ( from collections.abc import Iterable, Iterator from types import GenericAlias, TracebackType from typing import IO, Any, AnyStr, Generic, Literal, overload -from typing_extensions import Self +from typing_extensions import Self, deprecated __all__ = [ "NamedTemporaryFile", @@ -313,7 +313,9 @@ class _TemporaryFileWrapper(IO[AnyStr]): def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ... def __getattr__(self, name: str) -> Any: ... def close(self) -> None: - """Close the temporary file, possibly deleting it.""" + """ + Close the temporary file, possibly deleting it. + """ # These methods don't exist directly on this object, but # are delegated to the underlying IO object through __getattr__. # We need to add them here so that this class is concrete. @@ -635,6 +637,7 @@ def mkdtemp(suffix: str | None = None, prefix: str | None = None, dir: StrPath | @overload def mkdtemp(suffix: bytes | None = None, prefix: bytes | None = None, dir: BytesPath | None = None) -> bytes: ... +@deprecated("Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.") def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: """User-callable function to return a unique temporary file name. The file is not created. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/textwrap.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/textwrap.pyi index 8b01909c69..d24ccdebc3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/textwrap.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/textwrap.pyi @@ -6,7 +6,8 @@ from re import Pattern __all__ = ["TextWrapper", "wrap", "fill", "dedent", "indent", "shorten"] class TextWrapper: - """Object for wrapping/filling text. The public interface consists of + """ + Object for wrapping/filling text. The public interface consists of the wrap() and fill() methods; the other methods are just there for subclasses to override in order to tweak the default behaviour. If you want to completely replace the main wrapping algorithm, diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/threading.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/threading.pyi index 24c6c4f60b..502b8064c7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/threading.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/threading.pyi @@ -52,6 +52,7 @@ def active_count() -> int: The returned count is equal to the length of the list returned by enumerate(). + """ @deprecated("Use active_count() instead") @@ -59,6 +60,7 @@ def activeCount() -> int: """Return the number of Thread objects currently alive. This function is deprecated, use active_count() instead. + """ def current_thread() -> Thread: @@ -66,6 +68,7 @@ def current_thread() -> Thread: If the caller's thread of control was not created through the threading module, a dummy thread object with limited functionality is returned. + """ @deprecated("Use current_thread() instead") @@ -73,6 +76,7 @@ def currentThread() -> Thread: """Return the current Thread object, corresponding to the caller's thread of control. This function is deprecated, use current_thread() instead. + """ def get_ident() -> int: @@ -91,6 +95,7 @@ def enumerate() -> list[Thread]: The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started. + """ def main_thread() -> Thread: @@ -168,6 +173,7 @@ class Thread: This class can be safely subclassed in a limited fashion. There are two ways to specify the activity: by passing a callable object to the constructor, or by overriding the run() method in a subclass. + """ name: str @@ -178,6 +184,7 @@ class Thread: This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. + """ daemon: bool if sys.version_info >= (3, 14): @@ -219,6 +226,7 @@ class Thread: If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. + """ else: def __init__( @@ -250,6 +258,7 @@ class Thread: If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. + """ def start(self) -> None: @@ -260,6 +269,7 @@ class Thread: This method will raise a RuntimeError if called more than once on the same thread object. + """ def run(self) -> None: @@ -269,6 +279,7 @@ class Thread: invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively. + """ def join(self, timeout: float | None = None) -> None: @@ -293,6 +304,7 @@ class Thread: thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception. + """ @property @@ -301,6 +313,7 @@ class Thread: This is a non-negative integer. See the get_native_id() function. This represents the Thread ID as reported by the kernel. + """ def is_alive(self) -> bool: @@ -309,6 +322,7 @@ class Thread: This method returns True just before the run() method starts until just after the run() method terminates. See also the module function enumerate(). + """ @deprecated("Get the daemon attribute instead") @@ -316,6 +330,7 @@ class Thread: """Return whether this thread is a daemon. This method is deprecated, use the daemon attribute instead. + """ @deprecated("Set the daemon attribute instead") @@ -323,6 +338,7 @@ class Thread: """Set whether this thread is a daemon. This method is deprecated, use the .daemon property instead. + """ @deprecated("Use the name attribute instead") @@ -330,6 +346,7 @@ class Thread: """Return a string used for identification purposes only. This method is deprecated, use the name attribute instead. + """ @deprecated("Use the name attribute instead") @@ -337,6 +354,7 @@ class Thread: """Set the name string for this thread. This method is deprecated, use the name attribute instead. + """ class _DummyThread(Thread): @@ -354,6 +372,7 @@ class _RLock: thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. + """ _count: int @@ -381,6 +400,7 @@ class _RLock: value, block for at most the number of seconds specified by timeout and as long as the lock cannot be acquired. Return true if the lock has been acquired, false if the timeout has elapsed. + """ def release(self) -> None: @@ -397,6 +417,7 @@ class _RLock: unlocked. There is no return value. + """ __enter__ = acquire def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... @@ -416,6 +437,7 @@ class Condition: If the lock argument is given and not None, it must be a Lock or RLock object, and it is used as the underlying lock. Otherwise, a new RLock object is created and used as the underlying lock. + """ def __init__(self, lock: Lock | _RLock | RLock | None = None) -> None: ... @@ -423,7 +445,7 @@ class Condition: def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... - def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... + def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... def release(self) -> None: ... def wait(self, timeout: float | None = None) -> bool: """Wait until notified or until a timeout occurs. @@ -446,6 +468,7 @@ class Condition: of the RLock class is used, which really unlocks it even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired. + """ def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: @@ -454,6 +477,7 @@ class Condition: predicate should be a callable which result will be interpreted as a boolean value. A timeout may be provided giving the maximum time to wait. + """ def notify(self, n: int = 1) -> None: @@ -464,6 +488,7 @@ class Condition: This method wakes up at most n of the threads waiting for the condition variable; it is a no-op if no threads are waiting. + """ def notify_all(self) -> None: @@ -471,6 +496,7 @@ class Condition: If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. + """ @deprecated("Use notify_all() instead") @@ -478,6 +504,7 @@ class Condition: """Wake up all threads waiting on this condition. This method is deprecated, use notify_all() instead. + """ class Semaphore: @@ -487,6 +514,7 @@ class Semaphore: the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. + """ _value: int @@ -514,6 +542,7 @@ class Semaphore: When invoked with a timeout other than None, it will block for at most timeout seconds. If acquire does not complete successfully in that interval, return false. Return true otherwise. + """ def __enter__(self, blocking: bool = True, timeout: float | None = None) -> bool: @@ -538,6 +567,7 @@ class Semaphore: When invoked with a timeout other than None, it will block for at most timeout seconds. If acquire does not complete successfully in that interval, return false. Return true otherwise. + """ def release(self, n: int = 1) -> None: @@ -545,6 +575,7 @@ class Semaphore: When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. + """ class BoundedSemaphore(Semaphore): @@ -561,6 +592,7 @@ class BoundedSemaphore(Semaphore): the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. + """ class Event: @@ -569,6 +601,7 @@ class Event: Events manage a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. + """ def is_set(self) -> bool: @@ -579,6 +612,7 @@ class Event: """Return true if and only if the internal flag is true. This method is deprecated, use is_set() instead. + """ def set(self) -> None: @@ -586,6 +620,7 @@ class Event: All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all. + """ def clear(self) -> None: @@ -593,6 +628,7 @@ class Event: Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again. + """ def wait(self, timeout: float | None = None) -> bool: @@ -608,6 +644,7 @@ class Event: This method returns the internal flag on exit, so it will always return True except if a timeout is given and the operation times out. + """ excepthook = _excepthook @@ -619,6 +656,7 @@ class Timer(Thread): t = Timer(30.0, f, args=None, kwargs=None) t.start() t.cancel() # stop the timer's action if it's still waiting + """ args: Iterable[Any] # undocumented @@ -643,6 +681,7 @@ class Barrier: Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and are simultaneously awoken once they have all made that call. + """ @property @@ -664,6 +703,7 @@ class Barrier: the threads after they have all entered the barrier and just prior to releasing them all. If a 'timeout' is provided, it is used as the default for all subsequent 'wait()' calls. + """ def wait(self, timeout: float | None = None) -> int: @@ -673,6 +713,7 @@ class Barrier: simultaneously awoken. If an 'action' was provided for the barrier, one of the threads will have executed that callback prior to returning. Returns an individual index number from 0 to 'parties-1'. + """ def reset(self) -> None: @@ -680,6 +721,7 @@ class Barrier: Any threads currently waiting will get the BrokenBarrier exception raised. + """ def abort(self) -> None: @@ -687,6 +729,7 @@ class Barrier: Useful in case of error. Any currently waiting threads and threads attempting to 'wait()' will have BrokenBarrierError raised. + """ class BrokenBarrierError(RuntimeError): ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/__init__.pyi index 56a3475195..d7e6a912ad 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/__init__.pyi @@ -4071,6 +4071,7 @@ class Label(Widget): WIDGET-SPECIFIC OPTIONS height, state, width + """ @overload @@ -5255,6 +5256,7 @@ class Text(Widget, XView, YView): autoseparators, height, maxundo, spacing1, spacing2, spacing3, state, tabs, undo, width, wrap, + """ @overload @@ -5567,6 +5569,7 @@ class Text(Widget, XView, YView): edit_modified, edit_redo, edit_reset, edit_separator and edit_undo + """ @overload @@ -6847,6 +6850,7 @@ class PanedWindow(Widget): width may later be adjusted by the movement of sashes in the panedwindow. Size may be any value accepted by Tk_GetPixels. + """ paneconfig: Incomplete def panes(self): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/filedialog.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/filedialog.pyi index 580adf3f0d..af3c7c38aa 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/filedialog.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/filedialog.pyi @@ -54,6 +54,7 @@ class FileDialog: the dialog keeps no memory of previous state. Note that memory is kept even when the dialog is canceled. (All this emulates the behavior of the Macintosh file selection dialogs.) + """ title: str diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/font.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/font.pyi index b963749045..dd9deae85d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/font.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tkinter/font.pyi @@ -56,6 +56,7 @@ class Font: slant -- font slant: ROMAN, ITALIC underline -- font underlining: false (0), true (1) overstrike -- font strikeout: false (0), true (1) + """ name: str diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tokenize.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tokenize.pyi index 74cd6e22f4..c049515d85 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tokenize.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tokenize.pyi @@ -185,7 +185,8 @@ def untokenize(iterable: Iterable[_Token]) -> str | Any: """ def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Sequence[bytes]]: - """The detect_encoding() function is used to detect the encoding that should + """ + The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. @@ -202,7 +203,8 @@ def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Seq """ def tokenize(readline: Callable[[], bytes | bytearray]) -> Generator[TokenInfo, None, None]: - """The tokenize() generator requires one argument, readline, which + """ + The tokenize() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternatively, readline diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/trace.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/trace.pyi index a564877580..f2362a65d3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/trace.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/trace.pyi @@ -58,7 +58,8 @@ class CoverageResults: *, ignore_missing_files: bool = False, ) -> None: - """Write the coverage results. + """ + Write the coverage results. :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. @@ -71,7 +72,8 @@ class CoverageResults: """ else: def write_results(self, show_missing: bool = True, summary: bool = False, coverdir: StrPath | None = None) -> None: - """Write the coverage results. + """ + Write the coverage results. :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. @@ -117,7 +119,8 @@ class Trace: outfile: StrPath | None = None, timing: bool = False, ) -> None: - """@param count true iff it should count number of times each + """ + @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/traceback.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/traceback.pyi index 3cd22ef69d..2ae3020325 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/traceback.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/traceback.pyi @@ -141,7 +141,8 @@ def print_stack(f: FrameType | None = None, limit: int | None = None, file: Supp """ def extract_tb(tb: TracebackType | None, limit: int | None = None) -> StackSummary: - """Return a StackSummary object representing a list of + """ + Return a StackSummary object representing a list of pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If @@ -234,6 +235,7 @@ else: The message indicating which exception occurred is always the last string in the list. + """ def format_exc(limit: int | None = None, chain: bool = True) -> str: @@ -598,7 +600,8 @@ class StackSummary(list[FrameSummary]): @classmethod def from_list(cls, a_list: Iterable[FrameSummary | _FrameSummaryTuple]) -> StackSummary: - """Create a StackSummary object from a supplied list of + """ + Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples. """ if sys.version_info >= (3, 11): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/tracemalloc.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/tracemalloc.pyi index 3f1ff3cf57..dd47525911 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/tracemalloc.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/tracemalloc.pyi @@ -5,7 +5,8 @@ from typing import Any, SupportsIndex, overload from typing_extensions import TypeAlias def get_object_traceback(obj: object) -> Traceback | None: - """Get the traceback where the Python object *obj* was allocated. + """ + Get the traceback where the Python object *obj* was allocated. Return a Traceback instance. Return None if the tracemalloc module is not tracing memory allocations or @@ -13,7 +14,9 @@ def get_object_traceback(obj: object) -> Traceback | None: """ def take_snapshot() -> Snapshot: - """Take a snapshot of traces of memory blocks allocated by Python.""" + """ + Take a snapshot of traces of memory blocks allocated by Python. + """ class BaseFilter: inclusive: bool @@ -40,7 +43,9 @@ class Filter(BaseFilter): ) -> None: ... class Statistic: - """Statistic difference on memory allocations between two Snapshot instance.""" + """ + Statistic difference on memory allocations between two Snapshot instance. + """ count: int size: int @@ -50,7 +55,8 @@ class Statistic: def __hash__(self) -> int: ... class StatisticDiff: - """Statistic difference on memory allocations between an old and a new + """ + Statistic difference on memory allocations between an old and a new Snapshot instance. """ @@ -66,7 +72,9 @@ class StatisticDiff: _FrameTuple: TypeAlias = tuple[str, int] class Frame: - """Frame of a traceback.""" + """ + Frame of a traceback. + """ @property def filename(self) -> str: ... @@ -98,7 +106,9 @@ class Frame: _TraceTuple: TypeAlias = tuple[int, int, Sequence[_FrameTuple], int | None] | tuple[int, int, Sequence[_FrameTuple]] class Trace: - """Trace of a memory block.""" + """ + Trace of a memory block. + """ @property def domain(self) -> int: ... @@ -111,7 +121,8 @@ class Trace: def __hash__(self) -> int: ... class Traceback(Sequence[Frame]): - """Sequence of Frame instances sorted from the oldest frame + """ + Sequence of Frame instances sorted from the oldest frame to the most recent frame. """ @@ -148,30 +159,39 @@ class Traceback(Sequence[Frame]): """Return a <= b. Computed by @total_ordering from (a < b) or (a == b).""" class Snapshot: - """Snapshot of traces of memory blocks allocated by Python.""" + """ + Snapshot of traces of memory blocks allocated by Python. + """ def __init__(self, traces: Sequence[_TraceTuple], traceback_limit: int) -> None: ... def compare_to(self, old_snapshot: Snapshot, key_type: str, cumulative: bool = False) -> list[StatisticDiff]: - """Compute the differences with an old snapshot old_snapshot. Get + """ + Compute the differences with an old snapshot old_snapshot. Get statistics as a sorted list of StatisticDiff instances, grouped by group_by. """ def dump(self, filename: str) -> None: - """Write the snapshot into a file.""" + """ + Write the snapshot into a file. + """ def filter_traces(self, filters: Sequence[DomainFilter | Filter]) -> Snapshot: - """Create a new Snapshot instance with a filtered traces sequence, filters + """ + Create a new Snapshot instance with a filtered traces sequence, filters is a list of Filter or DomainFilter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. """ @staticmethod def load(filename: str) -> Snapshot: - """Load a snapshot from a file.""" + """ + Load a snapshot from a file. + """ def statistics(self, key_type: str, cumulative: bool = False) -> list[Statistic]: - """Group statistics by key_type. Return a sorted list of Statistic + """ + Group statistics by key_type. Return a sorted list of Statistic instances. """ traceback_limit: int diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/turtle.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/turtle.pyi index c3d972d665..24f098d7ba 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/turtle.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/turtle.pyi @@ -311,6 +311,7 @@ class TurtleScreenBase: Example (for a TurtleScreen instance named screen): >>> screen.mainloop() + """ def textinput(self, title: str, prompt: str) -> str | None: @@ -324,6 +325,7 @@ class TurtleScreenBase: Example (for a TurtleScreen instance named screen): >>> screen.textinput("NIM", "Name of first player:") + """ def numinput( @@ -344,6 +346,7 @@ class TurtleScreenBase: Example (for a TurtleScreen instance named screen): >>> screen.numinput("Poker", "Your stakes:", 1000, minval=10, maxval=10000) + """ class Terminator(Exception): @@ -479,6 +482,7 @@ class TurtleScreen(TurtleScreenBase): Example (for a TurtleScreen instance named screen): >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3))) + """ @overload @@ -666,6 +670,7 @@ class TurtleScreen(TurtleScreenBase): Subsequently the turtle can be moved by repeatedly pressing the up-arrow key, consequently drawing a hexagon + """ def listen(self, xdummy: float | None = None, ydummy: float | None = None) -> None: @@ -822,6 +827,7 @@ class TNavigator: >>> turtle.degrees(400.0) >>> turtle.heading() 100 + """ def radians(self) -> None: @@ -1716,6 +1722,7 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods >>> turtle.shapetransform(4, -1, 0, 2) >>> turtle.get_shapepoly() ((50, -20), (30, 20), (-50, 20), (-30, -20)) + """ if sys.version_info < (3, 13): def settiltangle(self, angle: float) -> None: @@ -2160,6 +2167,7 @@ class _Screen(TurtleScreen): Example (for a Screen instance named screen): >>> screen.exitonclick() + """ class Turtle(RawTurtle): @@ -2187,19 +2195,8 @@ def write_docstringdict(filename: str = "turtle_docstringdict") -> None: into different languages. """ -# Note: it's somewhat unfortunate that we have to copy the function signatures. -# It would be nice if we could partially reduce the redundancy by doing something -# like the following: -# -# _screen: Screen -# clear = _screen.clear -# -# However, it seems pytype does not support this type of syntax in pyi files. - # Functions copied from TurtleScreenBase: -# Note: mainloop() was always present in the global scope, but was added to -# TurtleScreenBase in Python 3.0 def mainloop() -> None: """Starts event loop - calling Tkinter's mainloop function. @@ -2211,6 +2208,7 @@ def mainloop() -> None: Example: >>> mainloop() + """ def textinput(title: str, prompt: str) -> str | None: @@ -2224,6 +2222,7 @@ def textinput(title: str, prompt: str) -> str | None: Example: >>> textinput("NIM", "Name of first player:") + """ def numinput( @@ -2244,6 +2243,7 @@ def numinput( Example: >>> numinput("Poker", "Your stakes:", 1000, minval=10, maxval=10000) + """ # Functions copied from TurtleScreen: @@ -2335,6 +2335,7 @@ def register_shape(name: str, shape: _PolygonCoords | Shape | None = None) -> No Example: >>> register_shape("triangle", ((5,-3),(0,5),(-5,-3))) + """ @overload @@ -2537,6 +2538,7 @@ def onkey(fun: Callable[[], object], key: str) -> None: Subsequently the turtle can be moved by repeatedly pressing the up-arrow key, consequently drawing a hexagon + """ def listen(xdummy: float | None = None, ydummy: float | None = None) -> None: @@ -2726,6 +2728,7 @@ def exitonclick() -> None: Example: >>> exitonclick() + """ def Screen() -> _Screen: @@ -2756,6 +2759,7 @@ def degrees(fullcircle: float = 360.0) -> None: >>> degrees(400.0) >>> heading() 100 + """ def radians() -> None: @@ -3611,6 +3615,7 @@ def get_shapepoly() -> _PolygonCoords | None: >>> shapetransform(4, -1, 0, 2) >>> get_shapepoly() ((50, -20), (30, 20), (-50, 20), (-30, -20)) + """ if sys.version_info < (3, 13): diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/types.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/types.pyi index a1c1707f3b..d946703ee0 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/types.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/types.pyi @@ -848,6 +848,7 @@ class DynamicClassAttribute(property): Subclass from this to use a different method of accessing virtual attributes and still be treated properly by the inspect module. (Enum uses this since Python 3.10 .) + """ fget: Callable[[Any], Any] | None diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/typing.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/typing.pyi index f3ccd276ed..f62f5a72b7 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/typing.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/typing.pyi @@ -1845,6 +1845,7 @@ if sys.version_info >= (3, 14): does not already have an owner set. *format* specifies the format of the annotation and is a member of the annotationlib.Format enum, defaulting to VALUE. + """ else: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/typing_extensions.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/typing_extensions.pyi index e6c905027f..862f678795 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/typing_extensions.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/typing_extensions.pyi @@ -59,6 +59,7 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035 TypeVar as _TypeVar, Union as Union, _Alias, + _SpecialForm, cast as cast, no_type_check as no_type_check, no_type_check_decorator as no_type_check_decorator, @@ -204,15 +205,6 @@ _TC = _TypeVar("_TC", bound=type[object]) _T_co = _TypeVar("_T_co", covariant=True) # Any type covariant containers. _T_contra = _TypeVar("_T_contra", contravariant=True) -class _Final: ... # This should be imported from typing but that breaks pytype - -# unfortunately we have to duplicate this class definition from typing.pyi or we break pytype -class _SpecialForm(_Final): - def __getitem__(self, parameters: Any) -> object: ... - if sys.version_info >= (3, 10): - def __or__(self, other: Any) -> _SpecialForm: ... - def __ror__(self, other: Any) -> _SpecialForm: ... - # Do not import (and re-export) Protocol or runtime_checkable from # typing module because type checkers need to be able to distinguish # typing.Protocol and typing_extensions.Protocol so they can properly @@ -517,6 +509,7 @@ else: At runtime, the function prints the runtime type of the argument and returns it unchanged. + """ def assert_never(arg: Never, /) -> Never: @@ -537,6 +530,7 @@ else: reachable, it will emit an error. At runtime, this throws an exception when called. + """ def assert_type(val: _T, typ: AnnotationForm, /) -> _T: @@ -631,6 +625,7 @@ else: ``__dataclass_transform__`` attribute on the decorated object. See PEP 681 for details. + """ class NamedTuple(tuple[Any, ...]): @@ -725,6 +720,7 @@ else: to allow runtime introspection. See PEP 698 for details. + """ def get_original_bases(cls: type, /) -> tuple[Any, ...]: @@ -769,6 +765,7 @@ else: or use ABC registration. This ABC provides no methods, because there is no Python-accessible methods shared by pre-3.12 buffer classes. It is useful primarily for static checks. + """ # Not actually a Protocol at runtime; see @@ -810,14 +807,18 @@ else: @runtime_checkable class SupportsAbs(Protocol[_T_co]): - """An ABC with one abstract method __abs__ that is covariant in its return type.""" + """ + An ABC with one abstract method __abs__ that is covariant in its return type. + """ @abc.abstractmethod def __abs__(self) -> _T_co: ... @runtime_checkable class SupportsRound(Protocol[_T_co]): - """An ABC with one abstract method __round__ that is covariant in its return type.""" + """ + An ABC with one abstract method __round__ that is covariant in its return type. + """ @overload @abc.abstractmethod @@ -955,6 +956,7 @@ else: exist on the overload as returned by ``get_overloads()``. See PEP 702 for details. + """ message: LiteralString @@ -1086,6 +1088,7 @@ else: - The TypeAliasType instance must be immediately assigned to a variable of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid, as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)'). + """ def __init__( @@ -1210,6 +1213,7 @@ else: want to support earlier Python versions, to simply write: typing_extensions.get_annotations(obj, format=Format.FORWARDREF) + """ @overload @@ -1261,6 +1265,7 @@ else: it may be an empty tuple) if *owner* is not given and the forward reference does not already have an owner set. *format* specifies the format of the annotation and is a member of the annotationlib.Format enum. + """ @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/unittest/case.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/unittest/case.pyi index 208a3222a5..5cc1f2cf18 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/unittest/case.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/unittest/case.pyi @@ -4,18 +4,16 @@ import logging import sys import unittest.result from _typeshed import SupportsDunderGE, SupportsDunderGT, SupportsDunderLE, SupportsDunderLT, SupportsRSub, SupportsSub +from builtins import _ClassInfo from collections.abc import Callable, Container, Iterable, Mapping, Sequence, Set as AbstractSet from contextlib import AbstractContextManager from re import Pattern from types import GenericAlias, TracebackType from typing import Any, AnyStr, Final, Generic, NoReturn, Protocol, SupportsAbs, SupportsRound, TypeVar, overload -from typing_extensions import Never, ParamSpec, Self, TypeAlias +from typing_extensions import Never, ParamSpec, Self from unittest._log import _AssertLogsContext, _LoggingWatcher from warnings import WarningMessage -if sys.version_info >= (3, 10): - from types import UnionType - _T = TypeVar("_T") _S = TypeVar("_S", bound=SupportsSub[Any, Any]) _E = TypeVar("_E", bound=BaseException) @@ -45,7 +43,8 @@ class _AssertRaisesBaseContext(_BaseTestCaseContext): # This returns Self if args is the empty list, and None otherwise. # but it's not possible to construct an overload which expresses that def handle(self, name: str, args: list[Any], kwargs: dict[str, Any]) -> Any: - """If args is empty, assertRaises/Warns is being used as a + """ + If args is empty, assertRaises/Warns is being used as a context manager, so check for a 'msg' kwarg and return self. If args is not empty, call a callable passing positional and keyword arguments. @@ -67,16 +66,23 @@ if sys.version_info >= (3, 11): def expectedFailure(test_item: _FT) -> _FT: ... def skip(reason: str) -> Callable[[_FT], _FT]: - """Unconditionally skip a test.""" + """ + Unconditionally skip a test. + """ def skipIf(condition: object, reason: str) -> Callable[[_FT], _FT]: - """Skip a test if the condition is true.""" + """ + Skip a test if the condition is true. + """ def skipUnless(condition: object, reason: str) -> Callable[[_FT], _FT]: - """Skip a test unless the condition is true.""" + """ + Skip a test unless the condition is true. + """ class SkipTest(Exception): - """Raise this exception in a test to skip it. + """ + Raise this exception in a test to skip it. Usually you can use TestCase.skipTest() or one of the skipping decorators instead of raising this directly. @@ -86,14 +92,6 @@ class SkipTest(Exception): class _SupportsAbsAndDunderGE(SupportsDunderGE[Any], SupportsAbs[Any], Protocol): ... -# Keep this alias in sync with builtins._ClassInfo -# We can't import it from builtins or pytype crashes, -# due to the fact that pytype uses a custom builtins stub rather than typeshed's builtins stub -if sys.version_info >= (3, 10): - _ClassInfo: TypeAlias = type | UnionType | tuple[_ClassInfo, ...] -else: - _ClassInfo: TypeAlias = type | tuple[_ClassInfo, ...] - class TestCase: """A class whose instances are single test cases. @@ -494,6 +492,7 @@ class TestCase: Example: - [0, 1, 1] and [1, 0, 1] compare equal. - [0, 0, 1] and [0, 1] compare unequal. + """ def addTypeEqualityFunc(self, typeobj: type[Any], function: Callable[..., None]) -> None: @@ -538,6 +537,7 @@ class TestCase: list2: The second list to compare. msg: Optional message to use on failure instead of a list of differences. + """ def assertTupleEqual(self, tuple1: tuple[Any, ...], tuple2: tuple[Any, ...], msg: Any = None) -> None: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/unittest/loader.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/unittest/loader.pyi index 670d206e8a..5c01b4981d 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/unittest/loader.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/unittest/loader.pyi @@ -15,7 +15,8 @@ _SuiteClass: TypeAlias = Callable[[list[unittest.case.TestCase]], unittest.suite VALID_MODULE_NAME: Final[Pattern[str]] class TestLoader: - """This class is responsible for loading tests according to various criteria + """ + This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/unittest/mock.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/unittest/mock.pyi index 1e3b07cada..be34f90126 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/unittest/mock.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/unittest/mock.pyi @@ -73,7 +73,8 @@ _NameArgsKwargs: TypeAlias = tuple[str, tuple[Any, ...], Mapping[str, Any]] _CallValue: TypeAlias = str | tuple[Any, ...] | Mapping[str, Any] | _ArgsKwargs | _NameArgsKwargs class _Call(tuple[Any, ...]): - """A tuple for holding the results of a call to a mock, either in the form + """ + A tuple for holding the results of a call to a mock, either in the form `(args, kwargs)` or `(name, args, kwargs)`. If args or kwargs are empty then a call tuple will compare equal to @@ -198,7 +199,8 @@ class NonCallableMock(Base, Any): def _extract_mock_name(self) -> str: ... def _get_call_signature_from_name(self, name: str) -> Any: - """* If call objects are asserted against a method/function like obj.meth1 + """ + * If call objects are asserted against a method/function like obj.meth1 then there could be no name for the call object to lookup. Hence just return the spec_signature of the method/function being asserted against. * If the name is not empty then remove () and split by '.' to get @@ -238,7 +240,8 @@ class NonCallableMock(Base, Any): def _mock_add_spec(self, spec: Any, spec_set: bool, _spec_as_instance: bool = False, _eat_self: bool = False) -> None: ... def attach_mock(self, mock: NonCallableMock, attribute: str) -> None: - """Attach a mock as an attribute of this one, replacing its name and + """ + Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the `method_calls` and `mock_calls` attributes of this one. """ @@ -262,7 +265,8 @@ class NonCallableMock(Base, Any): mock_calls: _CallList def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ... def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call: - """Given a call (or simply an (args, kwargs) tuple), return a + """ + Given a call (or simply an (args, kwargs) tuple), return a comparison key suitable for matching with other calls. This is a best effort method which relies on the spec's signature, if available, or falls back on the arguments themselves. @@ -317,7 +321,8 @@ class CallableMixin(Base): def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class Mock(CallableMixin, NonCallableMock): - """Create a new `Mock` object. `Mock` takes several optional arguments + """ + Create a new `Mock` object. `Mock` takes several optional arguments that specify the behaviour of the Mock object: * `spec`: This can be either a list of strings or an existing object (a @@ -460,7 +465,8 @@ class _patch_pass_arg(_patch[_T]): def __call__(self, func: Callable[..., _R]) -> Callable[..., _R]: ... class _patch_dict: - """Patch a dictionary, or dictionary like object, and restore the dictionary + """ + Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test, where the restored dictionary is a copy of the dictionary as it was before the test. @@ -611,7 +617,8 @@ class NonCallableMagicMock(MagicMixin, NonCallableMock): """A version of `MagicMock` that isn't callable.""" class MagicMock(MagicMixin, Mock): - """MagicMock is a subclass of Mock with default implementations + """ + MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself. @@ -625,24 +632,34 @@ class AsyncMockMixin(Base): def __init__(self, *args: Any, **kwargs: Any) -> None: ... async def _execute_mock_call(self, *args: Any, **kwargs: Any) -> Any: ... def assert_awaited(self) -> None: - """Assert that the mock was awaited at least once.""" + """ + Assert that the mock was awaited at least once. + """ def assert_awaited_once(self) -> None: - """Assert that the mock was awaited exactly once.""" + """ + Assert that the mock was awaited exactly once. + """ def assert_awaited_with(self, *args: Any, **kwargs: Any) -> None: - """Assert that the last await was with the specified arguments.""" + """ + Assert that the last await was with the specified arguments. + """ def assert_awaited_once_with(self, *args: Any, **kwargs: Any) -> None: - """Assert that the mock was awaited exactly once and with the specified + """ + Assert that the mock was awaited exactly once and with the specified arguments. """ def assert_any_await(self, *args: Any, **kwargs: Any) -> None: - """Assert the mock has ever been awaited with the specified arguments.""" + """ + Assert the mock has ever been awaited with the specified arguments. + """ def assert_has_awaits(self, calls: Iterable[_Call], any_order: bool = False) -> None: - """Assert the mock has been awaited with the specified calls. + """ + Assert the mock has been awaited with the specified calls. The :attr:`await_args_list` list is checked for the awaits. If `any_order` is False (the default) then the awaits must be @@ -654,10 +671,14 @@ class AsyncMockMixin(Base): """ def assert_not_awaited(self) -> None: - """Assert that the mock was never awaited.""" + """ + Assert that the mock was never awaited. + """ def reset_mock(self, *args: Any, **kwargs: Any) -> None: - """See :func:`.Mock.reset_mock()`""" + """ + See :func:`.Mock.reset_mock()` + """ await_count: int await_args: _Call | None await_args_list: _CallList @@ -666,7 +687,8 @@ class AsyncMagicMixin(MagicMixin): def __init__(self, *args: Any, **kw: Any) -> None: ... class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): - """Enhance :class:`Mock` with features allowing to mock + """ + Enhance :class:`Mock` with features allowing to mock an async function. The :class:`AsyncMock` object will behave so the object is @@ -710,7 +732,9 @@ class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): # It is defined on `AsyncMockMixin` with `*args, **kwargs`, which is not ideal. # But, `NonCallableMock` super-class has the better version. def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: - """See :func:`.Mock.reset_mock()`""" + """ + See :func:`.Mock.reset_mock()` + """ class MagicProxy(Base): name: str @@ -808,7 +832,8 @@ class _SpecState: ) -> None: ... def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: - """A helper function to create a mock to replace the use of `open`. It works + """ + A helper function to create a mock to replace the use of `open`. It works for `open` called directly or used as a context manager. The `mock` argument is the mock object to configure. If `None` (the @@ -820,7 +845,8 @@ def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: """ class PropertyMock(Mock): - """A mock intended to be used as a property, or other descriptor, on a class. + """ + A mock intended to be used as a property, or other descriptor, on a class. `PropertyMock` provides `__get__` and `__set__` methods so you can specify a return value when it is fetched. @@ -838,7 +864,9 @@ if sys.version_info >= (3, 13): def __init__(self, /, *args: Any, timeout: float | None | _SentinelObject = ..., **kwargs: Any) -> None: ... # Same as `NonCallableMock.reset_mock.` def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: - """See :func:`.Mock.reset_mock()`""" + """ + See :func:`.Mock.reset_mock()` + """ def wait_until_called(self, *, timeout: float | None | _SentinelObject = ...) -> None: """Wait until the mock object is called. @@ -855,7 +883,8 @@ if sys.version_info >= (3, 13): """ class ThreadingMock(ThreadingMixin, MagicMixin, Mock): - """A mock that can be used to wait until on calls happening + """ + A mock that can be used to wait until on calls happening in a different thread. The constructor can take a `timeout` argument which diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/urllib/parse.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/urllib/parse.pyi index db26e5d9b5..c5c2004083 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/urllib/parse.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/urllib/parse.pyi @@ -102,7 +102,8 @@ class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ... class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ... class _DefragResultBase(NamedTuple, Generic[AnyStr]): - """DefragResult(url, fragment) + """ + DefragResult(url, fragment) A 2-tuple that contains the url without fragment identifier and the fragment identifier as a separate argument. @@ -112,7 +113,8 @@ class _DefragResultBase(NamedTuple, Generic[AnyStr]): fragment: AnyStr class _SplitResultBase(NamedTuple, Generic[AnyStr]): - """SplitResult(scheme, netloc, path, query, fragment) + """ + SplitResult(scheme, netloc, path, query, fragment) A 5-tuple that contains the different components of a URL. Similar to ParseResult, but does not split params. @@ -125,7 +127,8 @@ class _SplitResultBase(NamedTuple, Generic[AnyStr]): fragment: AnyStr class _ParseResultBase(NamedTuple, Generic[AnyStr]): - """ParseResult(scheme, netloc, path, params, query, fragment) + """ + ParseResult(scheme, netloc, path, params, query, fragment) A 6-tuple that contains components of a parsed URL. """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/urllib/request.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/urllib/request.pyi index 4d5556867b..71e3273b5b 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/urllib/request.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/urllib/request.pyi @@ -163,6 +163,7 @@ if sys.version_info >= (3, 13): In addition, if proxy settings are detected (for example, when a *_proxy environment variable like http_proxy is set), ProxyHandler is default installed and makes sure the requests are handled through the proxy. + """ else: @@ -223,6 +224,7 @@ else: In addition, if proxy settings are detected (for example, when a *_proxy environment variable like http_proxy is set), ProxyHandler is default installed and makes sure the requests are handled through the proxy. + """ def install_opener(opener: OpenerDirector) -> None: ... @@ -301,6 +303,7 @@ if sys.platform == "win32" or sys.platform == "darwin": Checks proxy settings gathered from the environment, if specified, or the registry. + """ else: @@ -309,6 +312,7 @@ else: Checks the proxy dict for the value of no_proxy, which should be a list of comma separated DNS suffixes, or '*' for all hosts. + """ class Request: @@ -570,7 +574,8 @@ def urlretrieve( reporthook: Callable[[int, int, int], object] | None = None, data: _DataType = None, ) -> tuple[str, HTTPMessage]: - """Retrieve a URL into a temporary location on disk. + """ + Retrieve a URL into a temporary location on disk. Requires a URL argument. If a filename is passed, it is used as the temporary file location. The reporthook argument should be diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/urllib/robotparser.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/urllib/robotparser.pyi index 406969f82d..111de19789 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/urllib/robotparser.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/urllib/robotparser.pyi @@ -24,6 +24,7 @@ class RequestRate(NamedTuple): class RobotFileParser: """This class provides a set of methods to read, parse and answer questions about a single robots.txt file. + """ def __init__(self, url: str = "") -> None: ... @@ -48,11 +49,13 @@ class RobotFileParser: This is useful for long-running web spiders that need to check for new robots.txt files periodically. + """ def modified(self) -> None: """Sets the time the robots.txt file was last fetched to the current time. + """ def crawl_delay(self, useragent: str) -> str | None: ... diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/venv/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/venv/__init__.pyi index cf8063bf73..f5645f3fdc 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/venv/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/venv/__init__.pyi @@ -15,7 +15,8 @@ logger: logging.Logger CORE_VENV_DEPS: tuple[str, ...] class EnvBuilder: - """This class exists to allow virtual environment creation to be + """ +This class exists to allow virtual environment creation to be customized. The constructor parameters determine the builder's behaviour when called upon to create a virtual environment. @@ -73,19 +74,23 @@ other way, the default is to *not* use symlinks. ) -> None: ... def create(self, env_dir: StrOrBytesPath) -> None: - """Create a virtual environment in a directory. + """ +Create a virtual environment in a directory. :param env_dir: The target directory to create an environment in. + """ def clear_directory(self, path: StrOrBytesPath) -> None: ... # undocumented def ensure_directories(self, env_dir: StrOrBytesPath) -> SimpleNamespace: - """Create the directories for the environment. + """ +Create the directories for the environment. Returns a context object which holds paths in the environment, for use by subsequent logic. """ def create_configuration(self, context: SimpleNamespace) -> None: - """Create a configuration file indicating where the environment's Python + """ +Create a configuration file indicating where the environment's Python was copied from, and whether the system site-packages should be made available in the environment. @@ -95,12 +100,14 @@ available in the environment. def symlink_or_copy( self, src: StrOrBytesPath, dst: StrOrBytesPath, relative_symlinks_ok: bool = False ) -> None: # undocumented - """Try symlinking a file, and if that fails, fall back to copying. + """ +Try symlinking a file, and if that fails, fall back to copying. (Unused on Windows, because we can't just copy a failed symlink file: we switch to a different set of files instead.) """ def setup_python(self, context: SimpleNamespace) -> None: - """Set up a Python executable in the environment. + """ +Set up a Python executable in the environment. :param context: The information for the environment creation request being processed. @@ -109,7 +116,8 @@ switch to a different set of files instead.) """Installs or upgrades pip in a virtual environment """ def setup_scripts(self, context: SimpleNamespace) -> None: - """Set up scripts into the created environment from a directory. + """ +Set up scripts into the created environment from a directory. This method installs the default scripts into the environment being created. You can prevent the default installation by overriding @@ -119,14 +127,16 @@ a different location for the scripts to install. By default, the scripts to install. """ def post_setup(self, context: SimpleNamespace) -> None: - """Hook for post-setup modification of the venv. Subclasses may install + """ +Hook for post-setup modification of the venv. Subclasses may install additional packages or scripts here, add activation shell scripts, etc. :param context: The information for the environment creation request being processed. """ def replace_variables(self, text: str, context: SimpleNamespace) -> str: # undocumented - """Replace variable placeholders in script text with context-specific + """ +Replace variable placeholders in script text with context-specific variables. Return the text passed in , but with variables replaced. @@ -136,7 +146,8 @@ Return the text passed in , but with variables replaced. being processed. """ def install_scripts(self, context: SimpleNamespace, path: str) -> None: - """Install scripts into the created environment from a directory. + """ +Install scripts into the created environment from a directory. :param context: The information for the environment creation request being processed. @@ -150,7 +161,8 @@ Return the text passed in , but with variables replaced. def upgrade_dependencies(self, context: SimpleNamespace) -> None: ... if sys.version_info >= (3, 13): def create_git_ignore_file(self, context: SimpleNamespace) -> None: - """Create a .gitignore file in the environment directory. + """ +Create a .gitignore file in the environment directory. The contents of the file cause the entire environment directory to be ignored by git. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/warnings.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/warnings.pyi index 3a91bedd41..0a4a3af992 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/warnings.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/warnings.pyi @@ -127,6 +127,7 @@ class catch_warnings(Generic[_W_co]): ) -> None: """Specify whether to record warnings and if an alternative module should be used other than sys.modules['warnings']. + """ @overload @@ -159,6 +160,7 @@ class catch_warnings(Generic[_W_co]): For compatibility with Python 3.0, please consider all arguments to be keyword-only. + """ @overload @@ -214,6 +216,7 @@ if sys.version_info >= (3, 13): exist on the overload as returned by ``get_overloads()``. See PEP 702 for details. + """ message: LiteralString diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/weakref.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/weakref.pyi index 162d6aecbf..e7487c089f 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/weakref.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/weakref.pyi @@ -75,7 +75,8 @@ ref = ReferenceType # everything below here is implemented in weakref.py class WeakMethod(ref[_CallableT]): - """A custom `weakref.ref` subclass which simulates a weak reference to + """ + A custom `weakref.ref` subclass which simulates a weak reference to a bound method, working around the lifetime problem of bound methods. """ @@ -134,6 +135,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the values around longer than needed. + """ def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: @@ -144,6 +146,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the values around longer than needed. + """ def setdefault(self, key: _KT, default: _VT) -> _VT: ... @@ -174,6 +177,7 @@ class KeyedRef(ref[_T], Generic[_KT, _T]): a function object for each key stored in the mapping. A shared callback object can use the 'key' attribute of a KeyedRef instead of getting a reference to the key from an enclosing scope. + """ key: _KT @@ -222,6 +226,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than needed. + """ # Keep WeakKeyDictionary.setdefault in line with MutableMapping.setdefault, modulo positional-only differences @overload diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/wsgiref/validate.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/wsgiref/validate.pyi index 260758b47a..b537918d43 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/wsgiref/validate.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/wsgiref/validate.pyi @@ -113,10 +113,13 @@ from typing_extensions import TypeAlias __all__ = ["validator"] class WSGIWarning(Warning): - """Raised in response to WSGI-spec-related warnings""" + """ + Raised in response to WSGI-spec-related warnings + """ def validator(application: WSGIApplication) -> WSGIApplication: - """When applied between a WSGI server and a WSGI application, this + """ + When applied between a WSGI server and a WSGI application, this middleware will check for WSGI compliance on a number of levels. This middleware does not modify the request or response in any way, but will raise an AssertionError if anything seems off diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/xdrlib.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/xdrlib.pyi index b9029e0170..bf5ccda81c 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/xdrlib.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/xdrlib.pyi @@ -19,6 +19,7 @@ class Error(Exception): Public ivars: msg -- contains the message + """ msg: str diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/NodeFilter.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/NodeFilter.pyi index 5634d118a3..b1c7d2059a 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/NodeFilter.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/NodeFilter.pyi @@ -2,7 +2,9 @@ from typing import Literal from xml.dom.minidom import Node class NodeFilter: - """This is the DOM2 NodeFilter interface. It contains only constants.""" + """ + This is the DOM2 NodeFilter interface. It contains only constants. + """ FILTER_ACCEPT: Literal[1] FILTER_REJECT: Literal[2] diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/minidom.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/minidom.pyi index 05de51bf38..0db4877863 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/minidom.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/xml/dom/minidom.pyi @@ -676,6 +676,7 @@ class ElementInfo: This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. + """ tagName: str diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/xml/etree/ElementTree.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/xml/etree/ElementTree.pyi index da6015c6ff..68576c31a3 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/xml/etree/ElementTree.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/xml/etree/ElementTree.pyi @@ -203,6 +203,7 @@ def Comment(text: str | None = None) -> _CallableElement: serializes as an XML comment. *text* is a string containing the comment string. + """ def ProcessingInstruction(target: str, text: str | None = None) -> _CallableElement: @@ -213,6 +214,7 @@ def ProcessingInstruction(target: str, text: str | None = None) -> _CallableElem *target* is a string containing the processing instruction, *text* is a string containing the processing instruction contents, if any. + """ PI = ProcessingInstruction @@ -229,6 +231,7 @@ class QName: *tag* is an optional argument which if given, will make the first argument (text_or_uri) be interpreted as a URI, and this argument (tag) be interpreted as a local name. + """ text: str @@ -251,6 +254,7 @@ class ElementTree(Generic[_Root]): *element* is an optional root element node, *file* is an optional file handle or file name of an XML file whose contents will be used to initialize the tree with. + """ def __init__(self, element: Element | None = None, file: _FileRead | None = None) -> None: ... @@ -266,6 +270,7 @@ class ElementTree(Generic[_Root]): ParseError is raised if the parser fails to parse the document. Returns the root element of the given source document. + """ def iter(self, tag: str | None = None) -> Generator[Element, None, None]: @@ -275,6 +280,7 @@ class ElementTree(Generic[_Root]): *tag* is a string with the tag name to iterate over (default is to return all elements). + """ def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: @@ -286,6 +292,7 @@ class ElementTree(Generic[_Root]): *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. + """ @overload @@ -298,6 +305,7 @@ class ElementTree(Generic[_Root]): *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. + """ @overload @@ -311,6 +319,7 @@ class ElementTree(Generic[_Root]): *namespaces* is an optional mapping from namespace prefix to full name. Return list containing all matching elements in document order. + """ @overload @@ -323,6 +332,7 @@ class ElementTree(Generic[_Root]): *namespaces* is an optional mapping from namespace prefix to full name. Return an iterable yielding all matching elements in document order. + """ @overload @@ -358,6 +368,7 @@ class ElementTree(Generic[_Root]): they are emitted as a single self-closed tag, otherwise they are emitted as a pair of start/end tags + """ def write_c14n(self, file: _FileWriteC14N) -> None: ... @@ -374,6 +385,7 @@ def register_namespace(prefix: str, uri: str) -> None: attributes in this namespace will be serialized with prefix if possible. ValueError is raised if prefix is reserved or is invalid. + """ @overload @@ -397,6 +409,7 @@ def tostring( sets the default XML namespace (for "xmlns"). Returns an (optionally) encoded string containing the XML data. + """ @overload @@ -457,6 +470,7 @@ def dump(elem: Element | ElementTree[Any]) -> None: *elem* is either an ElementTree, or a single Element. The exact output format is implementation dependent. In this version, it's written as an ordinary XML file. + """ def indent(tree: Element | ElementTree[Any], space: str = " ", level: int = 0) -> None: @@ -482,6 +496,7 @@ def parse(source: _FileRead, parser: XMLParser[Any] | None = None) -> ElementTre *parser* is an optional parser instance defaulting to XMLParser. Return an ElementTree instance. + """ # This class is defined inside the body of iterparse @@ -506,6 +521,7 @@ def iterparse(source: _FileRead, events: Sequence[str] | None = None, parser: XM a list of events to report back, *parser* is an optional parser instance. Returns an iterator providing (event, elem) pairs. + """ _EventQueue: TypeAlias = tuple[str] | tuple[str, tuple[str, str]] | tuple[str, None] @@ -540,6 +556,7 @@ def XML(text: str | ReadableBuffer, parser: XMLParser | None = None) -> Element: optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. + """ def XMLID(text: str | ReadableBuffer, parser: XMLParser | None = None) -> tuple[Element, dict[str, Element]]: @@ -550,6 +567,7 @@ def XMLID(text: str | ReadableBuffer, parser: XMLParser | None = None) -> tuple[ Returns an (Element, dict) tuple, in which the dict maps element id:s to elements. + """ # This is aliased to XML in the source. @@ -562,6 +580,7 @@ def fromstringlist(sequence: Sequence[str | ReadableBuffer], parser: XMLParser | instance, defaulting to the standard XMLParser. Returns an Element instance. + """ # This type is both not precise enough and too precise. The TreeBuilder @@ -600,7 +619,8 @@ class TreeBuilder: def pi(self, target: str, text: str | None = None, /) -> Element[Any]: ... class C14NWriterTarget: - """Canonicalization writer target for the XMLParser. + """ + Canonicalization writer target for the XMLParser. Serialises parse events to XML C14N 2.0. diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/xmlrpc/server.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/xmlrpc/server.pyi index d35128bcb6..0f9592e53a 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/xmlrpc/server.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/xmlrpc/server.pyi @@ -196,6 +196,7 @@ class SimpleXMLRPCDispatcher: # undocumented to access your module's global variables and may allow intruders to execute arbitrary code on your machine. Only use this option on a secure, closed network. + """ def register_function(self, function: _DispatchProtocol | None = None, name: str | None = None) -> Callable[..., Any]: diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/__init__.pyi index 5ec2e053b2..1e01e76c5a 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/__init__.pyi @@ -46,7 +46,8 @@ BadZipfile = BadZipFile error = BadZipfile class LargeZipFile(Exception): - """Raised when writing a zipfile, the zipfile requires ZIP64 extensions + """ + Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled. """ @@ -160,6 +161,7 @@ class ZipFile: When using ZIP_ZSTANDARD integers -7 though 22 are common, see the CompressionParameter enum in compression.zstd for details. + """ filename: str | None @@ -379,12 +381,6 @@ class ZipFile: if sys.version_info >= (3, 11): def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = 0o777) -> None: """Creates a directory inside the zip archive.""" - if sys.version_info >= (3, 14): - @property - def data_offset(self) -> int | None: - """The offset to the start of zip data in the file or None if - unavailable. - """ def __del__(self) -> None: """Call the "close()" method in case the user forgot.""" @@ -462,19 +458,22 @@ if sys.version_info >= (3, 12): else: class CompleteDirs(ZipFile): - """A ZipFile subclass that ensures that implied directories + """ + A ZipFile subclass that ensures that implied directories are always included in the namelist. """ def resolve_dir(self, name: str) -> str: - """If the name represents a directory, return that name + """ + If the name represents a directory, return that name as a directory (with the trailing slash). """ @overload @classmethod def make(cls, source: ZipFile) -> CompleteDirs: - """Given a source (filename or zipfile), return an + """ + Given a source (filename or zipfile), return an appropriate CompleteDirs subclass. """ @@ -483,7 +482,8 @@ else: def make(cls, source: StrPath | IO[bytes]) -> Self: ... class Path: - """A pathlib-compatible interface for zip files. + """ + A pathlib-compatible interface for zip files. Consider a zip file with this structure:: @@ -562,7 +562,8 @@ else: root: CompleteDirs at: str def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: - """Construct a Path from a ZipFile or filename. + """ + Construct a Path from a ZipFile or filename. Note: When the source is an existing ZipFile object, its type (__class__) will be mutated to a @@ -598,7 +599,8 @@ else: *, pwd: bytes | None = None, ) -> TextIOWrapper: - """Open this entry as text or binary following the semantics + """ + Open this entry as text or binary following the semantics of ``pathlib.Path.open()`` by passing arguments through to io.TextIOWrapper(). """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/__init__.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/__init__.pyi index fb82418ea5..4b6743b707 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/__init__.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/__init__.pyi @@ -22,14 +22,17 @@ if sys.version_info >= (3, 12): __all__ = ["Path"] class InitializedState: - """Mix-in to save the initialization state for pickling.""" + """ + Mix-in to save the initialization state for pickling. + """ def __init__(self, *args: object, **kwargs: object) -> None: ... def __getstate__(self) -> tuple[list[object], dict[object, object]]: ... def __setstate__(self, state: Sequence[tuple[list[object], dict[object, object]]]) -> None: ... class CompleteDirs(InitializedState, ZipFile): - """A ZipFile subclass that ensures that implied directories + """ + A ZipFile subclass that ensures that implied directories are always included in the namelist. >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt'])) @@ -39,14 +42,16 @@ if sys.version_info >= (3, 12): """ def resolve_dir(self, name: str) -> str: - """If the name represents a directory, return that name + """ + If the name represents a directory, return that name as a directory (with the trailing slash). """ @overload @classmethod def make(cls, source: ZipFile) -> CompleteDirs: - """Given a source (filename or zipfile), return an + """ + Given a source (filename or zipfile), return an appropriate CompleteDirs subclass. """ @@ -56,12 +61,14 @@ if sys.version_info >= (3, 12): if sys.version_info >= (3, 13): @classmethod def inject(cls, zf: _ZF) -> _ZF: - """Given a writable zip file zf, inject directory entries for + """ + Given a writable zip file zf, inject directory entries for any directories implied by the presence of children. """ class Path: - """A :class:`importlib.resources.abc.Traversable` interface for zip files. + """ + A :class:`importlib.resources.abc.Traversable` interface for zip files. Implements many of the features users enjoy from :class:`pathlib.Path`. @@ -165,7 +172,8 @@ if sys.version_info >= (3, 12): root: CompleteDirs at: str def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: - """Construct a Path from a ZipFile or filename. + """ + Construct a Path from a ZipFile or filename. Note: When the source is an existing ZipFile object, its type (__class__) will be mutated to a @@ -198,7 +206,8 @@ if sys.version_info >= (3, 12): *, pwd: bytes | None = None, ) -> TextIOWrapper: - """Open this entry as text or binary following the semantics + """ + Open this entry as text or binary following the semantics of ``pathlib.Path.open()`` by passing arguments through to io.TextIOWrapper(). """ @@ -222,12 +231,15 @@ if sys.version_info >= (3, 12): def glob(self, pattern: str) -> Iterator[Self]: ... def rglob(self, pattern: str) -> Iterator[Self]: ... def is_symlink(self) -> Literal[False]: - """Return whether this path is a symlink.""" + """ + Return whether this path is a symlink. + """ def relative_to(self, other: Path, *extra: StrPath) -> str: ... def match(self, path_pattern: str) -> bool: ... def __eq__(self, other: object) -> bool: - """>>> Path(zipfile.ZipFile(io.BytesIO(), 'w')) == 'foo' + """ + >>> Path(zipfile.ZipFile(io.BytesIO(), 'w')) == 'foo' False """ diff --git a/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/glob.pyi b/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/glob.pyi index f7c0e01897..8722f25246 100644 --- a/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/glob.pyi +++ b/crates/ty_vendored/vendor/typeshed/stdlib/zipfile/_path/glob.pyi @@ -4,7 +4,8 @@ from re import Match if sys.version_info >= (3, 13): class Translator: - """>>> Translator('xyz') + """ + >>> Translator('xyz') Traceback (most recent call last): ... AssertionError: Invalid separators @@ -17,10 +18,13 @@ if sys.version_info >= (3, 13): def __init__(self, seps: str = ...) -> None: ... def translate(self, pattern: str) -> str: - """Given a glob pattern, produce a regex that matches it.""" + """ + Given a glob pattern, produce a regex that matches it. + """ def extend(self, pattern: str) -> str: - """Extend regex for pattern-wide concerns. + """ + Extend regex for pattern-wide concerns. Apply '(?s:)' to create a non-matching group that matches newlines (valid on Unix). @@ -29,13 +33,15 @@ if sys.version_info >= (3, 13): """ def match_dirs(self, pattern: str) -> str: - """Ensure that zipfile.Path directory names are matched. + """ + Ensure that zipfile.Path directory names are matched. zipfile.Path directory names always end in a slash. """ def translate_core(self, pattern: str) -> str: - """Given a glob pattern, produce a regex that matches it. + """ + Given a glob pattern, produce a regex that matches it. >>> t = Translator() >>> t.translate_core('*.txt').replace('\\\\\\\\', '') @@ -47,10 +53,13 @@ if sys.version_info >= (3, 13): """ def replace(self, match: Match[str]) -> str: - """Perform the replacements for a match from :func:`separate`.""" + """ + Perform the replacements for a match from :func:`separate`. + """ def restrict_rglob(self, pattern: str) -> None: - """Raise ValueError if ** appears in anything but a full path segment. + """ + Raise ValueError if ** appears in anything but a full path segment. >>> Translator().translate('**foo') Traceback (most recent call last): @@ -59,11 +68,14 @@ if sys.version_info >= (3, 13): """ def star_not_empty(self, pattern: str) -> str: - """Ensure that * will not match an empty segment.""" + """ + Ensure that * will not match an empty segment. + """ else: def translate(pattern: str) -> str: - """Given a glob pattern, produce a regex that matches it. + """ + Given a glob pattern, produce a regex that matches it. >>> translate('*.txt') '[^/]*\\\\.txt' @@ -74,13 +86,15 @@ else: """ def match_dirs(pattern: str) -> str: - """Ensure that zipfile.Path directory names are matched. + """ + Ensure that zipfile.Path directory names are matched. zipfile.Path directory names always end in a slash. """ def translate_core(pattern: str) -> str: - """Given a glob pattern, produce a regex that matches it. + """ + Given a glob pattern, produce a regex that matches it. >>> translate('*.txt') '[^/]*\\\\.txt' @@ -91,10 +105,13 @@ else: """ def replace(match: Match[str]) -> str: - """Perform the replacements for a match from :func:`separate`.""" + """ + Perform the replacements for a match from :func:`separate`. + """ def separate(pattern: str) -> Iterator[Match[str]]: - """Separate out character sets to avoid translating their contents. + """ + Separate out character sets to avoid translating their contents. >>> [m.group(0) for m in separate('*.txt')] ['*.txt']