From 2f8d01e9ecc6eaf9f7eb1f9bc96682070f1edfe1 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 18 Oct 2023 07:18:05 +0100 Subject: [PATCH] Bump mypy to 1.6.1 (#10862) --- requirements-tests.txt | 2 +- stubs/invoke/invoke/tasks.pyi | 2 +- tests/stubtest_allowlists/darwin.txt | 1 + tests/stubtest_allowlists/linux.txt | 1 + tests/stubtest_allowlists/py310.txt | 15 ++++++ tests/stubtest_allowlists/py311.txt | 16 ++++++ tests/stubtest_allowlists/py312.txt | 7 +++ tests/stubtest_allowlists/py38.txt | 25 +++++++++- tests/stubtest_allowlists/py39.txt | 14 ++++++ tests/stubtest_allowlists/py3_common.txt | 63 +++++++++++++++++++++++- tests/stubtest_allowlists/win32.txt | 3 ++ 11 files changed, 145 insertions(+), 4 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index cff681dcd..1586ecd99 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -7,7 +7,7 @@ flake8-bugbear==23.9.16 # must match .pre-commit-config.yaml flake8-noqa==1.3.2 # must match .pre-commit-config.yaml flake8-pyi==23.10.0 # must match .pre-commit-config.yaml isort==5.12.0 # must match .pre-commit-config.yaml -mypy==1.5.1 +mypy==1.6.1 pre-commit-hooks==4.5.0 # must match .pre-commit-config.yaml pytype==2023.10.17; platform_system != "Windows" and python_version < "3.12" ruff==0.1.0 # must match .pre-commit-config.yaml diff --git a/stubs/invoke/invoke/tasks.pyi b/stubs/invoke/invoke/tasks.pyi index 7a1188a4e..72a212644 100644 --- a/stubs/invoke/invoke/tasks.pyi +++ b/stubs/invoke/invoke/tasks.pyi @@ -57,7 +57,7 @@ class Task(Generic[_P, _R_co]): def get_arguments(self, ignore_unknown_help: bool | None = None) -> list[Argument]: ... @overload -def task( +def task( # type: ignore[misc] *args: Task[..., Any] | Call, name: str | None = ..., aliases: tuple[str, ...] = ..., diff --git a/tests/stubtest_allowlists/darwin.txt b/tests/stubtest_allowlists/darwin.txt index 8e6610488..1d5283ca5 100644 --- a/tests/stubtest_allowlists/darwin.txt +++ b/tests/stubtest_allowlists/darwin.txt @@ -1,4 +1,5 @@ _posixsubprocess.cloexec_pipe +curses.has_key (os|posix).sched_param # system dependent. Unclear if macos has it. select.KQ_FILTER_NETDEV # system dependent select.kqueue.__init__ # default C signature is wrong diff --git a/tests/stubtest_allowlists/linux.txt b/tests/stubtest_allowlists/linux.txt index f2386ae01..cb7997a11 100644 --- a/tests/stubtest_allowlists/linux.txt +++ b/tests/stubtest_allowlists/linux.txt @@ -1,5 +1,6 @@ _socket.* _posixsubprocess.cloexec_pipe +curses.has_key os.plock selectors.KqueueSelector socket.[A-Z0-9_]+ diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 816eb8436..535092fe6 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -24,6 +24,21 @@ types.GenericAlias.__call__ # Would be complicated to fix properly, Any could s typing._SpecialForm.__mro_entries__ weakref.ProxyType.__reversed__ # Doesn't really exist +# Modules that exist at runtime, but are missing from typeshed +importlib.readers + +# Modules that exist at runtime, but shouldn't be added to typeshed +ctypes.test +ctypes\.test\..+ +lib2to3.tests +lib2to3\.tests\..+ +sqlite3.test +sqlite3\.test\..+ +tkinter.test +tkinter\.test\..+ +unittest.test +unittest\.test\..+ + # Exist at runtime for internal reasons, no need to put them in the stub typing_extensions\.TypeAliasType\.__call__ typing_extensions\.TypeAliasType\.__init_subclass__ diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 430be8820..7f5bb21a3 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -17,6 +17,22 @@ tkinter._VersionInfoType.__doc__ typing.NewType.__call__ typing.NewType.__mro_entries__ +# Modules that exist at runtime, but are missing from typeshed +importlib.readers +importlib.resources.readers +importlib.resources.simple +importlib.simple + +# Modules that exist at runtime, but shouldn't be added to typeshed +ctypes.test +ctypes\.test\..+ +lib2to3.tests +lib2to3\.tests\..+ +tkinter.test +tkinter\.test\..+ +unittest.test +unittest\.test\..+ + # ========== # Related to positional-only arguments # ========== diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index b8f2a5f4a..4a2def9b1 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -1,3 +1,10 @@ +# Modules that exist at runtime, but are missing from typeshed +zipfile._path.glob +importlib.readers +importlib.resources.readers +importlib.resources.simple +importlib.simple + # Errors that also existed on Python 3.11 _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__ diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 01fc5d3c2..38f474467 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -1,4 +1,13 @@ -_dummy_threading +_dummy_threading.Condition.acquire +_dummy_threading.Condition.release +_dummy_threading.Event.isSet +_dummy_threading.ExceptHookArgs +_dummy_threading.Lock +_dummy_threading.RLock +_dummy_threading.Thread.native_id +_dummy_threading._DummyThread.__init__ +_dummy_threading._RLock.__enter__ +_dummy_threading.local.__new__ asyncio.locks._ContextManagerMixin.__enter__ # Always raises; deliberately omitted from the stub asyncio.locks._ContextManagerMixin.__exit__ # Always raises; deliberately omitted from the stub asyncio.transports.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself @@ -41,6 +50,7 @@ typing.NamedTuple._replace typing._SpecialForm.__new__ xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 xml.etree.cElementTree.TreeBuilder.start # bpo-39495 +xxsubtype # module missing from the stubs # Exist at runtime for internal reasons, no need to put them in the stub typing_extensions\.TypeAliasType\.__call__ @@ -158,3 +168,16 @@ pkgutil.ImpImporter\..* pkgutil.ImpLoader\..* types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime + +# Modules that exist at runtime, but shouldn't be added to typeshed +ctypes.test +ctypes\.test\..+ +lib2to3.tests +lib2to3\.tests\..+ +sqlite3.test +sqlite3\.test\..+ +test +tkinter.test +tkinter\.test\..+ +unittest.test +unittest\.test\..+ diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index ce49b3ba6..88026b0c3 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -37,6 +37,7 @@ tkinter.Tk.split types.GenericAlias.__getattr__ types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 weakref.ProxyType.__reversed__ # Doesn't really exist +xxsubtype # module missing from the stubs # Exist at runtime for internal reasons, no need to put them in the stub typing_extensions\.TypeAliasType\.__call__ @@ -55,6 +56,19 @@ collections.Generator.gi_yieldfrom collections.Mapping.get # Adding None to the Union messed up mypy collections.Sequence.index # Supporting None in end is not mandatory +# Modules that exist at runtime, but shouldn't be added to typeshed +ctypes.test +ctypes\.test\..+ +lib2to3.tests +lib2to3\.tests\..+ +sqlite3.test +sqlite3\.test\..+ +test +tkinter.test +tkinter\.test\..+ +unittest.test +unittest\.test\..+ + # Exists at runtime, but missing from stubs _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__ diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index a7db8a2a8..a1d9b2b85 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -134,8 +134,69 @@ xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signatur xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature xml.parsers.expat.expat_CAPI +# Modules that exist at runtime, but shouldn't be added to typeshed +idlelib + # ========== -# Exists at runtime, but missing from stubs +# Modules that exist at runtime, but are missing from stubs +# ========== +ctypes.macholib +ctypes.macholib.dyld +ctypes.macholib.dylib +ctypes.macholib.framework +encodings.aliases +encodings.ascii +encodings.base64_codec +encodings.big5 +encodings.big5hkscs +encodings.bz2_codec +encodings.charmap +encodings\.cp\d+ +encodings\.euc_.+ +encodings.gb18030 +encodings.gb2312 +encodings.gbk +encodings.hex_codec +encodings.hp_roman8 +encodings.hz +encodings.idna +encodings\.iso2022_.* +encodings\.iso8859_\d+ +encodings.johab +encodings\.koi8_\w +encodings.kz1048 +encodings.latin_1 +encodings\.mac_.+ +encodings.palmos +encodings.ptcp154 +encodings.punycode +encodings.quopri_codec +encodings.raw_unicode_escape +encodings.rot_13 +encodings\.shift_jis.* +encodings.tis_620 +encodings.undefined +encodings.unicode_escape +encodings.utf_16 +encodings.utf_16_be +encodings.utf_16_le +encodings.utf_32 +encodings.utf_32_be +encodings.utf_32_le +encodings.utf_7 +encodings.uu_codec +encodings.zlib_codec +json.scanner +lib2to3.btm_utils +lib2to3.fixer_util +lib2to3.patcomp +sqlite3.dump +turtledemo +turtledemo\..+ +xml.sax.expatreader + +# ========== +# Module members that exist at runtime, but are missing from stubs # ========== _json.encode_basestring _socket.CAPI diff --git a/tests/stubtest_allowlists/win32.txt b/tests/stubtest_allowlists/win32.txt index 8577e1613..1f3bc656a 100644 --- a/tests/stubtest_allowlists/win32.txt +++ b/tests/stubtest_allowlists/win32.txt @@ -4,6 +4,9 @@ ctypes.GetLastError # Is actually a pointer multiprocessing.reduction.AbstractReducer.DupHandle # Exists at runtime, but missing from stubs +encodings.mbcs +encodings.oem +nt _winapi.CreateFileMapping _winapi.MapViewOfFile _winapi.OpenFileMapping