Upgrade to stubtest with dunder pos only reverted (#7442)

This commit is contained in:
Shantanu
2022-03-05 18:38:08 -08:00
committed by GitHub
parent cda3d9cf72
commit 77e5a2d468
10 changed files with 21 additions and 35 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@a562f0aac287b1069a8267b3812fb6813eaefec3
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@c7a81620bef7585cca6905861bb7ef34ec12da2f
- 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@a562f0aac287b1069a8267b3812fb6813eaefec3
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@c7a81620bef7585cca6905861bb7ef34ec12da2f
- name: Run stubtest
run: python tests/stubtest_stdlib.py
@@ -133,7 +133,12 @@ jobs:
run: pip install $(grep tomli== requirements-tests.txt)
- name: Run stubtest
run: |
STUBS=$(git diff --name-only origin/${{ github.base_ref }} HEAD | egrep ^stubs/ | cut -d "/" -f 2 | sort -u | (while read stub; do [ -d stubs/$stub ] && echo $stub || true; done))
STUBS=$(
git diff --name-only origin/${{ github.base_ref }} HEAD |
# Uncomment the following to (very slowly) run on all third party stubs:
# git ls-files |
egrep ^stubs/ | cut -d "/" -f 2 | sort -u | (while read stub; do [ -d stubs/$stub ] && echo $stub || true; done)
)
if test -n "$STUBS"; then
echo "Testing $STUBS..."
APT_PACKAGES=$(python tests/get_apt_packages.py $STUBS)

View File

@@ -0,0 +1 @@
.*\.AttributeGetter.__repr__ # has an extra argument, but also a million things inherit from it

View File

@@ -1,2 +1,7 @@
cachetools.Cache.get
cachetools.cache.Cache.get
# it looks like cachetools stubs are really out of date, so none of the modules
# referenced exist anymore
cachetools\..*\.__(get|set|del)item__ # has extra argument
cachetools\..*TTLCache.__repr__

View File

@@ -1,4 +1,5 @@
frozendict.FrozenOrderedDict
frozendict.frozendict.__hash__
frozendict.frozendict.__new__
frozendict.frozendict.__repr__ # forwards args to super
frozendict.frozendict.copy

View File

@@ -22,6 +22,8 @@ class FilterNode:
assertion: Any
elements: Any
def __init__(self, tag: Any | None = ..., assertion: Any | None = ...) -> None: ...
def __str__(self, pos: int = ...) -> str: ...
def __repr__(self, pos: int = ...) -> str: ...
def append(self, filter_node): ...
def evaluate_match(match, schema, auto_escape, auto_encode, validator, check_names): ...

View File

@@ -0,0 +1 @@
selenium.webdriver.__all__ # intentional

View File

@@ -20,6 +20,7 @@ from .webkitgtk.options import Options as WebKitGTKOptions
from .webkitgtk.webdriver import WebDriver as WebKitGTK
# We need an explicit __all__ because some of the above won't otherwise be exported.
# This could also be fixed using assignments
__all__ = [
"Firefox",
"FirefoxProfile",

View File

@@ -9,36 +9,12 @@ _collections_abc.ValuesView.__reversed__
# These are not positional-only at runtime, but we treat them
# as positional-only to match dict.
_collections_abc.Mapping.__getitem__
_collections_abc.Mapping.__contains__
_collections_abc.MutableMapping.__delitem__
_collections_abc.MutableMapping.__setitem__
_collections_abc.MutableMapping.pop
_collections_abc.MutableMapping.setdefault
# Many positional-only differences with KeysView/ItemsView
_collections_abc.dict_keys.__.*__
_collections_abc.dict_items.__.*__
# Pos-only differences with object.__setattr__/object.__delattr__
# Adding these to the stub has bad consequences (see #7385, #7347)
enum.EnumMeta.__setattr__
enum.EnumMeta.__delattr__
uuid.UUID.__setattr__
# Pos-only differences with the normal NamedTuple __getitem__
platform.uname_result.__getitem__
# mypy does not autogenerate __eq__ methods for dataclasses,
# so wrongly infers that these have positional-only parameters.
# https://github.com/python/mypy/issues/12186
pstats.FunctionProfile.__eq__
pstats.StatsProfile.__eq__
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
# to mark these as positional-only for compatibility with existing sub-classes.
typing.BinaryIO.write
typing.IO.__exit__
typing.IO.read
typing.IO.readline
typing.IO.readlines
@@ -132,17 +108,12 @@ xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signatu
# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
_collections_abc.AsyncGenerator.asend
_collections_abc.AsyncGenerator.athrow
_collections_abc.Container.__contains__
_collections_abc.Coroutine.send
_collections_abc.Coroutine.throw
_collections_abc.Generator.send
_collections_abc.Generator.throw
_collections_abc.Mapping.__eq__
_collections_abc.Set.__eq__
contextlib.AbstractAsyncContextManager.__aexit__
contextlib.AbstractContextManager.__exit__
typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface
# typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface
types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
@@ -177,7 +148,6 @@ asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone nee
asyncio.AbstractEventLoop.connect_accepted_socket
asyncio.events.AbstractEventLoop.connect_accepted_socket
bdb.Breakpoint.clearBreakpoints
dbm.dumb._Database.__contains__
distutils.dist.DistributionMetadata.set_classifiers
distutils.dist.DistributionMetadata.set_keywords
distutils.dist.DistributionMetadata.set_platforms

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@a562f0aac287b1069a8267b3812fb6813eaefec3"
return "git+git://github.com/python/mypy@c7a81620bef7585cca6905861bb7ef34ec12da2f"
with open("requirements-tests.txt") as f:
return next(line.strip() for line in f if "mypy" in line)