Skip to content

Commit

Permalink
Update to mypy 1.14 (python#13272)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungol authored Dec 21, 2024
1 parent 8e31597 commit 097581e
Show file tree
Hide file tree
Showing 43 changed files with 357 additions and 79 deletions.
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Type checkers that we test our stubs against. These should always
# be pinned to a specific version to make failure reproducible.
mypy==1.13.0
mypy==1.14.0
pyright==1.1.389
# pytype can be installed on Windows, but requires building wheels, let's not do that on the CI
pytype==2024.10.11; platform_system != "Windows" and python_version >= "3.10" and python_version < "3.13"
Expand Down
1 change: 1 addition & 0 deletions stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ _collections_abc.AsyncGenerator.ag_await
_collections_abc.AsyncGenerator.ag_code
_collections_abc.AsyncGenerator.ag_frame
_collections_abc.AsyncGenerator.ag_running
asyncio.__all__
asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
builtins.dict.get
Expand Down
14 changes: 14 additions & 0 deletions stubs/PyYAML/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# TODO: missing from stub
yaml.composer.__all__
yaml.constructor.__all__
yaml.dumper.__all__
yaml.emitter.__all__
yaml.error.__all__
yaml.loader.__all__
yaml.parser.__all__
yaml.reader.__all__
yaml.representer.__all__
yaml.resolver.__all__
yaml.scanner.__all__
yaml.serializer.__all__

# yaml._yaml is for backwards compatibility so none of it matters anyway
yaml._yaml.__test__

Expand Down
3 changes: 3 additions & 0 deletions stubs/WTForms/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TODO: missing from stub
wtforms.form.__all__

# Error: is not present at runtime
# =============================
# This is hack to get around Field.__new__ not being able to return
Expand Down
15 changes: 15 additions & 0 deletions stubs/WebOb/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# TODO: missing from stub
webob.__all__
webob.byterange.__all__
webob.client.__all__
webob.cookies.__all__
webob.datetime_utils.__all__
webob.dec.__all__
webob.etag.__all__
webob.exc.__all__
webob.headers.__all__
webob.multidict.__all__
webob.request.__all__
webob.response.__all__
webob.static.__all__

# Error: is not present in stub
# =============================
# These are plain strings, regex strings or compiled regex patterns
Expand Down
5 changes: 5 additions & 0 deletions stubs/aiofiles/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# TODO: missing from stub
aiofiles.__all__
aiofiles.tempfile.__all__
aiofiles.threadpool.__all__

# These all delegate using *args,**kwargs, but stubs use signature of
# method they are being delegated to.
aiofiles.threadpool.binary.AsyncBufferedIOBase.close
Expand Down
17 changes: 17 additions & 0 deletions stubs/boltons/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# TODO: missing from stub
boltons.debugutils.__all__
boltons.dictutils.__all__
boltons.excutils.__all__
boltons.fileutils.__all__
boltons.formatutils.__all__
boltons.gcutils.__all__
boltons.jsonutils.__all__
boltons.listutils.__all__
boltons.namedutils.__all__
boltons.pathutils.__all__
boltons.queueutils.__all__
boltons.setutils.__all__
boltons.strutils.__all__
boltons.tableutils.__all__
boltons.tbutils.__all__

boltons.funcutils.CachedInstancePartial.__partialmethod__
boltons.funcutils.InstancePartial.__partialmethod__
3 changes: 3 additions & 0 deletions stubs/cffi/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TODO: missing from stub
cffi.__all__

# added dynamically and not detected by stubtest
cffi.(api.)?FFI.CData
cffi.(api.)?FFI.CType
Expand Down
2 changes: 2 additions & 0 deletions stubs/click-default-group/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: missing from stub
click_default_group.__all__
4 changes: 4 additions & 0 deletions stubs/console-menu/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO: missing from stub
consolemenu.__all__
consolemenu.format.__all__
consolemenu.items.__all__
3 changes: 3 additions & 0 deletions stubs/editdistance/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# TODO: missing from stub
editdistance.__all__

# Not public API -- the submodule is an implementation detail due to it being a cythonized package
editdistance.bycython
6 changes: 3 additions & 3 deletions stubs/fpdf2/fpdf/enums.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class SignatureFlag(IntEnum):
SIGNATURES_EXIST = 1
APPEND_ONLY = 2

class CoerciveEnum(Enum):
class CoerciveEnum(Enum): # type: ignore[misc] # Enum with no members
@classmethod
def coerce(cls, value: Self | str) -> Self: ...

class CoerciveIntEnum(IntEnum):
class CoerciveIntEnum(IntEnum): # type: ignore[misc] # Enum with no members
@classmethod
def coerce(cls, value: Self | str | int) -> Self: ...

class CoerciveIntFlag(IntFlag):
class CoerciveIntFlag(IntFlag): # type: ignore[misc] # Enum with no members
@classmethod
def coerce(cls, value: Self | str | int) -> Self: ...

Expand Down
38 changes: 38 additions & 0 deletions stubs/gevent/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# TODO: missing from stub
gevent._abstract_linkable.__all__
gevent._ffi.loop.__all__
gevent._ffi.watcher.__all__
gevent._greenlet_primitives.__all__
gevent._ident.__all__
gevent._imap.__all__
gevent.backdoor.__all__
gevent.baseserver.__all__
gevent.event.__all__
gevent.events.__all__
gevent.exceptions.__all__
gevent.fileobject.__all__
gevent.greenlet.__all__
gevent.hub.__all__
gevent.libev.__all__
gevent.libev.corecext.__all__
gevent.libuv.__all__
gevent.libuv.loop.__all__
gevent.libuv.watcher.__all__
gevent.local.__all__
gevent.monkey.__all__
gevent.os.__all__
gevent.resolver.__all__
gevent.resolver.blocking.__all__
gevent.resolver.dnspython.__all__
gevent.resolver.thread.__all__
gevent.resolver_thread.__all__
gevent.server.__all__
gevent.signal.__all__
gevent.socket.__all__
gevent.ssl.__all__
gevent.subprocess.__all__
gevent.threadpool.__all__
gevent.timeout.__all__
gevent.util.__all__
gevent.win32util.__all__

# Error: failed to find stubs
# =============================
# testing modules are not included in type stubs
Expand Down
6 changes: 6 additions & 0 deletions stubs/gevent/@tests/stubtest_allowlist_darwin.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# TODO: missing from stub
gevent.ares.__all__
gevent.libev.corecffi.__all__
gevent.resolver.ares.__all__
gevent.resolver_ares.__all__

# Error: is not present in stub
# =============================
# internal API stuff we dropped because it wasn't necessary
Expand Down
6 changes: 6 additions & 0 deletions stubs/gevent/@tests/stubtest_allowlist_linux.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# TODO: missing from stub
gevent.ares.__all__
gevent.libev.corecffi.__all__
gevent.resolver.ares.__all__
gevent.resolver_ares.__all__

# Error: is not present in stub
# =============================
# internal API stuff we dropped because it wasn't necessary
Expand Down
3 changes: 3 additions & 0 deletions stubs/greenlet/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TODO: missing from stub
greenlet.__all__

# Error: is not present in stub
# =============================
# this module only contains C code and exports no Python code, so it's better
Expand Down
3 changes: 3 additions & 0 deletions stubs/hdbcli/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TODO: missing from stub
hdbcli.__all__

# Are set to `None` by default, initialized later:
hdbcli.dbapi.Error.errorcode
hdbcli.dbapi.Error.errortext
Expand Down
3 changes: 3 additions & 0 deletions stubs/httplib2/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# TODO: missing from stub
httplib2.__all__

# __getattr__() replaced with actual field in stub
httplib2.Response.dict
17 changes: 17 additions & 0 deletions stubs/humanfriendly/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# TODO: missing from stub
humanfriendly.__all__
humanfriendly.case.__all__
humanfriendly.cli.__all__
humanfriendly.compat.__all__
humanfriendly.decorators.__all__
humanfriendly.deprecation.__all__
humanfriendly.prompts.__all__
humanfriendly.sphinx.__all__
humanfriendly.tables.__all__
humanfriendly.terminal.__all__
humanfriendly.terminal.html.__all__
humanfriendly.terminal.spinners.__all__
humanfriendly.testing.__all__
humanfriendly.text.__all__
humanfriendly.usage.__all__

# Re-exports:
humanfriendly.usage.import_module
humanfriendly.compat.which
Expand Down
2 changes: 2 additions & 0 deletions stubs/influxdb-client/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: missing from stub
influxdb_client.extras.__all__
8 changes: 4 additions & 4 deletions stubs/jwcrypto/jwcrypto/jwk.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ priv_bytes: Incomplete
JWKTypesRegistry: Incomplete

class ParmType(Enum):
name: str
b64: str
b64u: str
unsupported: str
name = "A string with a name" # pyright: ignore[reportAssignmentType]
b64 = "Base64url Encoded"
b64u = "Base64urlUint Encoded"
unsupported = "Unsupported Parameter"

class JWKParameter(NamedTuple):
description: Incomplete
Expand Down
6 changes: 6 additions & 0 deletions stubs/libsass/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# TODO: missing from stub
sassutils.builder.__all__
sassutils.distutils.__all__
sassutils.wsgi.__all__
sass.__all__

# Error: is not present in stub
# =============================
# These are only implemented for the purposes of emitting an error
Expand Down
4 changes: 4 additions & 0 deletions stubs/mysqlclient/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# TODO: missing from stub
MySQLdb.__all__
MySQLdb.constants.__all__

MySQLdb.Connection
42 changes: 42 additions & 0 deletions stubs/passlib/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# TODO: missing from stub
passlib.apache.__all__
passlib.context.__all__
passlib.crypto._blowfish.__all__
passlib.crypto._blowfish.base.__all__
passlib.crypto._blowfish.unrolled.__all__
passlib.crypto._md4.__all__
passlib.crypto.digest.__all__
passlib.crypto.scrypt.__all__
passlib.crypto.scrypt._builtin.__all__
passlib.handlers.argon2.__all__
passlib.handlers.bcrypt.__all__
passlib.handlers.cisco.__all__
passlib.handlers.des_crypt.__all__
passlib.handlers.digests.__all__
passlib.handlers.django.__all__
passlib.handlers.fshp.__all__
passlib.handlers.md5_crypt.__all__
passlib.handlers.misc.__all__
passlib.handlers.mssql.__all__
passlib.handlers.pbkdf2.__all__
passlib.handlers.phpass.__all__
passlib.handlers.postgres.__all__
passlib.handlers.roundup.__all__
passlib.handlers.scram.__all__
passlib.handlers.scrypt.__all__
passlib.handlers.sha1_crypt.__all__
passlib.handlers.sha2_crypt.__all__
passlib.handlers.sun_md5_crypt.__all__
passlib.handlers.windows.__all__
passlib.hosts.__all__
passlib.ifc.__all__
passlib.pwd.__all__
passlib.registry.__all__
passlib.totp.__all__
passlib.utils.binary.__all__
passlib.utils.decor.__all__
passlib.utils.handlers.__all__
passlib.utils.md4.__all__
passlib.utils.pbkdf2.__all__
passlib.win32.__all__

# proxy module that uses some import magic incompatible with stubtest
passlib.hash

Expand Down
3 changes: 3 additions & 0 deletions stubs/peewee/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TODO: missing from stub
peewee.__all__

# Stubtest doesn't recognize __ as indicating positional-only arg at runtime
# https://github.com/python/mypy/issues/15302
peewee.Model.insert
Expand Down
2 changes: 2 additions & 0 deletions stubs/polib/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: missing from stub
polib.__all__
6 changes: 6 additions & 0 deletions stubs/psutil/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# TODO: missing from stub
psutil.__all__
psutil._common.__all__
psutil._compat.__all__
psutil._psposix.__all__

# These super() dunders don't seem to be particularly useful,
# and having them pop up on autocomplete suggestions would be annoying
psutil._compat.super.__self__
Expand Down
Loading

0 comments on commit 097581e

Please sign in to comment.