Skip to content

Use stubtest 0.920 #6589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ef2d0ac
Upgrade mypy
Dec 16, 2021
865a992
get rid of unittest._log for now
Dec 16, 2021
0377def
allow pickle
Dec 16, 2021
f9628a0
allow DynamicClassAttribute
Dec 16, 2021
f35df4d
allow characters_written
Dec 16, 2021
339cd00
allow pymysql
Dec 16, 2021
c372241
trigger ci on all third party stubs
Dec 16, 2021
adb5315
Update tests/stubtest_allowlists/py310.txt
hauntsaninja Dec 16, 2021
a29ad29
allow babel
Dec 16, 2021
a6b085c
allow hdbcli
Dec 16, 2021
984f57f
Revert "trigger ci on all third party stubs"
Dec 16, 2021
b2fa7df
[temporary] shard stubtest third party
Dec 16, 2021
d22bf40
allow sqlite
Dec 16, 2021
19fea4d
un-allow mysqlclient
Dec 16, 2021
43cd55c
allow html5lib
Dec 16, 2021
a590d66
un-allow waitress
Dec 16, 2021
4b3358e
also allow waitress
Dec 16, 2021
fe7cd0c
mypy_extensions: fix NoReturn, remove inaccurate comment
Dec 16, 2021
c67672b
update paramiko allowlist
Dec 16, 2021
43205b3
more waitress
Dec 16, 2021
74ed3fa
import
Dec 16, 2021
5b7c182
update requests allowlist
Dec 16, 2021
3000ed5
oops another waitress
Dec 16, 2021
8d3279e
ignore missing stub in requests
Dec 16, 2021
da16408
Merge branch 'mypyext' into upgrade-mypy
Dec 16, 2021
43ed4a8
Merge remote-tracking branch 'upstream/master' into upgrade-mypy
Dec 16, 2021
2d84696
use stubtest 0.920
Dec 16, 2021
9af991a
Revert "[temporary] shard stubtest third party"
Dec 16, 2021
8d49a5b
comment
Dec 16, 2021
e57fce4
undo unittest._log hiding
Dec 16, 2021
54a7ba8
Update .github/workflows/tests.yml
JelleZijlstra Dec 16, 2021
8d896fe
allow windows errors
Dec 16, 2021
e5c75d8
allow remaining
Dec 16, 2021
655e564
allow
Dec 16, 2021
5a6e0f7
allow
Dec 17, 2021
63e319f
one more
Dec 17, 2021
c4ba18f
Update tests/stubtest_allowlists/py310.txt
Akuli Dec 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ jobs:
- name: Update pip
run: python -m pip install -U pip
- name: Install dependencies
# Temporarily hard-code the mypy version used for stubtest
# run: pip install $(grep tomli== requirements-tests.txt) (grep mypy== requirements-tests.txt)
run: pip install mypy==0.910
run: pip install $(grep tomli== requirements-tests.txt) $(grep mypy== requirements-tests.txt)
- name: Run stubtest
run: python tests/stubtest_stdlib.py

Expand Down
1 change: 0 additions & 1 deletion stubs/PyMySQL/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pymysql.cursors.Cursor.__del__
# DictCursorMixin changes method types of inherited classes, but doesn't contain much at runtime
pymysql.cursors.DictCursorMixin.__iter__
pymysql.cursors.DictCursorMixin.fetch[a-z]*
pymysql.err.ER
pymysql.escape_dict
pymysql.escape_sequence
pymysql.escape_string
Expand Down
3 changes: 3 additions & 0 deletions stubs/babel/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# In the stub we alias to OrderedDict, but it has positional-only differences
babel.util.odict.fromkeys
babel.util.odict.setdefault
4 changes: 4 additions & 0 deletions stubs/hdbcli/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ hdbcli.dbapi.Error.errorcode
hdbcli.dbapi.Error.errortext
hdbcli.dbapi.Warning.errorcode
hdbcli.dbapi.Warning.errortext
# Similar issues to builtins.memoryview
hdbcli.dbapi.BINARY.__iter__
hdbcli.dbapi.BINARY.cast
hdbcli.dbapi.BINARY.__contains__
1 change: 1 addition & 0 deletions stubs/html5lib/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Misnamed first argument in implementation
html5lib._inputstream.EncodingBytes.__new__
html5lib._tokenizer.attributeMap.get
7 changes: 0 additions & 7 deletions stubs/mysqlclient/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
MySQLdb.Connection
MySQLdb.connections
MySQLdb.constants.CLIENT
MySQLdb.constants.CR
MySQLdb.constants.ER
MySQLdb.constants.FLAG
MySQLdb.converters
MySQLdb.cursors
22 changes: 4 additions & 18 deletions stubs/paramiko/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,11 @@ paramiko.Transport.open_x11_channel
paramiko.Transport.send_ignore
paramiko.Transport.start_server
paramiko._winapi
paramiko.py3compat.builtins.bytearray.pop
paramiko.py3compat.builtins.bytearray.remove
paramiko.py3compat.builtins.classmethod.__get__
paramiko.py3compat.builtins.copyright
paramiko.py3compat.builtins.credits
paramiko.py3compat.builtins.dict.get
paramiko.py3compat.builtins.ellipsis
paramiko.py3compat.builtins.exit
paramiko.py3compat.builtins.function
paramiko.py3compat.builtins.help
paramiko.py3compat.builtins.license
paramiko.py3compat.builtins.memoryview.__contains__
paramiko.py3compat.builtins.memoryview.__iter__
paramiko.py3compat.builtins.memoryview.cast
paramiko.py3compat.builtins.object.__init__
paramiko.py3compat.builtins.property.__get__
paramiko.py3compat.builtins.quit
paramiko.py3compat.builtins.staticmethod.__get__
paramiko.py3compat.input
paramiko.py3compat.BytesIO.readlines
paramiko.py3compat.BytesIO.seek
paramiko.py3compat.StringIO.seek
paramiko.py3compat.StringIO.truncate
paramiko.sftp_server.SFTPServer.__init__
paramiko.transport.Transport.open_x11_channel
paramiko.transport.Transport.send_ignore
Expand Down
41 changes: 41 additions & 0 deletions stubs/requests/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ requests.Session.options
requests.Session.patch
requests.Session.post
requests.Session.put
requests.adapters.HTTPResponse.__init__
requests.adapters.PoolManager.connection_from_host
requests.adapters.PoolManager.connection_from_url
requests.adapters.PoolManager.urlopen
requests.adapters.Retry.is_forced_retry
requests.adapters.Retry.sleep
requests.api.delete
requests.api.get
requests.api.head
Expand All @@ -13,12 +19,28 @@ requests.api.patch
requests.api.post
requests.api.put
requests.api.request
requests.compat.OrderedDict.fromkeys
requests.compat.OrderedDict.setdefault
requests.delete
requests.get
requests.head
requests.models.RequestField.__init__
requests.models.RequestField.from_tuples
requests.options
requests.packages.VendorAlias
requests.packages.urllib3.HTTPConnectionPool.__init__
requests.packages.urllib3.HTTPConnectionPool.urlopen
requests.packages.urllib3.HTTPResponse.__init__
requests.packages.urllib3.HTTPSConnectionPool.__init__
requests.packages.urllib3.NullHandler
requests.packages.urllib3.PoolManager.connection_from_host
requests.packages.urllib3.PoolManager.connection_from_url
requests.packages.urllib3.PoolManager.urlopen
requests.packages.urllib3.ProxyManager.__init__
requests.packages.urllib3.ProxyManager.connection_from_host
requests.packages.urllib3.ProxyManager.urlopen
requests.packages.urllib3.Retry.is_forced_retry
requests.packages.urllib3.Retry.sleep
requests.packages.urllib3._collections.HTTPHeaderDict.from_httplib
requests.packages.urllib3._collections.HTTPHeaderDict.getlist
requests.packages.urllib3._collections.RLock
Expand All @@ -27,21 +49,36 @@ requests.packages.urllib3.connection.HTTPSConnection.__init__
requests.packages.urllib3.connection.VerifiedHTTPSConnection.__init__
requests.packages.urllib3.connection.VerifiedHTTPSConnection.set_cert
requests.packages.urllib3.connectionpool.ConnectionError
requests.packages.urllib3.connectionpool.HTTPConnection.request
requests.packages.urllib3.connectionpool.HTTPConnectionPool.__init__
requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen
requests.packages.urllib3.connectionpool.HTTPResponse.__init__
requests.packages.urllib3.connectionpool.HTTPSConnection.__init__
requests.packages.urllib3.connectionpool.HTTPSConnectionPool.__init__
requests.packages.urllib3.connectionpool.ProxyError.__init__
requests.packages.urllib3.connectionpool.RequestMethods.request_encode_url
requests.packages.urllib3.connectionpool.Retry.is_forced_retry
requests.packages.urllib3.connectionpool.Retry.sleep
requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection.__init__
requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection.set_cert
requests.packages.urllib3.exceptions.ProxyError.__init__
requests.packages.urllib3.fields.RequestField.__init__
requests.packages.urllib3.fields.RequestField.from_tuples
requests.packages.urllib3.filepost.RequestField.__init__
requests.packages.urllib3.filepost.RequestField.from_tuples
requests.packages.urllib3.poolmanager.PoolManager.connection_from_host
requests.packages.urllib3.poolmanager.PoolManager.connection_from_url
requests.packages.urllib3.poolmanager.PoolManager.urlopen
requests.packages.urllib3.poolmanager.ProxyManager.__init__
requests.packages.urllib3.poolmanager.ProxyManager.connection_from_host
requests.packages.urllib3.poolmanager.ProxyManager.urlopen
requests.packages.urllib3.request.RequestMethods.request_encode_url
requests.packages.urllib3.response.HTTPHeaderDict.from_httplib
requests.packages.urllib3.response.HTTPHeaderDict.getlist
requests.packages.urllib3.response.HTTPResponse.__init__
requests.packages.urllib3.response.PY3
requests.packages.urllib3.util.Retry.is_forced_retry
requests.packages.urllib3.util.Retry.sleep
requests.packages.urllib3.util.connection.poll
requests.packages.urllib3.util.connection.select
requests.packages.urllib3.util.retry.Retry.is_forced_retry
Expand All @@ -52,6 +89,8 @@ requests.patch
requests.post
requests.put
requests.request
requests.sessions.OrderedDict.fromkeys
requests.sessions.OrderedDict.setdefault
requests.sessions.Session.delete
requests.sessions.Session.get
requests.sessions.Session.head
Expand All @@ -62,3 +101,5 @@ requests.sessions.Session.put
requests.sessions.SessionRedirectMixin.resolve_redirects
requests.structures.LookupDict.__getattr__
requests.structures.LookupDict.get
requests.utils.OrderedDict.fromkeys
requests.utils.OrderedDict.setdefault
26 changes: 2 additions & 24 deletions stubs/waitress/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ waitress.channel.HTTPChannel.error_task_class
waitress.channel.HTTPChannel.parser_class
waitress.channel.HTTPChannel.request
waitress.channel.HTTPChannel.task_class
waitress.channel.wasyncore.compat.qualname
waitress.channel.wasyncore.compat.reraise
waitress.channel.wasyncore.compat.set_nonblocking
waitress.channel.wasyncore.compat.text_
waitress.channel.wasyncore.compat.tobytes
waitress.channel.wasyncore.compat.tostr
waitress.channel.wasyncore.compat.unquote_bytes_to_wsgi
waitress.channel.wasyncore.dispatcher_with_send.handle_write
waitress.compat.PY2
waitress.compat.PY3
waitress.compat.ResourceWarning
Expand All @@ -40,20 +32,6 @@ waitress.server.WSGIServer
waitress.task.ErrorTask.content_length
waitress.task.ThreadedTaskDispatcher.start_new_thread
waitress.task.WSGITask.content_length
waitress.trigger.wasyncore.compat.qualname
waitress.trigger.wasyncore.compat.reraise
waitress.trigger.wasyncore.compat.set_nonblocking
waitress.trigger.wasyncore.compat.text_
waitress.trigger.wasyncore.compat.tobytes
waitress.trigger.wasyncore.compat.tostr
waitress.trigger.wasyncore.compat.unquote_bytes_to_wsgi
waitress.trigger.wasyncore.dispatcher_with_send.handle_write
waitress.wasyncore.compat.qualname
waitress.wasyncore.compat.reraise
waitress.wasyncore.compat.set_nonblocking
waitress.wasyncore.compat.text_
waitress.wasyncore.compat.tobytes
waitress.wasyncore.compat.tostr
waitress.wasyncore.compat.unquote_bytes_to_wsgi
waitress.wasyncore.dispatcher_with_send.handle_write
waitress.rfc7230.BWS
waitress.wasyncore.map
waitress.wasyncore.dispatcher_with_send.handle_write
4 changes: 4 additions & 0 deletions tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ msvcrt
winreg
winsound

# Aliases for OSError
posix.error.characters_written
resource.error.characters_written

# NamedTuple like, but not actually NamedTuples (PyStructSequence)
posix.[a-z]+_(param|result)._(asdict|make|replace)

Expand Down
7 changes: 7 additions & 0 deletions tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ asyncio.futures.Future.__init__ # Usually initialized from c object
asyncio.futures.Future._callbacks # Usually initialized from c object
builtins.dict.get
contextvars.Context.__init__ # Default C __init__ signature is wrong
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
dataclasses.field
dataclasses.KW_ONLY
enum.Enum._generate_next_value_
Expand All @@ -40,6 +42,8 @@ functools.partialmethod.__get__
functools.singledispatchmethod.__call__
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
Expand Down Expand Up @@ -106,8 +110,11 @@ _collections_abc.Generator.send
_collections_abc.Generator.throw
contextvars.ContextVar.reset
contextvars.ContextVar.set
contextlib.AbstractAsyncContextManager.__aexit__
contextlib.AbstractContextManager.__exit__
io.IncrementalNewlineDecoder.setstate
typing.SupportsRound.__round__
types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences

# These enums derive from (str, Enum). See comment in py3_common.txt
pstats.SortKey.__new__
Expand Down
14 changes: 11 additions & 3 deletions tests/stubtest_allowlists/py36.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ typing.AsyncGenerator.ag_await
typing.AsyncGenerator.ag_code
typing.AsyncGenerator.ag_frame
typing.AsyncGenerator.ag_running
typing.ChainMap.fromkeys
typing.Coroutine.cr_await
typing.Coroutine.cr_code
typing.Coroutine.cr_frame
typing.Coroutine.cr_running
typing.Generator.__new__
typing.Generator.gi_code
typing.Generator.gi_frame
typing.Generator.gi_running
typing.Generator.gi_yieldfrom
typing.GenericMeta.__new__
typing.IO.closed # Incorrect definition in CPython, fixed in bpo-39493
typing.Mapping.get
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing.Sequence.index
typing.Text.maketrans
typing.runtime_checkable
typing\.\w+\.__new__
unittest._log # New in Python 3.9
unittest.async_case # Added in Python 3.8
uuid.UUID.int
Expand All @@ -72,6 +72,14 @@ tkinter.EventType.__new__

builtins.memoryview.__iter__ # C type that implements __getitem__
builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.dbapi2.Binary.__iter__ # C type that implements __getitem__
sqlite3.dbapi2.Binary.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.Binary.__iter__ # C type that implements __getitem__
sqlite3.Binary.cast # inspect.signature is incorrect about shape being kw-only

sqlite3.OptimizedUnicode.maketrans
sqlite3.dbapi2.OptimizedUnicode.maketrans

collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
Expand Down
9 changes: 9 additions & 0 deletions tests/stubtest_allowlists/py37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typing.NamedTuple._replace
typing._SpecialForm.__init__
typing._SpecialForm.__new__
typing.runtime_checkable
typing.Text.maketrans
unittest._log # New in Python 3.9
unittest.async_case # Added in Python 3.8
uuid.UUID.int
Expand All @@ -65,6 +66,14 @@ tkinter.EventType.__new__

builtins.memoryview.__iter__ # C type that implements __getitem__
builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.dbapi2.Binary.__iter__ # C type that implements __getitem__
sqlite3.dbapi2.Binary.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.Binary.__iter__ # C type that implements __getitem__
sqlite3.Binary.cast # inspect.signature is incorrect about shape being kw-only

sqlite3.OptimizedUnicode.maketrans
sqlite3.dbapi2.OptimizedUnicode.maketrans

collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
Expand Down
4 changes: 4 additions & 0 deletions tests/stubtest_allowlists/py38.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ tkinter.EventType.__new__

builtins.memoryview.__iter__ # C type that implements __getitem__
builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.dbapi2.Binary.__iter__ # C type that implements __getitem__
sqlite3.dbapi2.Binary.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.Binary.__iter__ # C type that implements __getitem__
sqlite3.Binary.cast # inspect.signature is incorrect about shape being kw-only
collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
Expand Down
8 changes: 8 additions & 0 deletions tests/stubtest_allowlists/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ collections.ItemsView.__reversed__
collections.KeysView.__reversed__
collections.ValuesView.__reversed__
contextvars.Context.__init__ # Default C __init__ signature is wrong
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
dataclasses.field
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
Expand All @@ -37,6 +39,8 @@ functools.partialmethod.__get__
functools.singledispatchmethod.__call__
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
Expand Down Expand Up @@ -94,6 +98,10 @@ tkinter.EventType.__new__

builtins.memoryview.__iter__ # C type that implements __getitem__
builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.dbapi2.Binary.__iter__ # C type that implements __getitem__
sqlite3.dbapi2.Binary.cast # inspect.signature is incorrect about shape being kw-only
sqlite3.Binary.__iter__ # C type that implements __getitem__
sqlite3.Binary.cast # inspect.signature is incorrect about shape being kw-only
collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
Expand Down
Loading