Skip to content

Commit

Permalink
Bump mypy to 1.6.1 (#10862)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Oct 18, 2023
1 parent 1ecaab1 commit 2f8d01e
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stubs/invoke/invoke/tasks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...] = ...,
Expand Down
1 change: 1 addition & 0 deletions tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
_socket.*
_posixsubprocess.cloexec_pipe
curses.has_key
os.plock
selectors.KqueueSelector
socket.[A-Z0-9_]+
Expand Down
15 changes: 15 additions & 0 deletions tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
16 changes: 16 additions & 0 deletions tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ==========
Expand Down
7 changes: 7 additions & 0 deletions tests/stubtest_allowlists/py312.txt
Original file line number Diff line number Diff line change
@@ -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__
Expand Down
25 changes: 24 additions & 1 deletion tests/stubtest_allowlists/py38.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__
Expand Down Expand Up @@ -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\..+
14 changes: 14 additions & 0 deletions tests/stubtest_allowlists/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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__
Expand Down
63 changes: 62 additions & 1 deletion tests/stubtest_allowlists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ==========
# 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

# ==========
# Exists at runtime, but missing from stubs
# Module members that exist at runtime, but are missing from stubs
# ==========
_json.encode_basestring
_socket.CAPI
Expand Down
3 changes: 3 additions & 0 deletions tests/stubtest_allowlists/win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f8d01e

Please sign in to comment.