Update stubtest for final checking (#7312)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2022-02-19 18:53:15 -08:00
committed by GitHub
parent 06a2024422
commit 823592e100
8 changed files with 7 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ jobs:
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@b36d8cf5d4d0bb77c5a8cf783ba4def16cd9846a
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9
- name: Run stubtest
run: python tests/stubtest_stdlib.py

View File

@@ -114,7 +114,7 @@ jobs:
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@b36d8cf5d4d0bb77c5a8cf783ba4def16cd9846a
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9
- name: Run stubtest
run: python tests/stubtest_stdlib.py

View File

@@ -103,6 +103,7 @@ if sys.platform != "linux" and sys.platform != "win32":
KQ_NOTE_WRITE: int
if sys.platform == "linux":
@final
class epoll:
def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
def __enter__(self: Self) -> Self: ...

View File

@@ -245,6 +245,7 @@ class Row:
def __ne__(self, __other): ...
if sys.version_info < (3, 8):
@final
class Statement:
def __init__(self, *args, **kwargs): ...

View File

@@ -51,8 +51,6 @@ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolv
ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
gettext.install
gettext.translation
hashlib.sha3_\d+ # Can be a class or a built-in function
hashlib.shake_\d+ # Can be a class or a built-in function
hmac.new # Stub is a white lie; see comments in the stub
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol

View File

@@ -36,8 +36,6 @@ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolv
ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
gettext.install
gettext.translation
hashlib.sha3_\d+
hashlib.shake_\d+
hmac.new # Stub is a white lie; see comments in the stub
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol

View File

@@ -92,6 +92,8 @@ enum.Enum.value
enum.Flag.name
enum.Flag.value
enum.IntEnum.value
hashlib.sha3_\d+ # Can be a class or a built-in function, can't be subclassed at runtime
hashlib.shake_\d+ # Can be a class or a built-in function, can't be subclassed at runtime
http.HTTPStatus.description # set in __new__
http.HTTPStatus.phrase # set in __new__
http.client.HTTPConnection.response_class # the actual type at runtime is abc.ABCMeta

View File

@@ -22,7 +22,7 @@ def get_mypy_req():
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
return "git+git://github.com/python/mypy@b36d8cf5d4d0bb77c5a8cf783ba4def16cd9846a"
return "git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9"
with open("requirements-tests.txt") as f:
return next(line.strip() for line in f if "mypy" in line)