diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b33a3d4dc35..fb7b893d4d7f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: - uses: actions/checkout@v4 - uses: chartboost/ruff-action@v1 with: - version: "0.1.7" # must match .pre-commit-config.yaml and requirements-test.txt + version: "0.1.9" # must match .pre-commit-config.yaml and requirements-test.txt flake8: name: Lint with Flake8 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a35c2dc2fcf..8444c043d09c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,12 +10,12 @@ repos: - id: mixed-line-ending - id: check-case-conflict - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.11.0 # must match requirements-tests.txt + rev: 23.12.0 # must match requirements-tests.txt hooks: - id: black language_version: python3.10 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.7 # must match requirements-tests.txt and tests.yml + rev: v0.1.9 # must match requirements-tests.txt and tests.yml hooks: - id: ruff args: [--exit-non-zero-on-fix, --fix-only] diff --git a/requirements-tests.txt b/requirements-tests.txt index 894cfcfa2cd6..2e62c3d6825a 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,15 +1,15 @@ # Type checkers and other linters that we test our stubs against. These should always # be pinned to a specific version to make failure reproducible. See also the # "tool.typeshed" section in pyproject.toml for additional type checkers. -black==23.11.0 # must match .pre-commit-config.yaml +black==23.12.0 # must match .pre-commit-config.yaml flake8==6.1.0 # must match .pre-commit-config.yaml flake8-bugbear==23.12.2 # must match .pre-commit-config.yaml flake8-noqa==1.3.2 # must match .pre-commit-config.yaml flake8-pyi==23.11.0 # must match .pre-commit-config.yaml -mypy==1.7.1 +mypy==1.8.0 pre-commit-hooks==4.5.0 # must match .pre-commit-config.yaml pytype==2023.12.8; platform_system != "Windows" and python_version < "3.12" -ruff==0.1.7 # must match .pre-commit-config.yaml and tests.yml +ruff==0.1.9 # must match .pre-commit-config.yaml and tests.yml # Libraries used by our various scripts. aiohttp==3.9.1 diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 47c8e2207022..36d1862fdda7 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -83,6 +83,7 @@ if sys.platform != "win32": def write(self, data: bytes, flags: int = ...) -> int: ... def close(self) -> None: ... def fileno(self) -> int: ... + def __del__(self) -> None: ... class file_dispatcher(dispatcher): def __init__(self, fd: FileDescriptorLike, map: _MapType | None = None) -> None: ... diff --git a/stubs/pyasn1/@tests/stubtest_allowlist.txt b/stubs/pyasn1/@tests/stubtest_allowlist.txt index a4f02448ed6d..5028c70108e2 100644 --- a/stubs/pyasn1/@tests/stubtest_allowlist.txt +++ b/stubs/pyasn1/@tests/stubtest_allowlist.txt @@ -1,6 +1,3 @@ -# type_check_only -pyasn1.type.base.NoValue.plug - # typeshed typing differences with runtime collections.OrderedDict and builtins.dict pyasn1.codec.native.encoder.SequenceEncoder.protoDict pyasn1.codec.native.encoder.SetEncoder.protoDict diff --git a/stubs/pynput/@tests/stubtest_allowlist_linux.txt b/stubs/pynput/@tests/stubtest_allowlist_linux.txt index 6a32bbd42136..ff54e4166252 100644 --- a/stubs/pynput/@tests/stubtest_allowlist_linux.txt +++ b/stubs/pynput/@tests/stubtest_allowlist_linux.txt @@ -1,5 +1,11 @@ # These __init__ methods have *args, **kwargs arguments on some platforms, but not others pynput.keyboard.Controller.__init__ +# To reduce duplication, our stubs simplify things: +# the runtime has several Controller classes, +# some of which have __del__ methods on linux, and some of which don't. +pynput.mouse.Controller.__del__ +pynput.keyboard.Controller.__del__ + # Platform specific implementation detail: pynput.keyboard.Controller.keyboard_mapping diff --git a/stubs/python-xlib/@tests/stubtest_allowlist.txt b/stubs/python-xlib/@tests/stubtest_allowlist.txt index 1809e171e038..2fec5b0c782c 100644 --- a/stubs/python-xlib/@tests/stubtest_allowlist.txt +++ b/stubs/python-xlib/@tests/stubtest_allowlist.txt @@ -17,9 +17,6 @@ Xlib.protocol.rq.*.structcode # Should only ever be str once instantiated Xlib.protocol.rq.*.name -# Structs generate their attributes (@type_check_only) -Xlib.protocol.rq.Struct.__getattr__ - # Iteration variable that bleeds into the global scope Xlib.protocol.rq.c Xlib.protocol.rq.size diff --git a/stubs/python-xlib/Xlib/protocol/rq.pyi b/stubs/python-xlib/Xlib/protocol/rq.pyi index f9ec0f45650c..871afc9d4529 100644 --- a/stubs/python-xlib/Xlib/protocol/rq.pyi +++ b/stubs/python-xlib/Xlib/protocol/rq.pyi @@ -365,7 +365,6 @@ class GetAttrData: # GetAttrData classes get their attributes dynamically # TODO: Complete all classes inheriting from GetAttrData def __getattr__(self, attr: str) -> Any: ... - @type_check_only def __setattr__(self, __name: str, __value: Any) -> None: ... class DictWrapper(GetAttrData): diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index df8d27d8b74c..ec360ac265bf 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -24,6 +24,7 @@ types.GenericAlias.__mro_entries__ types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 typing._SpecialForm.__mro_entries__ weakref.ProxyType.__reversed__ # Doesn't really exist +builtins.ellipsis # type is not exposed anywhere # Modules that exist at runtime, but shouldn't be added to typeshed ctypes.test diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 509e68adf967..20fc8de56fae 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -16,6 +16,7 @@ importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined importlib.abc.Finder.find_module tkinter._VersionInfoType.__doc__ typing.NewType.__mro_entries__ +builtins.ellipsis # type is not exposed anywhere # Modules that exist at runtime, but shouldn't be added to typeshed ctypes.test diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index 8847ee424b51..bd2dcbf198cf 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -14,6 +14,7 @@ enum.Enum.__init__ importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility tkinter._VersionInfoType.__doc__ typing.NewType.__mro_entries__ +builtins.ellipsis # type is not exposed anywhere # ========== # Related to positional-only arguments diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index c79bcacd6565..495e42c6fbbe 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -24,8 +24,6 @@ asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several p asyncio.Future.__init__ # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object builtins.dict.get -builtins.ellipsis # type is not exposed anywhere -builtins.function collections.ChainMap.fromkeys # Runtime has *args which can really only be one argument collections.UserList.sort # Runtime has *args but will error if any are supplied configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used @@ -479,8 +477,7 @@ typing_extensions\.TypeVar.* typing_extensions\.ParamSpec.* typing(_extensions)?\.Generic typing\.Protocol -(typing\._TypedDict\..+)? -typing_extensions\._TypedDict\..* +typing(_extensions)?\._TypedDict # Special primitives typing_extensions\.Annotated @@ -513,7 +510,6 @@ typing(_extensions)?\.Coroutine typing(_extensions)?\.Collection typing(_extensions)?\.Container typing\.ByteString -typing(_extensions)?\.AwaitableGenerator typing(_extensions)?\.Awaitable typing(_extensions)?\.AbstractSet