From e0821fade402115604c25337097bc1c385fd481b Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 25 Aug 2026 12:39:49 +0200 Subject: [PATCH] all: Drop legacy Tuple. --- doc/common/conf.py | 2 ++ src/ubuiltins/__init__.py | 9 +++------ src/ujson/__init__.py | 2 +- src/umath/__init__.py | 6 ++---- src/ustruct/__init__.py | 6 ++---- src/usys/__init__.py | 2 -- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/doc/common/conf.py b/doc/common/conf.py index 1645573..ad8335c 100644 --- a/doc/common/conf.py +++ b/doc/common/conf.py @@ -139,8 +139,10 @@ nitpick_ignore.append(("py:obj", "typing.IO")) # MaybeAwaitable* stub types have no documented target; the awaitable # extension renders them as an "await" prefix instead, but the raw names can # still leak into signatures (e.g. overloads), so suppress those warnings. +# Likewise, collections.abc types have no link target without intersphinx. nitpick_ignore_regex = [ ("py:class", r"MaybeAwaitable\w*"), + ("py:class", r"collections\.abc\.\w+"), ] # -- Autodoc options ------------------------------------------------------ diff --git a/src/ubuiltins/__init__.py b/src/ubuiltins/__init__.py index ad114db..fcabd7f 100644 --- a/src/ubuiltins/__init__.py +++ b/src/ubuiltins/__init__.py @@ -29,7 +29,6 @@ from typing import ( SupportsComplex, SupportsFloat, SupportsInt, - Tuple, TypeVar, Union, overload, @@ -205,9 +204,7 @@ class bytearray: def __init__(self, source: _int) -> None: ... @overload - def __init__( - self, source: _bytes | _bytearray | _str | Iterable[_int] - ) -> None: ... + def __init__(self, source: _bytes | _bytearray | _str | Iterable[_int]) -> None: ... def __init__(self, *args): r""" @@ -366,7 +363,7 @@ def divmod(a: _float, b: _float) -> tuple[_float, _float]: ... def divmod(a, b): """ - divmod(a, b) -> Tuple[int, int] + divmod(a, b) -> tuple[int, int] Gets the quotient and remainder for dividing two integers. @@ -1396,7 +1393,7 @@ class type: def zip(*iterables: Iterable) -> Iterable[builtins.tuple]: """ - zip(iter_a, iter_b, ...) -> Iterable[Tuple] + zip(iter_a, iter_b, ...) -> Iterable[tuple] Returns an iterator of tuples, where the *i*-th tuple contains the *i*-th element from each of the argument sequences or iterables. The iterator diff --git a/src/ujson/__init__.py b/src/ujson/__init__.py index e69cb2f..e5f36a6 100644 --- a/src/ujson/__init__.py +++ b/src/ujson/__init__.py @@ -9,7 +9,7 @@ Convert between Python objects and the JSON data format. """ -from typing import IO, Any, Tuple +from typing import IO, Any def dump(object: Any, stream: IO, separators: tuple[str, str] = (", ", ": ")): diff --git a/src/umath/__init__.py b/src/umath/__init__.py index 64de4c3..b17d1b3 100644 --- a/src/umath/__init__.py +++ b/src/umath/__init__.py @@ -11,8 +11,6 @@ Math functions. """ -from typing import Tuple as Tuple - e = 2.718282 """The mathematical constant e.""" @@ -264,7 +262,7 @@ def fabs(x: float) -> float: def modf(x: float) -> tuple[float, float]: - """modf(x) -> Tuple[float, float] + """modf(x) -> tuple[float, float] Gets the fractional and integral parts of ``x``, both with the same sign as ``x``. @@ -280,7 +278,7 @@ def modf(x: float) -> tuple[float, float]: def frexp(x: float) -> tuple[float, int]: - """frexp(x) -> Tuple[float, float] + """frexp(x) -> tuple[float, float] Decomposes a value ``x`` into a tuple ``(m, p)``, such that ``x == m * (2 ** p)``. diff --git a/src/ustruct/__init__.py b/src/ustruct/__init__.py index 3c1078f..54892e4 100644 --- a/src/ustruct/__init__.py +++ b/src/ustruct/__init__.py @@ -10,8 +10,6 @@ This module provides functions to convert between Python values and C-like data structs. """ -from typing import Tuple, Union - def calcsize(format: str) -> int: """ @@ -55,7 +53,7 @@ def pack_into(format: str, buffer: bytearray, offset: int, *values) -> bytes: def unpack(format: str, data: bytes | bytearray) -> tuple: """ - unpack(format, data) -> Tuple + unpack(format, data) -> tuple Decodes the binary data using the given format. @@ -70,7 +68,7 @@ def unpack(format: str, data: bytes | bytearray) -> tuple: def unpack_from(format: str, data: bytes | bytearray, offset: int) -> tuple: """ - unpack_from(format, data, offset) -> Tuple + unpack_from(format, data, offset) -> tuple Decodes binary data from a buffer using the given format. diff --git a/src/usys/__init__.py b/src/usys/__init__.py index 3856c0a..37b735c 100644 --- a/src/usys/__init__.py +++ b/src/usys/__init__.py @@ -9,8 +9,6 @@ This module provides a subset of the standard Python ``sys`` module. """ -from typing import Tuple - from uio import FileIO as _FileIO stdin: _FileIO = _FileIO()