Dave Halter
ae9d4f4b21
Make builtins work
...
- Jedi cannot really deal with __new__.
- A typeshed issue: "function" should not be defined in the stubs.
- Jedi cannot deal with the weird __call__: NotImplemented typing,
because it's recursive.
2021-01-01 03:14:46 +01:00
fb753c4226
Loosen some types to avoid pain in real-life situations ( #4870 )
...
In this diff:
* Loosen `set.__[i]sub__()` to allow typical use cases (that work at runtime). Namely, allow removing `unicode` from a set of `str`, and allow removing optional values from non-optional sets.
* Avoid using union return types in `cryptography` deserialization functions.
* Tune `SupportsItems` so that `dict` implements it on Python 2.
Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com >
2020-12-29 18:31:14 +00:00
melassa and GitHub
1ae3158174
Pack ipadx ipady do not accept tuple ( #4869 )
...
Closes #4861
2020-12-29 15:26:08 +01:00
0a8fd098ca
ast: remove docstring attribute ( #4868 )
...
As mentioned in #4760
Co-authored-by: hauntsaninja <>
2020-12-29 08:43:15 +01:00
melassa and GitHub
350095e960
Add name field to tk widgets ( #4867 )
2020-12-28 21:59:27 +01:00
Nipunn Koorapati and GitHub
a0cc2f537d
Add __eq__ override to ScalarMap and MessageMap of google/protobuf/containers.pyi ( #4866 )
...
These classes are defined
https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/internal/containers.py
They actually inherit from a copy-pasta of the Mapping superclass which
includes an __eq__ override, but this is close enough. It prevents
strict equality checks between these and Dicts from failing
2020-12-28 13:12:53 +01:00
12f0be025f
mypy_primer: shard across two CI jobs ( #4865 )
...
Co-authored-by: hauntsaninja <>
2020-12-28 11:17:39 +01:00
Tom Most and GitHub
cf7606a33b
Add sys.getfilesystemencodeerrors from PEP 529 ( #4864 )
2020-12-28 09:07:22 +01:00
Nils K and GitHub
a3c9392331
Add overload to cast for objects ( #4851 )
...
Fixes #4810
2020-12-27 23:46:26 -08:00
Jon Dufresne and GitHub
2cb6b14834
Add type for distutils.command.install.SCHEME_KEYS ( #4863 )
2020-12-27 19:54:43 +01:00
melassa and GitHub
87278af3e5
Changed Dict with Mapping in grid/pack/place_configure #4836.2 ( #4859 )
...
Part of #4836
2020-12-27 12:34:28 +01:00
melassa and GitHub
be55392a87
Grid padx/pady accept tuple ( #4860 )
...
Closes : #4830
2020-12-27 12:32:59 +01:00
bc3ed283df
ctypes.wintypes can be imported on linux in 3.9.1 ( #4858 )
...
See https://bugs.python.org/issue16396
Co-authored-by: hauntsaninja <>
2020-12-26 16:01:23 +01:00
Akuli and GitHub
eb7381a3c1
use bool for tkinter.FALSE and its friends ( #4853 )
...
Fixes #4669
2020-12-25 16:07:55 +01:00
6dae28a017
Add missing attribute hints for click.types ( #4813 )
...
Co-authored-by: Maximilian Frank <maximilian.frank@ait.ac.at >
2020-12-23 15:55:43 +01:00
Nipunn Koorapati and GitHub
4f81ac10ae
Update mypy protobuf pin to include well_known_types ( #4850 )
2020-12-23 09:47:33 +01:00
Adam Kliś and GitHub
f27d7dea07
Fix typo in camellia algorithm name ( #4847 )
2020-12-22 15:04:44 +01:00
Timur Kushukov and GitHub
55ebc0b673
make itertools.product with repeat more precise ( #4843 )
2020-12-21 17:47:04 -08:00
472d830876
Fix well known types in protobuf stubs ( #4845 )
...
Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com >
2020-12-21 16:20:53 +00:00
32420769cd
Revert "Remove unused stubtest whitelist entries ( #4839 )" ( #4842 )
...
This reverts commit fcc2416d43 .
Co-authored-by: hauntsaninja <>
2020-12-19 23:24:35 -05:00
Jon Dufresne and GitHub
dc80863254
Update isort URL to new location: https://github.com/PyCQA/isort ( #4841 )
2020-12-19 22:15:09 -05:00
github-actions[bot] and GitHub
fcc2416d43
Remove unused stubtest whitelist entries ( #4839 )
2020-12-19 14:30:14 +01:00
Jelle Zijlstra and GitHub
3e9ed39bec
remove "Union[str, str]" ( #4838 )
...
I grepped and didn't find any other instances of redundant unions like this one.
2020-12-18 14:13:41 -06:00
alexander-held and GitHub
60e6a3560e
fix: support dictionaries as table headers ( #4835 )
...
Fixes #4829
2020-12-18 19:21:22 +01:00
53d7813b3c
Try fixing mypy-protobuf backwards incompatibility ( #4833 )
...
Currently, the only way forward would be to update `mypy` and `mypy-protobuf` at the same time, which causes pain. The imprecise fallback overloads can be removed later, I leave comments about this.
Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com >
2020-12-18 13:35:28 +00:00
Julien Danjou and GitHub
90eb34a8be
Add to_url() return type ( #4831 )
2020-12-18 11:44:38 +01:00
Ash Berlin-Taylor and GitHub
3e10b44bb4
copy.deepcopy memo type is Any, not input type ( #4828 )
2020-12-16 17:38:11 +01:00
Jon Dufresne and GitHub
3ae99d153b
Allow Python 2 unicode for some click interfaces ( #4825 )
...
Helps Python 2 code using:
form __future__ import unicode_literals
On Python 2, these interfaces are compatible with both str and unicode.
2020-12-15 20:51:43 +01:00
Jun Jia and GitHub
35d73ef277
type of argument_default should be Any ( #4811 )
2020-12-14 19:17:19 +01:00
Sebastian Rittau and GitHub
1c6ac09b82
Add EllipsisType, NoneType, and NotImplementedType (Python 3.10) ( #4822 )
2020-12-14 18:38:35 +01:00
cdce8p and GitHub
e5d3a47632
Add stubs for AsyncMock ( #4752 )
2020-12-14 18:32:14 +01:00
e035760d62
Return mypy_primer to CI ( #4806 )
...
Much of the comment script is based off of https://github.com/dawidd6/action-download-artifact
Co-authored-by: hauntsaninja <>
2020-12-14 18:31:30 +01:00
Jia Chen and GitHub
02b3a48313
Annotate load_entry_point() ( #4775 )
2020-12-14 17:20:40 +01:00
Mikhail Sveshnikov and GitHub
41faab1f51
Overload defaults type when allow_no_value==True ( #4774 )
...
Closes #4773
2020-12-14 17:16:52 +01:00
Sebastian Rittau and GitHub
c26b804055
Remove a missing import ( #4821 )
...
Works around #4815 , although a proper fix is needed.
2020-12-14 11:49:22 +01:00
Sam Bull and GitHub
8da53223d7
Fix pkg_resources.require() ( #4818 )
2020-12-14 09:34:18 +01:00
a93fa6120e
mypy_test: fix for stub deletions ( #4816 )
...
I think this should helps prevent issues like #4815
Co-authored-by: hauntsaninja <>
2020-12-13 23:41:20 -08:00
Guido van Rossum and GitHub
7aa5bd0029
Add PEP 612 support to typing_extensions stub ( #4814 )
2020-12-13 23:40:37 -08:00
Steve Dignam and GitHub
3d14016085
concurrent.futures: add _work_queue property to ThreadPoolExecutor ( #4808 )
...
`ThreadPoolExecutor` assigns a `queue.SimpleQueue` to `_work_queue` in
its `__init__` method.
https://github.com/python/cpython/blob/7cf0aad96d1d20f07d7f0e374885f327c2d5ff27/Lib/concurrent/futures/thread.py#L144
2020-12-09 19:23:19 -08:00
cb43535541
Add importlib.resources.files for Python 3.9 ( #4807 )
...
Co-authored-by: hauntsaninja <>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2020-12-09 13:47:45 +01:00
Rebecca Chen and GitHub
61c5667b3f
Fix a Python 2 annotation in shlex. ( #4805 )
...
https://github.com/python/cpython/blob/8d21aa21f2cbc6d50aab3f420bb23be1d081dac4/Lib/shlex.py#L24
suggests instream can be a string as well.
2020-12-07 14:27:56 -08:00
c4d8507ff7
Removed unused import symbols from stdlib stubs and fixed a few other errors detected by pyright. I did a similar pass several months ago; these were introduced since then. ( #4803 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-12-06 18:44:18 +01:00
3d8a29705e
DeleteJSONDecodeError from Python2's json module ( #4799 )
...
Co-authored-by: Phillip Huang <phillip@dropbox.com >
2020-12-02 13:24:22 -08:00
Ran Benita and GitHub
1958f3ec67
threading: properly export excepthook, ExceptHookArgs ( #4797 )
...
An `import X as Y` where X != Y no longer exports, so
27a45df479 caused them to be un-exported.
2020-12-02 14:58:52 +01:00
Pete Scopes and GitHub
906b4ec5ba
Cryptography 3.x pkcs12 ( #4792 )
2020-12-01 16:16:44 +01:00
Vasily Zakharov and GitHub
d252e4aae9
Some missing stubs for cryptography.x509 ( #4761 )
2020-11-30 12:43:59 +01:00
Philipp Hahn and GitHub
2b3aa94fb5
paramiko - A Python implementation of SSHv2 ( #4770 )
...
* paramiko - A Python implementation of SSHv2
Code: <https://github.com/paramiko/paramiko >
Doc: <http://docs.paramiko.org/en/stable/index.html >
2020-11-30 11:15:21 +01:00
74147313cd
Remove mypy_primer ( #4795 )
...
Co-authored-by: hauntsaninja <>
2020-11-29 23:03:42 -08:00
Jonathan Schoonhoven and GitHub
6d697e7f2c
fix redis str types ( #4783 )
2020-11-28 19:26:05 -08:00
Nipunn Koorapati and GitHub
9af49c0b69
Protobuf stubs update using mypy-protobuf ( #4785 )
...
* Add script to generate protoc stubs using mypy-protobuf generated stubs
* Use generate_proto_stubs to generate stubs for protobuf 3.14.0
* Skip _pb2.pyi from flake8,black,isort,pytype
2020-11-25 10:48:26 -08:00
Sam Bull and GitHub
04bfaf55f2
Keep typing information after functools.wraps() ( #4743 )
2020-11-25 08:57:33 -08:00
Marti Raudsepp and GitHub
4335fe9ef9
cryptography: Add common certificate extensions ( #4778 )
...
Added hints for following classes:
* AuthorityKeyIdentifier
* SubjectKeyIdentifier
* AuthorityInformationAccess
* SubjectInformationAccess
* BasicConstraints
* KeyUsage
* ExtendedKeyUsage
* UnrecognizedExtension
* AccessDescription (not extension itself, but used by
AuthorityInformationAccess, SubjectInformationAccess)
2020-11-25 08:56:27 -08:00
Julien Danjou and GitHub
adb43aacd5
fix(subprocess): make executable kwarg optional ( #4789 )
...
The default being `None`, it makes sense to declare it optional.
2020-11-24 18:37:58 -08:00
Marti Raudsepp and GitHub
5466117847
cryptography: Fix 'oid' field hints to ObjectIdentifier ( #4780 )
...
The `ExtensionOID` class is simply a namespace for constants, there are no instances of that class.
2020-11-24 18:08:47 -08:00
Daniel O'Neel and GitHub
bd69ad1292
Add ttl argument to redis client set operation ( #4788 )
2020-11-24 17:28:16 -08:00
Lourens Veen and GitHub
ee69dd4de7
Fix collections.Userstring.encode() ( #4787 )
...
* Revert Python 2 part of ba223399 , the stub was correct
* Describe UserString.encode() return type correctly for Python <3.8
2020-11-24 17:27:29 -08:00
Nate McMaster and GitHub
62546ed827
Add annotation for collections.ChainMap.__missing__(key) ( #4784 )
...
This method has been present in the CPython implementation since its introduction in 3.3.
https://github.com/python/cpython/blob/v3.3.0/Lib/collections/__init__.py\#L783
2020-11-23 08:32:22 +01:00
20446030c5
Fix stubtest unused cron job ( #4782 )
...
Co-authored-by: hauntsaninja <>
2020-11-21 19:36:27 +01:00
095464874a
Added partial type stubs for stdlib xml ( #4777 )
...
Added empty stubs for xml.dom.minidom.parse and xml.dom.minidom.parseString, and other modules under xml.dom
Co-authored-by: Stephanie Ding <sym@fb.com >
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com >
2020-11-20 19:02:35 -08:00
Lourens Veen and GitHub
ba223399a6
collections.UserString.encode() returns bytes ( #4781 )
2020-11-20 13:14:13 -08:00
Philipp Hahn and GitHub
d4bd95fd86
Fix hard-coded pytype version ( #4771 )
...
[tests/pytype_test.py](./tests/pytype_test.py#L176) is still using
Python `3.6`:
> python_version="2.7" if version == 2 else "3.6",
The test fails to run if `python3.6` is unavailable (for example on
Debian 10 Buster, which has 3.7).
According to (https://devguide.python.org/#status-of-python-branches
`3.6` is still maintained until end of 2021.
`pytype` itself [claims](https://github.com/google/pytype#requirements )
to run on `2.7`, `3.5`-`3.8`.
Change the script to use the version of Python from the invoking
interpreter.
2020-11-16 11:08:42 -08:00
Philipp Hahn and GitHub
8491755011
POlib: gettext portable / message objects ( #4772 )
2020-11-16 15:11:37 +01:00
Ran Benita and GitHub
27a45df479
threading: fix ExceptHookArgs being a function instead of a type ( #4768 )
...
The previous typing meant `threading.ExceptHookArgs` could not be used
to type a value.
The new typing follows what cpython does in the happy path (`_thread`
exists rather than the pure-python fallback being used).
Fixes #4767 .
2020-11-14 14:50:34 +01:00
Rebecca Chen and GitHub
8c20938ba1
Add an _Image protocol to tkinter. ( #4766 )
2020-11-13 20:59:29 +01:00
Rebecca Chen and GitHub
a42f545215
Change some tkinter function parameter types from bool to int. ( #4765 )
...
Change some tkinter function parameter types from bool to int.
Based on the fact that tk.{YES,NO,TRUE,FALSE} are defined as ints
and that the usage example in the source code also uses an int as a bool.
2020-11-13 11:34:39 +01:00
Anders Kaseorg and GitHub
536a5c6162
Fixes for markdown stubs ( #4758 )
...
* AbbrPreprocessor subclasses BlockProcessor
* Remove members inherited from base classes
* Add missing markdown.Extension alias
* Add missing Markdown members
* Fix Extension.config type
* Fix Pattern.handleMatch type
2020-11-13 11:25:01 +01:00
David Caro and GitHub
20a847218a
distutils.dist: add missing DistributionMetadata ( #4763 )
2020-11-12 15:17:10 +01:00
Julien Danjou and GitHub
6701e74fec
fix(typing): allow any object as first argument for get_type_hints ( #4744 )
...
get_type_hints works on more object
Fixes #4678
2020-11-12 11:36:48 +01:00
Dominic Davis-Foster and GitHub
2949a9289e
Annotate pathlib.Path methods as returning the same type even when subclassed. ( #4755 )
2020-11-11 10:19:35 -08:00
c3e04054cf
README.md: update for the times ( #4757 )
...
Fixes #4754
Co-authored-by: hauntsaninja <>
2020-11-10 20:52:57 +01:00
Stefano Chiodino and GitHub
ca45cb21a8
Update zipfile.pyi ( #4753 )
2020-11-10 12:01:06 +01:00
Raphael Geronimi and GitHub
b3abdc3cd7
Fix return type of asyncio.Queue.join ( #4751 )
...
Fixes #4750
2020-11-09 14:27:44 +01:00
0e4a92f0ad
Added stub for http.client.parse_headers ( #4749 )
...
Co-authored-by: Vasily Zakharov <v.zakharov@wwpass.com >
2020-11-08 12:25:33 +01:00
ee945af14d
Remove unused stubtest whitelist entries ( #4748 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-11-06 22:05:08 -08:00
Neel Somani and GitHub
2371df1a42
Update requests stubs with ReadTimeout exception ( #4747 )
2020-11-06 19:40:12 +01:00
Gal Ben David and GitHub
92911e3874
Add support for [b]zpopmin, [b]zpopmax ( #4742 )
2020-11-03 17:27:37 +01:00
27c16169f3
typing: remove __class_getitem__ from Protocols ( #4741 )
...
Co-authored-by: hauntsaninja <>
2020-11-03 08:13:43 +01:00
Sebastian Rittau and GitHub
d2a7889fe0
Drop support for Python 3.5 ( #4675 )
...
Python 3.5 EOL was on 2020-09-30.
2020-11-02 16:18:20 +01:00
Sam Bull and GitHub
57b86e0e71
Return Dict from copy(). ( #4510 )
2020-11-02 12:44:45 +01:00
Mikołaj Kuranowski and GitHub
40b44a9bf1
Add missing methods methods in aiofiles ( #4734 )
...
* fix aiofiles stubs
* switch io.BinaryIO to typing.BinaryIO
* swap typing.Literal to typing_extensions.Literal
* fix overload overlap in open function
* Fix filename generics
* add missing loop and executor arguments to aiofiles.open
* Remove generics from async files
* Fix async file-like read, readline and write signatures
2020-11-01 16:08:14 -08:00
Vincent Meurisse and GitHub
0e002f41ef
Add stub for pyrfc3339 ( #4564 )
2020-11-01 13:19:25 -08:00
Sebastian Rittau and GitHub
cdc4de1af4
Derive Reversible from Iterable ( #4622 )
...
Closes : #4615
2020-11-01 13:17:41 -08:00
Kaushal Rohit and GitHub
f7a236cfc0
Added precise types for ast Constants ( #4646 )
2020-11-01 13:16:04 -08:00
Sebastian Rittau and GitHub
8aa3346a9c
Remove some TODOs from IO classes ( #4654 )
...
At this point, it is too late to add methods to these semi-protocols as
it would break lots of existing code. Additionally, we are moving away
from these classes to finer-grained protocols anyway.
2020-11-01 13:11:19 -08:00
henribru and GitHub
fd6bb39f55
Update CodeGeneratorResponse ( #4680 )
...
Add Feature enum and supported_features.
These are related to the optional proto3 fields introduced in 3.12.0,
see https://github.com/protocolbuffers/protobuf/releases/tag/v3.12.0 and
https://github.com/protocolbuffers/protobuf/blob/214c77e1b76e63e512bd675d1c300c80438642b6/src/google/protobuf/compiler/plugin.proto#L112
2020-11-01 13:09:49 -08:00
Kaushal Rohit and GitHub
079584a020
Added missing regexes ( #4724 )
2020-11-01 12:56:02 -08:00
Shantanu and GitHub
65603f829f
xxlimited: add stubs ( #4736 )
2020-11-01 12:54:17 -08:00
620989bac5
typeshed: update stubtest version ( #4739 )
...
* typeshed: update stubtest version
Includes changes from https://github.com/python/mypy/pull/9680
I've already fixed all the true positives on typeshed.
* attempt to fix windows' _WarnFunction
Co-authored-by: hauntsaninja <>
2020-11-01 12:35:21 +01:00
ky-gog and GitHub
1ff92ddc25
Fix kw_defaults field type for ast.argument ( #4740 )
2020-10-31 21:48:32 -07:00
d379d4ce48
posix: fix WIF* definitions ( #4737 )
...
Co-authored-by: hauntsaninja <>
2020-10-31 18:36:34 -07:00
2702f8c32e
ctypes: fix argument names ( #4735 )
...
Co-authored-by: hauntsaninja <>
2020-10-31 18:34:25 -07:00
Jelle Zijlstra and GitHub
301325b55b
Make _GeneratorContextManager covariant ( #4733 )
...
Fixes #4732
2020-10-30 17:31:55 -07:00
c58a93b928
mypy_primer: speed up, clean up ( #4730 )
...
We use tee and no longer try to delete the file based on exit code,
since we use data.trim now.
mypy_primer started failing silently because of changes in aiohttp, so
now we'll fail if the exit codes are not 0 or 1.
Note mypy_primer has --project-date to get around the problem of
breaking changes in projects, but I want to try and keep mypy_primer up
to date / get a feel for how bad this problem actually is.
Co-authored-by: hauntsaninja <>
2020-10-30 09:16:11 +01:00
3f35c92e7f
concurrent.futures: use DoneAndNotDoneFutures ( #4729 )
...
Fixes #1976
Co-authored-by: hauntsaninja <>
2020-10-29 22:56:30 +01:00
Jason Fried and GitHub
f5a536b505
ContextVar.get() default has wrong type, it should mirror Mapping.get ( #4726 )
2020-10-29 13:40:55 -07:00
Vincent Barbaresi and GitHub
eb2fff7a92
update and complete pymysql.connections stubs to 0.10.1 ( #4702 )
...
Solves part of #4487 , other modules can still be updated
2020-10-29 10:39:58 +01:00
cptpcrd and GitHub
a386d767b5
Fix annotations for resource.prlimit() ( #4727 )
...
The current annotations specify the `limits` argument as an `Optional[Tuple[int, int]]`; this is incorrect. The real `resource.prlimit()` function does not accept `None` for the `limits` argument; it is only possible to avoid specifying new resource limits by omitting `limits` completely.
2020-10-28 20:15:53 -07:00
Sebastian Rittau and GitHub
c5aca0d533
Only add a mypy_primer comment if there is output ( #4725 )
2020-10-28 20:07:12 +01:00
96d7d77a04
mypy_test_suite: run a subset of tests ( #4723 )
...
Only a subset of mypy's test suite should be relevant to typeshed:
https://github.com/python/mypy/pull/9638
This should make things faster.
(Also the -n12 argument to pytest is weird; note mypy's pytest.ini
automatically specificies -nauto which is what we should want)
Resolves https://github.com/python/typeshed/issues/4333
Co-authored-by: hauntsaninja <>
2020-10-28 08:44:19 +01:00
Utsav and GitHub
75a92eb1c1
Added: None Overload ( #4722 )
2020-10-27 11:49:23 -07:00
Árni Már Jónsson and GitHub
e2a70235b4
Adding a stub for redis.Redis.client() ( #4720 )
...
Closes : #4721
2020-10-27 12:25:20 +01:00
Ethan Pronovost and GitHub
f81e479861
Annotate extension methods in protobuf message ( #4706 )
2020-10-27 09:14:48 +01:00
Sebastian Rittau and GitHub
4603728a15
Clean up files with former forced consistency ( #4717 )
...
Replace Text with str in Python 3 code
2020-10-27 07:52:35 +01:00
25b3004ad8
mypy_primer: post a more informative message ( #4719 )
...
Co-authored-by: hauntsaninja <>
2020-10-27 07:47:59 +01:00
fc171339ce
mypy_primer: attempt to fix workflow ( #4718 )
...
This will take some merge and debug...
Co-authored-by: hauntsaninja <>
2020-10-26 13:03:08 -07:00
Vincent Barbaresi and GitHub
c585d5d5cf
Update stubs for redis-py connection module ( #4692 )
2020-10-26 11:12:39 +01:00
1bd808a458
mypy_primer: post failures as comments ( #4672 )
...
Co-authored-by: hauntsaninja <>
2020-10-26 10:58:49 +01:00
8581da07fe
builtins: remove unused imports ( #4715 )
...
Co-authored-by: hauntsaninja <>
2020-10-26 08:06:34 +01:00
Vincent Barbaresi and GitHub
de98690e72
update math and gzip stubs for Python 3.8 ( #4710 )
...
I ran stubtest and spotted 2 things missing in 3.8 stdlib
- added BadGzipFile exception for gzip:
https://docs.python.org/3/library/gzip.html#gzip.BadGzipFile
- added math.perm() method:
https://docs.python.org/3/library/math.html#math.perm
2020-10-25 19:58:09 -07:00
1dd1b701c9
_typeshed: add SupportsLessThan, SupportsLessThanT ( #4711 )
...
And use it everywhere. Note there seemed to be a discrepancy between
heapq in Python 2 and 3, so I changed that. It should probably be more
widely used within heapq, but leaving that out of scope for this PR.
Co-authored-by: hauntsaninja <>
2020-10-25 15:04:43 -07:00
8d4a4f9e74
mypy_selftest: rename to mypy_self_check ( #4712 )
...
This better disambiguates it from mypy_test_suite and is more inline
with how mypy refers to it internally.
Co-authored-by: hauntsaninja <>
2020-10-25 21:31:43 +01:00
Vincent Barbaresi and GitHub
e61f1783fb
add undocumented _heapify_max to heapq stubs ( #4708 )
...
Closes #3926
_heapify_max() existed in Python2 already and hasn't changed in python3 (checked in 3.9)
2020-10-25 12:11:59 -07:00
48970d31de
tests / scripts: blacken and isort ( #4704 )
...
I often run black and isort in typeshed root and then have to undo these
changes.
Co-authored-by: hauntsaninja <>
2020-10-25 11:21:03 +01:00
2f1367332b
stubtest unused: match stubtest version, add fix ( #4705 )
...
In #4696 I bumped stubtest to a commit that hasn't been released. We
should have these stubtest versions match. In
https://github.com/python/mypy/pull/9426 I changed the output of
stubtest here; it's good to get this change in before I forget and this
action silently stops working.
Co-authored-by: hauntsaninja <>
2020-10-25 11:19:15 +01:00
Katelyn Gigante and GitHub
5dd444b2bf
Add missing attributes to Markdown stub ( #4707 )
2020-10-24 23:37:43 -07:00
0583738a41
Add a mypy self test ( #4337 )
...
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com >
Co-authored-by: hauntsaninja <>
2020-10-24 17:58:04 -07:00
Paul and GitHub
820cc11256
Provide types for ArgumentError members. ( #4700 )
2020-10-24 17:02:58 -07:00
Jukka Lehtosalo and GitHub
9134f7bc3c
Fix type of typed_ast.ast27.Str.s ( #4703 )
...
The original type was too narrow.
2020-10-25 01:39:51 +02:00
Vincent Barbaresi and GitHub
71e2cdcc68
update requests stubs with various missing methods ( #4691 )
2020-10-24 14:01:24 +02:00
3df3f6a1bc
Remove unused stubtest whitelist entries ( #4701 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-23 23:00:48 -07:00
Kaushal Rohit and GitHub
41f2c92dfe
Fixed stubs for protobuf symbol_database and message ( #4673 )
2020-10-23 22:51:42 +02:00
Ashwin Vishnu and GitHub
1efbc01d98
Update multiprocessing.pool: Function argument "iterable" has no default value ( #4698 )
2020-10-23 12:55:50 +02:00
Moriyoshi Koizumi and GitHub
bad9701849
Fix aiofiles type definitions ( #4650 )
2020-10-23 10:49:51 +02:00
Christine and GitHub
b76d9e46b8
redis: add acl stubs ( #4690 )
2020-10-23 09:50:18 +02:00
6ff5b88ca7
typeshed: remove crufty comments ( #4699 )
...
Co-authored-by: hauntsaninja <>
2020-10-23 09:40:06 +02:00
Sebastian Rittau and GitHub
3de732e188
Split distutils for Python 2 and 3 ( #4685 )
...
Addresses #4679 , but also starts addressing #4674 .
2020-10-22 19:24:17 -07:00
6f943d43ea
Added __class_getitem__ ( #4695 )
...
Resolves #4682
Co-authored-by: hauntsaninja <>
2020-10-22 14:05:04 -07:00
Sebastian Rittau and GitHub
5927e5ca30
Remove most consistency checks and split builtins.pyi into py2/3 files ( #4686 )
...
Split builtins.pyi in Python 2 and 3 versions
Partly addresses #4674
2020-10-22 13:39:06 -07:00
b0f4900c9f
fractions: make Fraction satisfy SupportsRound ( #4697 )
...
Helps with https://github.com/python/mypy/issues/9628
Co-authored-by: hauntsaninja <>
2020-10-22 12:12:27 -07:00
74bb849789
update stubtest ( #4696 )
...
Co-authored-by: hauntsaninja <>
2020-10-22 11:09:39 -07:00
faf827bc36
mark some positional-only arguments ( #4693 )
...
https://github.com/python/mypy/pull/9626 will make stubtest a little bit
stricter about positional-only arguments for dunders like __init__
Co-authored-by: hauntsaninja <>
2020-10-22 13:31:23 +02:00
Dominic Davis-Foster and GitHub
dcbeed5b5a
Add stub for readline.set_auto_history ( #4688 )
2020-10-20 14:27:07 -07:00
Kyle Fuller and GitHub
b16327fe7e
jinja2: Allow Sequence for Environment names ( #4677 )
2020-10-19 22:51:53 +02:00
10d3c6c325
Remove bad namedtuple to fix CI ( #4684 )
...
Co-authored-by: hauntsaninja <>
2020-10-18 00:25:09 -07:00
7603acd8b8
Upgrade flake8-pyi to fix CI ( #4683 )
...
This fixes things on Python 3.9, which we've started using since #4656
Co-authored-by: hauntsaninja <>
2020-10-17 23:43:00 -07:00
Christine and GitHub
9a8979ec51
update init stubs for Redis and redis Connection ( #4648 )
2020-10-15 18:09:02 +02:00
7e378a7554
PEP 584: add or operators to dict ( #4671 )
...
Co-authored-by: hauntsaninja <>
2020-10-15 13:42:01 +02:00
Kaushal Rohit and GitHub
b9dadee6d6
Tighten pyjwt types using cryptography stubs ( #4645 )
2020-10-15 13:32:54 +02:00
Kaushal Rohit and GitHub
83ffaa6ff5
Added Iterable of tuples support ( #4636 )
2020-10-14 21:29:31 +02:00
Julien Danjou and GitHub
f35e79fd24
fix(cachetools): fix decorators signature typing ( #4657 )
...
Fixes #4652
2020-10-14 17:38:30 +02:00
crusaderky and GitHub
58028a95eb
cachetools ttl should be float ( #4668 )
2020-10-14 17:31:18 +02:00
3a16ebb463
builtins: int can accept __trunc__-able ( #4665 )
...
Refer to https://docs.python.org/3/reference/datamodel.html#object.__trunc__
Fixes https://github.com/python/mypy/issues/9588
Co-authored-by: hauntsaninja <>
2020-10-14 09:47:47 +02:00
Mickaël Schoentgen and GitHub
67648a7dba
Allow None in value_name argument to winreg.SetValueEx() ( #4663 )
2020-10-13 23:26:11 +02:00
Kevin Wojniak and GitHub
a19abfd454
Undo int value for winreg SetValue ( #4664 )
2020-10-13 23:23:32 +02:00
Cebtenzzre and GitHub
58ee9c0ae5
termios: Fix type of tcgetattr and tcsetattr attributes ( #4662 )
...
Returning a union from tcgetattr forces the caller to use isinstance or
a type: ignore comment if they modify the returned list. Return
List[Any] instead.
The cc field has ints at cc[termios.VTIME] and cc[termios.VMIN] if
lflag & termios.ICANON is zero. Change _Attr to allow this.
Fixes #4661
2020-10-12 18:24:09 -07:00
86ca46fa0a
mypy_primer: add to CI ( #4629 )
...
Co-authored-by: hauntsaninja <>
2020-10-12 14:41:51 -07:00
Mariam Maarouf and GitHub
fae6bda3ae
Allow None in fp argument to HTTPError ( #4660 )
2020-10-12 11:45:48 -07:00
Mariam Maarouf and GitHub
1dc3880400
retry: loosen type for backoff, correct type for jitter ( #4659 )
2020-10-12 11:42:20 -07:00
Sebastian Rittau and GitHub
5b11606d16
CI: Update Python and mypy versions ( #4656 )
...
* Use 3.9 final instead of 3.9-dev
* Remove explicit Python versions from utility scripts
* Use mypy 0.390 for stubtests
2020-10-12 15:01:09 +02:00
Kevin Wojniak and GitHub
3d89b276d1
Accept int value for winreg SetValue(Ex) ( #4640 )
...
When the type is DWORD an integer is allowed as the value type.
Here is a 3.9 test in cpython as an example: https://github.com/python/cpython/blob/3.9/Lib/test/test_winreg.py#L339
2020-10-12 14:51:48 +02:00
Kaushal Rohit and GitHub
53367ae18e
Fixed return type for get_request ( #4649 )
...
Fixes #4647
2020-10-12 14:41:11 +02:00
Adam Dangoor and GitHub
b9c81fe2f0
Add some return type hints for methods of Werkzeug's EnvironBuilder c… ( #4653 )
2020-10-12 13:47:54 +02:00
Julien Danjou and GitHub
7a2398df18
fix(redis): add missing __enter__ and __exit__ methods on Redis ( #4655 )
2020-10-12 13:47:32 +02:00
Hynek Schlawack and GitHub
977179f2f0
markdown: no assumptions about ext cfg types ( #4651 )
...
`extension_configs` are by definition unpredictable and an example that
isn't str → str would be:
extension_configs={"codehilite": {"guess_lang": False}}
2020-10-12 12:58:58 +02:00
228f74d76a
io: loosen writelines type to iterable ( #4642 )
...
This came up in https://github.com/python/mypy/pull/9275
Co-authored-by: hauntsaninja <>
2020-10-09 21:25:33 -07:00
8a8ed3531e
Remove unused stubtest whitelist entries ( #4643 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-09 21:25:20 -07:00
Sebastian Rittau and GitHub
473044cf1f
Add information about removing third-party packages ( #4637 )
...
Closes : #4608
2020-10-09 16:27:56 +02:00
Rebecca Chen and GitHub
fff7a10ae7
Add a version guard for importing enum in pstats. ( #4635 )
...
* Add a version guard for importing enum.
I'm trying to pull the latest version of typeshed into Google, and
pytype chokes on pstats in Python 2 because the enum module was
introduced in 3.4.
* Move the enum import into the branch that defines SortKey.
2020-10-08 16:09:24 -07:00
Sebastian Rittau and GitHub
35f4ade96f
Replace bool.__init__() with __new__() ( #4614 )
...
Fixes #4612
2020-10-09 00:20:03 +02:00
Peter Law and GitHub
fa0ba1eda8
Add various undocumented functions from ftplib ( #4633 )
...
Fixes #4632
2020-10-08 22:20:48 +02:00
Kaushal Rohit and GitHub
36f2ffa07e
Added missing SysLogHandler types ( #4630 )
2020-10-07 19:02:54 -07:00
Ethan Pronovost and GitHub
d40551e000
Update protobuf ExtensionDict ( #4619 )
2020-10-07 16:18:51 +02:00
Kaushal Rohit and GitHub
021c219e6e
concurrent.futures.wait: use _Collection ( #4618 )
2020-10-06 17:48:40 -07:00
Oleg Höfling and GitHub
308b25f8dc
replace travis status badge with gh actions one ( #4628 )
2020-10-06 18:10:45 +02:00
Oleg Höfling and GitHub
bfa52e204f
loosen the wrapper type restriction in functools.update_wrapper ( #4627 )
2020-10-06 17:59:42 +02:00
Kaushal Rohit and GitHub
6d248e8485
Made all backends Optional ( #4625 )
...
- in accordance with changes in cryptography
Fixes #4561
2020-10-06 17:02:59 +02:00
coiax and GitHub
714135f91b
🐑 Add Redis unlink function to client stubs ( #4624 )
...
Resolves #4623
2020-10-06 13:44:10 +02:00
nicolas-harraudeau-sonarsource and GitHub
cc71b6a4ed
Fix "cgi.parse_qsl" return type ( #4621 )
...
Fixes #4620
2020-10-06 10:28:33 +02:00
Abraham Francis and GitHub
2b08852d19
add stub for dateutils.parser.ParserError ( #4616 )
2020-10-05 19:45:46 -07:00
Avery and GitHub
62cab2280f
Add missing requests exceptions and warnings ( #4617 )
2020-10-05 18:22:58 -07:00
Joseph Haaga and GitHub
562fdbd9df
allow request.get params values to be None ( #4611 )
2020-10-05 08:42:07 +02:00
e428f2d479
pep 484: last reexports ( #4609 )
...
Co-authored-by: hauntsaninja <>
2020-10-04 23:51:04 +02:00
723a23abfc
contextlib: get rid of a TODO ( #4610 )
...
This dates back three years to https://github.com/python/typeshed/pull/1249
It seems pretty unused in practice, so I think this is fine:
https://grep.app/search?q=from%20contextlib%20import%20ContextManager&case=true
https://grep.app/search?q=contextlib.ContextManager&case=true
Co-authored-by: hauntsaninja <>
2020-10-04 23:49:49 +02:00
cca6e53d86
crypto: delete stubs ( #4606 )
...
Crypto is a package that comes from pycrypto, which was last updated in
2013. It proudly supports Python 2.1 through 3.3.
There's a near drop-in replacement from pycryptodome, which seems well
maintained. pycryptodome has provided stubs for the last two years.
I propose we get rid of the whole thing. pycrypto seems about as dead as
software can get. These stubs have received two fixes since 2016.
https://github.com/python/typeshed/issues/2952
https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
https://github.com/Legrandin/pycryptodome/blob/master/Changelog.rst#371-25-november-2018
Co-authored-by: hauntsaninja <>
2020-10-04 13:05:47 -07:00
Andrew Mitchell and GitHub
d34a45daa9
sre parse_template allows byte sources ( #4604 )
...
Resolves #4331
2020-10-04 16:45:59 +02:00
Andrew Mitchell and GitHub
8a1be2197d
Add flask.testing.EnvironBuilder ( #4602 )
...
Resolves #4541
2020-10-04 16:18:43 +02:00
Kaushal Rohit and GitHub
434379859b
cryptography: Added backend types ( #4601 )
2020-10-04 14:45:00 +02:00
52974e0a2b
asyncio.Semaphore: type some internals ( #4605 )
...
Co-authored-by: hauntsaninja <>
2020-10-04 12:53:02 +02:00
7afc733054
pep 484: more reexports ( #4607 )
...
There are still a couple more, but hopefully this fixes CI. It's a
little bit of a chore to track down some of these; it looks like master
differs from latest release for a number of them.
Co-authored-by: hauntsaninja <>
2020-10-03 20:22:31 -07:00
e0a3644850
py39.txt: remove no longer needed comment ( #4603 )
...
See #4598
Co-authored-by: hauntsaninja <>
2020-10-03 13:56:56 -07:00
愚氓 and GitHub
a94eb4b64c
Fix type in FrameType.f_trace ( #4600 )
2020-10-03 13:34:31 -07:00
Kaushal Rohit and GitHub
6e7ac975b4
concurrent.futures.wait: changed Iterable to Sequence ( #4597 )
2020-10-02 22:51:14 -07:00
76cd654987
stubtest whitelist: fix ( #4599 )
...
This should take care of #4598
Co-authored-by: hauntsaninja <>
2020-10-02 21:38:59 -07:00
86b2aaf6ee
Remove unused stubtest whitelist entries ( #4598 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-02 21:27:08 -07:00
karl ding and GitHub
ce3c9e05c0
imaplib: Add new functions from Python 3.9 ( #4596 )
...
Add imaplib.IMAP4.unselect()
2020-10-02 19:58:24 -07:00
d140885898
statvfs_result: type structseq better ( #4587 )
...
Fixes #4572
Co-authored-by: hauntsaninja <>
2020-10-02 03:02:36 -07:00
Sebastian Rittau and GitHub
2157c4a448
Fix patch() used as decorator ( #4592 )
...
Closes : #4591
2020-10-02 09:05:25 +02:00
Andrew Mitchell and GitHub
8427e09424
ast.get_docstring: fix return type ( #4595 )
...
Resolves #4575
2020-10-01 18:48:09 -07:00
Sebastian Rittau and GitHub
bf5651e7a6
Use GitHub Actions to run mypy ( #4594 )
2020-10-01 14:42:31 -07:00
karl ding and GitHub
e8bcb14f09
tracemalloc: Add new functions from Python 3.9 ( #4593 )
...
Add tracemalloc.reset_peak()
2020-10-01 17:38:11 +02:00
karl ding and GitHub
9cbb2c7820
math: Add new functions from Python 3.9 ( #4590 )
...
Add support for new math functions added in Python 3.9:
- gcd
- lcm
- nextafter
- ulp
2020-10-01 10:54:41 +02:00
karl ding and GitHub
db29dd949c
gc: Add typing for gc.is_finalized() ( #4589 )
2020-09-30 21:25:19 -07:00
Shantanu and GitHub
8879858871
markdown: improve preprocessors type ( #4588 )
...
* markdown: improve preprocessors type
https://github.com/Python-Markdown/markdown/blob/b701c34ebd7b2d0eb319517b9a275ddf0c89608d/markdown/preprocessors.py#L46
* Apply suggestions from code review
2020-09-30 14:34:24 -07:00
e3889c776e
pep 484: explicit reexport as intended ( #4586 )
...
See discussion on typing-sig.
This doesn't take care of some third_party libraries, will follow up on
those.
Co-authored-by: hauntsaninja <>
2020-09-30 10:04:23 -07:00
Sebastian Rittau and GitHub
27dfbf68aa
Use __new__ instead of __init__ for some builtin classes ( #4555 )
...
Closes #4514 #2630 #2686
2020-09-30 00:00:06 -07:00
karl ding and GitHub
e3352c654d
fcntl: Add fcntl.F_OFD_XXXX constants ( #4585 )
...
Add support for the following open file description lock constants:
- F_OFD_GETLK
- F_OFD_SETLK
- F_OFD_SETLKW
2020-09-29 22:05:40 -07:00
PythonCoderAS and GitHub
353a65071b
Use Optional in random.pyi ( #4584 )
2020-09-26 23:41:17 -07:00
bf48bfd37c
retry: loosen delay to float ( #4583 )
...
Caught by mypy_primer:
paasta_tools/mesos/master.py:150: error: Argument "delay" to "retry" has incompatible type "float"; expected "int"
Co-authored-by: hauntsaninja <>
2020-09-27 07:51:18 +02:00
Shantanu and GitHub
076983eec4
PathLike: make runtime_checkable ( #4582 )
...
I made PathLike a protocol in #4447 , but it should also be
runtime_checkable.
Caught by mypy_primer:
src/werkzeug/utils.py:646: error: Only @runtime_checkable protocols can be used with instance and class checks
2020-09-27 07:50:56 +02:00
734d91f90b
update-stubtest-whitelist: fix type errors ( #4581 )
...
Co-authored-by: hauntsaninja <>
2020-09-26 07:33:57 +02:00
Shantanu and GitHub
d6d2249edc
builtins: rename _LT ( #4579 )
...
Having an obscure type variable name is causing some pretty inscrutable
errors. For instance:
```
xarray/core/utils.py:466: error: Value of type variable "_LT" of "sorted" cannot be "K"
tornado/simple_httpclient.py:324: error: Value of type variable "_LT" of "min" cannot be "Optional[float]"
```
I think having a more descriptive type variable name here is better for
user experience and helps address the "why" of an error.
2020-09-26 07:33:26 +02:00
Unrud and GitHub
c5cc223313
Fix typo in constant name EAI_ADDRFAMILY ( #4577 )
2020-09-25 14:17:08 -07:00
12e82874d2
upgrade isort ( #4576 )
...
Co-authored-by: hauntsaninja <>
2020-09-25 13:57:15 -07:00
cb6549fa8f
markdown: add more stubs ( #4574 )
...
Co-authored-by: hauntsaninja <>
2020-09-25 22:29:21 +02:00
Sténio Jacinto and GitHub
675ab77538
Add missing methods in urllib.request ( #4571 )
2020-09-25 00:28:30 -07:00
Jake Bailey and GitHub
de70d0199d
Fix distutils.log function signatures ( #4573 )
2020-09-24 17:27:50 -07:00
Sebastian Rittau and GitHub
0cd7dd7009
Fix _patch.__call__() ( #4568 )
...
_patch.call() reused the type variable _T, which is generic over
_patch. It was meant to use a separate type variable for the argument,
which is returned.
Fixes #4566
2020-09-23 14:35:19 -07:00
Shantanu and GitHub
b33896bcbc
asyncio.run: fix type of debug ( #4567 )
2020-09-22 10:43:35 +02:00
Sebastian Rittau and GitHub
3d3dee91a3
Use overloads for Redis.sort() ( #4551 )
2020-09-21 20:54:46 +02:00
Sebastian Rittau and GitHub
fae202e2a9
Run pytype and mypy self test using GitHub Actions ( #4565 )
2020-09-21 16:07:08 +02:00
Rajiv Bakulesh Shah and GitHub
3f53989529
Add more stubs for redis-py ( #4557 )
2020-09-21 15:38:59 +02:00
Sebastian Rittau and GitHub
f14d6eaa89
Improve unittest.mock.patch() types ( #4277 )
2020-09-21 15:26:39 +02:00
Adam Dangoor and GitHub
ec62f5f772
Allow Flask.Response.default_mimetype to be None ( #4563 )
2020-09-21 14:36:05 +02:00
turettn and GitHub
f1929d9e5a
cachetools: fix caching decorators return type ( #4556 )
2020-09-21 14:15:29 +02:00
c41f3e9bf9
Define NoneType class in _typeshed
...
Type checkers can use this to handle protocol matching for None (e.g. `foo: Hashable = None`).
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-09-20 15:42:23 -07:00
Sebastian Rittau and GitHub
5d467a7756
Add more constants and attributes to posix ( #4552 )
...
The constants were found by running dir(posix) on a Debian 10.5 (x86_64)
system.
Resolves #616 .
2020-09-19 23:19:36 -07:00
Sebastian Rittau and GitHub
9a6b500909
Add various missing undocumented functions ( #4554 )
...
Mostly addresses #2149
2020-09-19 22:59:35 -07:00
4876b55382
Remove unused stubtest whitelist entries ( #4560 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-19 11:32:32 +02:00
Sebastian Rittau and GitHub
fe69ffcb0f
Add a few missing stdlib modules ( #4550 )
2020-09-18 11:28:25 -04:00
Sebastian Rittau and GitHub
4e88557666
Complete msvcrt ( #4548 )
2020-09-18 09:20:26 -04:00
Sebastian Rittau and GitHub
4e2e02b266
Fix cls argument name of CodecInfo.__new__() ( #4549 )
2020-09-17 12:04:54 -07:00
proost and GitHub
b1865639c2
set difference strictly ( #3886 )
...
Fixes #1840
2020-09-17 17:49:07 +02:00
Rajiv Bakulesh Shah and GitHub
98667b18c2
Add more stubs for redis-py ( #4480 )
2020-09-17 16:25:16 +02:00
Jonathan Slenders and GitHub
822e427693
Added annotations for msvcrt.getch. ( #4547 )
2020-09-17 10:55:44 +02:00
Rebecca Chen and GitHub
9dbe7f348f
Update pytype to a version that can parse six. ( #4546 )
2020-09-17 05:46:27 +02:00
8642d2aa97
pkgutil, sys: make types more precise ( #4536 )
...
Co-authored-by: hauntsaninja <>
2020-09-16 10:38:27 +02:00
Cebtenzzre and GitHub
1334840323
Make os.fchdir, os.fsync, and os.fdatasync accept FileDescriptorLike ( #4544 )
...
For the fd passed to these functions, CPython accepts not just an int,
but also anything with a fileno() method.
Fixes #4539
2020-09-15 16:30:34 -07:00
Nikolaus Waxweiler and GitHub
d402f55334
load*: Return Any instead of Dict-types ( #4543 )
...
A plist file can contain more object types than dictionaries.
2020-09-15 16:29:59 -07:00
Omar Sandoval and GitHub
7409af9f79
Add SupportsIndex stub to typing_extensions ( #4442 )
...
This was added to typing_extensions in python/typing#724 .
2020-09-15 21:14:00 +02:00
Sebastian Rittau and GitHub
d4191de79f
Upgrade pytype ( #4540 )
...
The latest version recognizes the @runtime_checkable
decorator, required for #4442 .
2020-09-15 12:51:22 +02:00
Hugues and GitHub
81d067618c
protobuf: add serialized_options kwarg ( #4531 )
2020-09-14 12:59:22 +02:00
Yuri Khan and GitHub
87b758b0da
Relax type of xml.etree.ElementTree.XMLParser target argument ( #4538 )
...
The target argument can be an arbitrary object.
If it has certain methods, they are used by XMLParser,
missing methods are ignored.
Ideally, we'd be able to type the potentially missing
methods correctly, but currently the type system is
unable to do so.
Fixes #4537
2020-09-14 12:50:12 +02:00
dc0b4262c3
builtins: minor improvements ( #4535 )
...
Co-authored-by: hauntsaninja <>
2020-09-13 18:08:48 +02:00
0f69275ce4
Remove unused stubtest whitelist entries ( #4534 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-11 21:48:34 -07:00
kylec1 and GitHub
59586848c9
yaml: Update load methods to use Text rather than str ( #4533 )
...
Yaml loading accepts bytes and unicode, either directly or via IO.
For python 3, bytes and str work fine, but for Python 2 code this is redundant and limited.
Text instead of str should make type checks more accurate.
2020-09-11 18:37:05 -07:00
Steve Dignam and GitHub
b388662302
gc: add freeze, unfreeze, get_freeze_count ( #4532 )
...
These were introduced in Python 3.7
https://docs.python.org/3/library/gc.html
2020-09-11 23:17:31 +02:00
462c830194
codecs: various fixes ( #4526 )
...
Co-authored-by: hauntsaninja <>
2020-09-11 14:09:33 -07:00
Sebastian Rittau and GitHub
bfec448860
Use GH Actions for linters ( #4528 )
2020-09-11 12:05:53 -07:00
Lam Son Ho and GitHub
04f7d7a2fd
add stubs for frozendict ( #4522 )
2020-09-11 10:36:57 +02:00
861d6425b4
io: various fixes ( #4525 )
...
Co-authored-by: hauntsaninja <>
2020-09-11 08:30:03 +02:00
Adam Lichtl and GitHub
1bc7689cbc
Add type hints for pstats.SortKey available in Python >= 3.7 ( #4523 )
2020-09-10 22:34:43 -07:00
Sergei Lebedev and GitHub
6bf894bb82
Made contextvars import in asyncio.base_futures conditional ( #4524 )
...
contextvars are only available in 3.7+.
2020-09-10 13:44:21 -07:00
Changsheng and GitHub
d1923d153a
Mark the return type of signal._HANDLER Any instead of None ( #4518 )
...
Closes #4517
2020-09-09 09:45:39 -07:00
jack1142 and GitHub
28a88adf0b
Update emoji stubs ( #4516 )
2020-09-08 20:24:32 +02:00
2330083732
stubtest: fix whitelists ( #4513 )
...
Downstream of the reintroduction of py39 to CI / running the unused whitelist entry flow in #4512
Co-authored-by: hauntsaninja <>
2020-09-05 01:10:52 -07:00
6f475bfc35
Remove unused stubtest whitelist entries ( #4512 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-05 00:49:31 -07:00
Jake Bailey and GitHub
f0bbc3bf2d
Add special case for integers raised to a power of 2 ( #4473 )
2020-09-04 21:05:45 -07:00
Sam Bull and GitHub
ea52d0b0a0
Fix werkzeug set_cookie(). ( #4509 )
2020-09-01 09:08:07 -07:00
ccfc1850e9
platform: update for py39 ( #4506 )
...
platform.DEVNULL seemed undocumented, but is eg, still mentioned in the
header comment of platform.py. So feels surprising this was removed
without much warning.
Co-authored-by: hauntsaninja <>
2020-08-31 15:28:37 -07:00
Shantanu and GitHub
2d476d091b
hmac: minor improvements ( #4500 )
2020-08-31 15:24:45 -07:00
5884ee2977
inspect: minor improvements ( #4499 )
...
Co-authored-by: hauntsaninja <>
2020-08-31 14:23:01 -07:00
c8c62b32ac
socket: fix platform availability ( #4507 )
...
also fix another CI merge race issue
Co-authored-by: hauntsaninja <>
2020-08-31 14:20:46 -07:00
e9becf1da6
py39: enable in CI ( #4494 )
...
Github Actions now supports prerelease builds
https://github.com/actions/setup-python/issues/20
Co-authored-by: hauntsaninja <>
2020-08-31 22:05:57 +02:00
48c8939ce6
concurrent.futures: update for py39, minor fixes ( #4503 )
...
Note the new parameter doesn't actually exist on the base class, even
though it's documented as that being the case. Asked about it in https://bugs.python.org/issue39349
Co-authored-by: hauntsaninja <>
2020-08-31 22:04:49 +02:00
Shantanu and GitHub
846e858bdc
socket: add send_fds, recv_fds ( #4501 )
2020-08-31 22:03:30 +02:00
Nils K and GitHub
802c8fbea4
Add missing default_section to RawConfigParser ( #4505 )
2020-08-31 14:55:30 +02:00
Shantanu and GitHub
fdd01b0036
os._AddedDllDirectory: add __init__ ( #4498 )
2020-08-31 11:52:28 +02:00
Jérome Perrin and GitHub
26ca4e75d8
subprocess: make env accept None also on python2 ( #4504 )
...
This was made for python3 in https://github.com/python/typeshed/pull/1291 but
this is also the case on python2
2020-08-30 20:58:20 -07:00
github-actions[bot] and GitHub
4795ab21ca
Remove unused stubtest whitelist entries ( #4497 )
2020-08-30 12:51:30 -07:00
d07e65c53e
weakref: small improvements ( #4495 )
...
Co-authored-by: hauntsaninja <>
2020-08-30 06:43:58 -07:00
ad5bc751f3
xml.etree.ElementTree: mark some removals ( #4496 )
...
Co-authored-by: hauntsaninja <>
2020-08-30 06:41:50 -07:00
193c7cb932
asyncio.tasks: update for py39 removals ( #4493 )
...
Co-authored-by: hauntsaninja <>
2020-08-29 22:07:20 -07:00
48c922e54a
functools: use protocol for cmp_to_key return type ( #4492 )
...
Co-authored-by: hauntsaninja <>
2020-08-29 17:25:11 -07:00
Eric Traut and GitHub
bbd8c96e34
Added some missing types from various stdlib stubs ( #4466 )
2020-08-29 16:45:36 -07:00
Sebastian Rittau and GitHub
3c20675813
Remove pytest_mock ( #4478 )
...
pytest-mock is now type annotated, which makes typeshed's annotations
obsolete. See pytest-dev/pytest-mock#152 .
2020-08-29 14:47:34 -07:00
Jukka Lehtosalo and GitHub
5be9c91518
freezegun: Fix __exit__ and remove union return types ( #4491 )
...
These caused false positives, for example in code like this:
```
with freeze_time(None) as ft: # False positive here
ft.tick(3) # False positive here
```
2020-08-28 16:50:05 +01:00
Jukka Lehtosalo and GitHub
3e966524b7
Add back six.moves.cStringIO (Python 3) ( #4490 )
...
This was accidentally removed in #4287 .
2020-08-28 16:49:56 +01:00
Eric Traut and GitHub
f15db8950e
Added missing "math.comb" function, introduced in Python 3.8. ( #4489 )
2020-08-28 08:39:24 -07:00
Rebecca Chen and GitHub
2587c93ff8
Stop passing python_exe to pytype_test. ( #4488 )
...
pytype hasn't needed the python_exe argument for a while, and getting
rid of it allows some code to be deleted.
2020-08-27 19:19:49 -07:00
MapleCCC and GitHub
cfe832b907
Fix type annotation of ast.NodeTransformer.generic_visit(). It always returns an ast.ASt object. ( #4483 )
2020-08-26 10:24:17 -07:00
Jelle Zijlstra and GitHub
5f9fd3d127
upgrade black version ( #4486 )
...
Manually removed a number of trailing commas to prevent black from unnecessarily
exploding some collections.
2020-08-26 18:36:01 +02:00
Akuli and GitHub
e3e395b28c
fix assigning to tkinter.Tk().report_callback_exception ( #4484 )
2020-08-26 13:56:07 +02:00
Akuli and GitHub
27e0ea0199
use Any for ignored callback return types in tkinter ( #4485 )
2020-08-26 13:54:44 +02:00
Akuli and GitHub
910ecd1f56
add types to tkinter after methods ( #4479 )
2020-08-26 12:06:40 +02:00
Cerek Hillen and GitHub
142aed3838
type annotation for Timestamp and Duration ( #4471 )
2020-08-25 23:29:34 -07:00
Jukka Lehtosalo and GitHub
ab0f5519a9
Add back six.moves.range (Python 3) ( #4481 )
...
This was accidentally removed in #4287 .
2020-08-25 16:42:15 +01:00
Akuli and GitHub
770fe90b0b
add types to tkinter.Text methods ( #4460 )
2020-08-24 13:09:07 +02:00
Akuli and GitHub
ff35f99d44
fix tkinter config methods ( #4459 )
2020-08-24 13:06:36 +02:00
Akuli and GitHub
c065982b7a
support anything with .keys() and __getitem__ in dict.__init__ ( #4470 )
2020-08-24 13:03:38 +02:00
Akuli and GitHub
39ddef28bf
make tkinter.font.Font behave similarly to tkinter widgets ( #4469 )
2020-08-24 13:00:20 +02:00
Guido van Rossum
351a971b1d
Add token.EXACT_TOKEN_TYPES for 3.8+
2020-08-23 15:42:01 -07:00
Mario Ishac and GitHub
4bbe161479
Made methodcaller's name argument positional ( #4476 )
2020-08-22 15:13:02 -07:00
David Hotham and GitHub
8bb80c4cb7
pyVmomi stubs are incomplete ( #4474 )
2020-08-22 11:13:09 -07:00
Shantanu and GitHub
723fcb368a
pathlib.Path.open: bring on the overloads ( #4407 )
2020-08-21 20:36:43 -07:00
189bdfb279
Added support for PEP613 (TypeAlias) in typing.pyi ( #4472 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-20 20:45:04 -07:00
8cbf009bb7
Added some missing type annotations within third-party stub files ( #4467 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-21 00:51:15 +02:00
Akuli and GitHub
7d1abc962d
fix master attributes ( #4468 )
2020-08-20 11:55:49 +02:00
Nils K and GitHub
0ce16647d8
Added additional attributes to re.error ( #4463 )
...
https://docs.python.org/3/library/re.html#re.error
These were added in Python 3.5
2020-08-19 11:32:53 -07:00
Dan Palmer and GitHub
f093466ad6
Add Cookie.path_specified ( #4464 )
2020-08-19 19:48:16 +02:00
Eric Traut and GitHub
52e18e856c
Added stubs for aiofiles package ( #4421 )
2020-08-19 08:33:33 -07:00
Akuli and GitHub
6a06ff53f0
make canvas offset option optional ( #4458 )
2020-08-18 16:50:09 +02:00
James Weaver and GitHub
512c154638
Make AbstractEventLoop.run_in_executor return an Awaitable, instead of being a coroutine ( #4457 )
...
Closes : #3999
2020-08-18 12:17:31 +02:00
Rebecca Chen and GitHub
61537be530
Upgrade the pytype version to one that can parse the tkinter stubs. ( #4456 )
...
The latest pytype release fixes two pyi parser bugs that allow files
affected by them to be taken off the pytype exclude list. I removed two
`total=False` declarations in tkinter/__init__ that pytype does not like
(because it checks that `total` is present only when TypedDict is a
class's immediate parent) and which shouldn't be needed because
_InMiscNonTotal already specifies totality. I double-checked that mypy
reports no errors in 3.7 on a .py file containing:
from typing_extensions import TypedDict
Foo = TypedDict('Foo', {'x': int}, total=False)
class Bar(Foo): pass
x: Foo = {}
showing that it doesn't require `total` to be repeated.
2020-08-17 19:49:58 -07:00
f23ce60668
stubtest: fix on windows ( #4455 )
...
Co-authored-by: Akuli
2020-08-17 14:55:58 -07:00
Akuli and GitHub
e9ecea0033
Add options to tkinter widgets ( #4363 )
...
In tkinter, `widget['foo'] = bar` and `widget.config(foo=bar)` do the same thing, but they will now type-check differently: the `widget['foo'] = bar` syntax allows 'foo' to be any string (e.g. a variable, not necessarily a Literal) and bar to be any object, while `widget.config(foo=bar)` checks the existence of the option and the type of bar. Similarly, cget takes a Literal argument but __getitem__ takes a string.
Testing script can still be found at https://github.com/python/typeshed/pull/4363/commits/c42a72c53e552ab501455def07017181f0158e80
2020-08-17 13:59:51 -07:00
f20c565eb3
Added support in typing.pyi for PEP 612 (ParamSpec and Concatenate) ( #4446 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-17 13:49:58 -07:00
Akuli and GitHub
e1c4d2a713
more permissive type for tkinter fonts ( #4453 )
2020-08-17 15:52:16 +02:00
Akuli and GitHub
0ebe4c2b65
fix eval and call return types ( #4451 )
2020-08-16 12:30:04 -07:00
b438ccc3bc
PathLike: change to Protocol ( #4447 )
...
Co-authored-by: hauntsaninja <>
2020-08-16 05:15:51 -07:00
3be7918eb2
deprecated: support use as decorator ( #4449 )
...
As opposed to just a decorator factory
Co-authored-by: hauntsaninja <>
2020-08-15 21:25:13 -07:00
e2d335b6ef
Contributed stubs for "retry" package ( #4428 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
Co-authored-by: hauntsaninja <>
2020-08-15 18:29:15 -07:00
002a444dff
Added missing type annotations for fractions and numbers modules. ( #4401 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-15 18:28:14 -07:00
Selim Belhaouane and GitHub
8059ea72f8
Fix type for path in ZipFile.extract ( #4445 )
2020-08-14 15:15:43 -07:00
Christopher Schramm and GitHub
fddc78293a
Extend function pointer type returned by CDLL ( #4444 )
...
CDLL.__getattr__ and __getitem__ return function pointers that have a __name__ attribute set, so "CDLL(lib).fun.__name__" is valid code but currently not covered.
2020-08-13 17:35:36 +02:00
Rebecca Chen and GitHub
f9acd5aa3b
Mark http.server.SimpleHTTPRequestHandler's directory arg as optional. ( #4443 )
...
`directory` has a default value:
https://docs.python.org/3/library/http.server.html#http.server.SimpleHTTPRequestHandler .
2020-08-12 17:59:00 -07:00
Toru Ogawa and GitHub
7643f1e16c
Add unsafe_ functions to yaml ( #4440 )
...
Close #4439
2020-08-12 15:25:26 +02:00
Sebastian Kreft and GitHub
3bd5471744
fix: add get_origin to typing_extensions ( #4438 )
...
Fixes #4430
2020-08-11 13:45:54 -07:00
Jukka Lehtosalo and GitHub
276d0428b9
Avoid false positivies from urlparse (Python 2) ( #4437 )
...
PR #3887 changed some `str` types to `Union[str, unicode]`. The `str`
types were too narrow, but the new types are too general, resulting in
around 80 false positives in a Dropbox internal repository.
I think that it's better to narrow down the types back some to avoid
the false positives, as these are commonly used functions.
Test cases:
```
from urlparse import urlunparse, urlunsplit, urljoin, urlparse, urlsplit
reveal_type(urlunparse(('1', '2', '3', '4', '5', '6'))) # str
reveal_type(urlunparse(['1', '2', '3', '4', '5', '6'])) # str
reveal_type(urlunparse((u'1', '2', '3', '4', '5', '6'))) # unicode
reveal_type(urlunparse([u'1', '2', '3', '4', '5', '6'])) # unicode
reveal_type(urlunsplit(('1', '2', '3', '4', '5'))) # str
reveal_type(urlunsplit(['1', '2', '3', '4', '5'])) # str
reveal_type(urlunsplit((u'1', '2', '3', '4', '5'))) # unicode
reveal_type(urlunsplit([u'1', '2', '3', '4', '5'])) # unicode
reveal_type(urljoin('x', 'y')) # str
reveal_type(urljoin(u'x', 'y')) # unicode
reveal_type(urljoin('x', u'y')) # unicode
reveal_type(urlparse('x').path) # str
reveal_type(urlparse(u'x').path) # str
reveal_type(urlparse(u'x').username) # Optional[str]
reveal_type(urlsplit('x').path) # str
reveal_type(urlsplit(u'x').path) # str
```
2020-08-11 13:03:06 +01:00
Ian Woloschin and GitHub
5c049cd136
Add __name__ & __qualname__ to Coroutine ( #4404 )
2020-08-10 20:44:14 -07:00
0ee7b26ce1
Contributed stubs for slugify package ( #4429 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com >
2020-08-10 13:34:47 -07:00
9a4df32d86
Contributed stubs for cachetools package ( #4422 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
Co-authored-by: hauntsaninja <>
2020-08-10 13:34:22 -07:00
224da619f5
Contributed stubs for markdown package ( #4426 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
Co-authored-by: hauntsaninja <>
2020-08-10 13:33:31 -07:00
cac35d0631
Contributed stubs for freezegun package ( #4425 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-10 13:33:09 -07:00
4b9de7752e
Contributed stubs for filelock package ( #4424 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-10 13:32:51 -07:00
03a333871a
Added stubs for deprecated package ( #4423 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-10 13:32:35 -07:00
Jukka Lehtosalo and GitHub
866b0c3bf0
ConfigParser: accept readline() that takes no arguments ( #4433 )
...
At runtime readline() is called without arguments, so requiring
an optional argument may result in false positives.
2020-08-10 15:55:32 +01:00
Jukka Lehtosalo and GitHub
0cd2350595
Add back md5.md5 ( #4432 )
...
This was accidentally removed in #4287 .
2020-08-10 12:52:13 +01:00
f46fb7ff59
Added some missing type annotations in stdlib stubs. ( #4418 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-08 20:49:37 +02:00
030e5ad1dd
Added missing type annotations for itsdangerous. ( #4416 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-08 20:48:22 +02:00
Akuli and GitHub
954ce8c703
create _tkinter stub ( #4372 )
2020-08-08 14:14:52 +02:00
adcd691d93
Added missing type annotations in gflags.pyi; removed some functions and methods that no longer exist in the library. ( #4417 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-08 11:34:46 +02:00
2fa7a8d8c3
Added missing type annotations for mock.pyi. ( #4415 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-08 11:33:01 +02:00
e4b48edbba
Fix a couple of type name collisions ( #4419 )
...
PEP 484 indicates that all type annotations within a stub file are supposed to be considered forward references even if they are not quoted. This means a type checker needs to use scope-based symbol resolution without regard for code flow order. Lookups will find same-named symbols within the same scope even if they are declared after the type annotation. This change fixes a couple of cases where this occurs and confuses pyright.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-08 11:29:23 +02:00
17db12866b
Remove unused stubtest whitelist entries ( #4420 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-07 22:54:07 -07:00
Jukka Lehtosalo and GitHub
199b262f63
Add back six.moves.urllib.parse.unquote (Python 2) ( #4414 )
...
This was accidentally removed in #4287 .
2020-08-07 17:56:54 +01:00
Jukka Lehtosalo and GitHub
57a1a3937a
Add back six.StringIO (Python 2) ( #4413 )
...
This was accidentally removed in #4287 .
2020-08-07 17:41:48 +01:00
7c444365f2
Add back six.moves.range (Python 2) ( #4411 )
...
This was accidentally removed in #4287 .
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-08-07 17:20:34 +01:00
Jukka Lehtosalo and GitHub
29c71ff52a
Add back tornado stubs for Python 2 only ( #4412 )
...
Tornado ships with inline annotations, but it no longer is Python 2
compatible. I think that it makes sense to keep the legacy stubs for
Python 2 compatibility, at least for a while longer.
This restores stubs removed in #4321 , but moves them to
`third_party/2`.
2020-08-07 08:54:57 -07:00
Sebastian Rittau and GitHub
4233008b4a
TypeVar(bound) accepts strings for forward references ( #4410 )
2020-08-07 08:31:31 -07:00
439ea4bd8b
Added missing import for case.pyi ( #4403 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-06 19:51:52 -07:00
Anders Kaseorg and GitHub
bb685daad1
Update orjson.pyi from upstream ( #4405 )
...
https://github.com/ijl/orjson/blob/master/orjson.pyi
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2020-08-06 19:40:26 -07:00
baaffed1ac
Added missing type annotations in various stdlib stubs. ( #4402 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-06 18:27:21 -07:00
Andreas Poehlmann and GitHub
10a5b070ab
Fix contextlib.ContextDecorator.__call__ types ( #4399 )
...
The decorated function returned by ContextDecorator.__call__ has
the same call signature as the original function.
Closes #4382 .
2020-08-06 17:26:54 -07:00
de4ea8681d
Removed imported symbols that are not accessed or re-exported (third_party part 4 of 4) ( #4391 )
...
* Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 4). These were all identified as unused symbols by the pyright type checker and language server.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-06 22:11:22 +02:00
Sam Bull and GitHub
cea32bdc70
Add UserAgent attributes. ( #4398 )
2020-08-06 19:08:37 +02:00
0b3494f712
Replaced parameter name "self" with "cls" for a few class methods ( #4393 )
...
* Replaced parameter name "self" with "cls" for a few class methods. Pyright emits a warning if a class method doesn't follow the PEP 8 standard where the first parameter is named "cls" for a class method. This change eliminates these warnings.
* Missed a file.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-06 09:09:21 +02:00
f60074f3d2
Fixed symbol redefinition in cgi.pyi stub ( #4394 )
...
* PEP 484 says that type checkers should assume that all types used in a stub should use forward declarations even though they are not quoted. This stub is using the symbol "type" within the context of a class scope. The "type" symbol is declared within this scope, so pyright assumes that the forward declaration should be used. The solution is to define a symbol with a different name in the outer scope to avoid the name conflict.
* Fixed import sort order.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-06 09:05:45 +02:00
65450d81ff
Fix multi-part module import errors ( #4395 )
...
* Pyright detects and reports cases where a multi-part module name is accessed but is not explicitly imported. These are dangerous because they rely on import resolution ordering within a program, which can easily change. This change eliminates errors detected by pyright.
* Fixed regression caught by CI test.
* Fixed black formatting issues.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-06 09:03:54 +02:00
04c74640f0
Removed imported symbols that are not accessed or re-exported ( #4387 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-05 22:49:17 -07:00
e17c6a752e
Fixed base classes to avoid "Cannot create consistent method ordering" error. Like the Python interpreter, the pyright type checker reports an error when a class is defined in a way that a deterministic MRO cannot be established. This set of changes eliminates these errors. ( #4392 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-05 19:42:48 -07:00
fe970d1134
Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 3) ( #4390 )
...
These were all identified as unused symbols by the pyright type checker and language server.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-05 18:51:20 -07:00
b3929cbcc9
Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 2). ( #4389 )
...
These were all identified as unused symbols by the pyright type checker and language server.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-05 18:50:31 -07:00
94a7a62c65
Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 1). These were all identified as unused symbols by the pyright type checker and language server. ( #4388 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-05 18:49:35 -07:00
Adam Hitchcock and GitHub
3b6925b955
mark deque.rotate arg as having a default ( #4386 )
2020-08-05 17:35:22 -07:00
Sebastian Rittau and GitHub
dc0bfc5889
Make FeedParser generic over Message ( #4375 )
2020-08-04 09:32:38 -07:00
Áron Ricardo Perez-Lopez and GitHub
a770110497
Mark __next__, __iter__, and close in Generator as concrete ( #4385 )
...
Closes #4384
2020-08-04 12:16:35 +02:00
Ran Benita and GitHub
cd132ff161
stdlib/3/inspect: fix _ParameterKind being an empty enum ( #4383 )
...
This makes mypy think that conditions like
parameter.kind is Parameter.POSITIONAL_OR_KEYWORD
are always false, which triggers `unreachable` warnings, among other
problems.
2020-08-04 11:02:36 +02:00
Igor Nehoroshev and GitHub
8ae5549b61
Add stub for typing_extensions.get_args ( #4373 )
2020-08-03 12:49:18 -07:00
7894269bb5
Proposed fix for tarfile.add() accepting Path name and arcname ( #4369 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2020-07-31 16:55:45 +02:00
Akuli and GitHub
8bf7efe94e
add types for tkinter geometry manager (aka pack,grid,place) methods ( #4379 )
2020-07-31 14:34:47 +02:00
Akuli and GitHub
09c91a00ac
add type hints for tkinter.Variable and its subclasses ( #4378 )
2020-07-31 10:53:57 +02:00
c96b1ae1bf
[stdlib][unittest] Fix mock.call(...) types ( #4374 )
...
Co-authored-by: Jaromir Latal <jaro@fb.com >
2020-07-30 22:02:08 +02:00
Omar Sandoval and GitHub
7b29927c4b
Add missing warn_on_full_buffer argument to signal.set_wakeup_fd() ( #4377 )
...
According to
https://docs.python.org/3/library/signal.html#signal.set_wakeup_fd , this
was added in Python 3.7.
2020-07-30 20:52:17 +02:00
Sebastian Rittau and GitHub
7ed8c5f1da
Add select.epoll.register to stubtest whitelist ( #4376 )
...
Python 3.8.5 changed the docstring slightly, possibly
a problem in stubtest.
2020-07-30 19:29:34 +02:00
Sebastian Rittau and GitHub
36356b3368
Remove argument from deque.pop() ( #4367 )
...
Closes : #4364
2020-07-27 06:49:56 -07:00
Sebastian Rittau and GitHub
06f87e5c92
Simplify pathlib ( #4357 )
...
* Enable some branches for Python2 pathlib2
* Define an alias _PathLike, instead of using multiple branches
* Drop a Python 3.4 branch (the Python 2 branch is identical to
the 3.5+ branch)
* Move Path.__new__ to the top
2020-07-27 06:08:09 -07:00
karl ding and GitHub
8f50cd9d0e
Add missing syslog facility codes ( #4366 )
...
Add support for the following syslog facilities:
- LOG_NTP
- LOG_SECURITY
- LOG_CONSOLE
- LOG_SOLCRON
In addition, reorder the entries to match the CPython implementation to
make it easier to read.
2020-07-27 12:34:12 +02:00
Ian Good and GitHub
a472c9b543
Fix Policy.header_source_parse return type ( #4365 )
2020-07-27 08:38:40 +02:00
Sebastian Rittau and GitHub
cfd06e2d3c
Enable aliases in pytest_mock ( #4359 )
...
* Require newer pytype
2020-07-25 12:13:00 -07:00
Akuli and GitHub
2c37551fd1
make tkinter.Event generic and add missing type hints to bind methods ( #4347 )
2020-07-25 14:23:26 +02:00
Vegard Stikbakke and GitHub
51fd8b2a06
Fix Filter.filter return type - bool, not int ( #4358 )
2020-07-24 20:25:06 +02:00
Shannon Zhu and GitHub
b45e6cfbf6
Make TypeAlias stub a valid annotation ( #4354 )
2020-07-22 17:31:21 -07:00
Akuli and GitHub
9efc9d8818
add tkinter.font stub ( #4350 )
2020-07-22 11:46:04 -07:00
09718c6a03
[requests] Add _content to Response ( #4353 )
...
Co-authored-by: Jaromir Latal <jaro@fb.com >
2020-07-22 17:46:51 +02:00
Peter Law and GitHub
29dec525e7
Add pydoc_data ( #4351 )
...
This appears to be used by jedi at least, so it would be great to
have stubs for it.
2020-07-21 18:14:03 -07:00
bc6da51495
asyncio: export submodules ( #4346 )
...
Resolves #4345
Co-authored-by: hauntsaninja <>
2020-07-21 09:34:00 +02:00
Rebecca Chen and GitHub
537b730558
Update to pytype 2020.07.20 and remove nmap from the exclude list. ( #4348 )
2020-07-20 23:01:21 -07:00
Sabby6 and GitHub
42d20c4a07
pkg_resources: Add missing methods of pkg_resources.DistributionNotFound ( #4344 )
2020-07-20 19:31:50 +02:00
334f77a2d7
Remove unused stubtest whitelist entries ( #4340 )
...
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-07-18 17:27:28 +02:00
Sebastian Rittau and GitHub
18aab6df0f
Fix type in yaml file ( #4339 )
2020-07-18 07:03:23 -07:00
Sebastian Rittau and GitHub
6acf0ef5f2
Create a PR when there are unused stubtest whitelist entries ( #4334 )
2020-07-18 14:48:55 +02:00
Philipp Hahn and GitHub
e44ac21d98
optparse: option_class is Type[Option] ( #4338 )
...
It's a `class`, not an `instance`.
<https://docs.python.org/2.7/library/optparse.html#optparse.OptionParser >
2020-07-17 20:50:02 +02:00
Sebastian Rittau and GitHub
ee77a359eb
Use 'black' profile for isort ( #4336 )
2020-07-17 07:20:48 -07:00
Magnus Watn and GitHub
12f93797ff
Change dotted_string from method to str ( #4335 )
2020-07-17 15:02:52 +02:00
Shantanu and GitHub
d998d37954
multiprocessing: revert changes to queue classes ( #4314 )
...
Partial revert of #4289 . Fixes #4313
2020-07-16 15:03:25 -07:00
Sebastian Rittau and GitHub
5e76f51930
Upgrade to isort 5 ( #4323 )
...
This now also reformats imports not at the top of files.
2020-07-16 07:01:57 -07:00
Andre Delfino and GitHub
1e0e40f61c
Use Mapping for requests _Data ( #4327 )
2020-07-13 14:00:52 +02:00
5ecdc08bb1
tarfile: fix arg name ( #4326 )
...
And update whitelist since #4322 fixed a thing
Co-authored-by: hauntsaninja <>
2020-07-12 20:27:43 +02:00
Sebastian Rittau and GitHub
9ad8ed3b75
Introduce Mapping-like protocols ( #4325 )
...
typing.Mapping is not a protocol, which has caused problems in the past.
(E.g. python/typeshed#3569 , see also python/typeshed#3576.) This
introduces a few narrow protocols to _typeshed.pyi that can be used in
place of Mapping.
Not all uses of Mapping can be replaced. For example, cgi.FieldStorage
explictly checks whether the supplied headers argument is a Mapping
instance.
2020-07-11 17:11:08 -07:00
028f0d5293
Fix: TarFile.tarinfo is a Type instead of instance. ( #4322 )
...
Co-authored-by: Jonathan Slenders <jslender@cisco.com >
2020-07-10 12:22:04 +02:00
Alex Grönholm and GitHub
ad89dee03b
Fixed return type of getaddrinfo() everywhere ( #4304 )
2020-07-10 10:46:28 +02:00
Joshua Oreman and GitHub
e6736cde8d
ctypes: allow cast() 1st argument to be int and 2nd argument to be Type[py_object] ( #4311 )
2020-07-10 10:44:23 +02:00
Sebastian Rittau and GitHub
209b6bb127
Remove tornado stubs ( #4321 )
...
Current tornado releases feature inline annotations and ship with
a py.typed file.
2020-07-09 07:20:11 -07:00
8e69672587
Fix for cryptography Extensions.get_extension_for_class. ( #4320 )
...
Co-authored-by: Jonathan Slenders <jslender@cisco.com >
2020-07-09 11:25:02 +02:00
Matan Gover and GitHub
c64ecf5808
Flask.root_path cannot be None ( #4319 )
...
Extension of #2792 (see #2791 ). See [implementation](https://github.com/pallets/flask/blob/4e854ee49687ceac90985526928d901570d3585d/src/flask/helpers.py#L959 ).
2020-07-08 17:41:11 -07:00
Sebastian Rittau and GitHub
03d8795403
Update unused stubtest whitelist action trigger ( #4315 )
...
Now runs weekly instead of daily, but also add the ability to trigger
manually.
2020-07-07 10:12:52 -07:00
Alex Grönholm and GitHub
f9d469ac2b
Fixed parameter and return types of getnameinfo() everywhere ( #4305 )
2020-07-03 15:46:02 +02:00
c0e9c4f4c5
add overloads for combinations r 2-5 ( #4309 )
...
This doesn't cover everything but it means it a lot of common usages the type will be slightly more useful
Co-authored-by: steve brazier <steve.brazier@trioptima.com >
2020-07-03 15:23:43 +02:00
Jürgen Gmach and GitHub
92f91ddfe8
Add typing for werkzeug.utils.secure_filename ( #4308 )
2020-07-03 15:08:03 +02:00
Jürgen Gmach and GitHub
ee44a5c323
Update test setup description ( #4307 )
...
The description, as it was, did not work with an older version of pip,
as the installation errored. An updated version of pip fixes the installation problem.
2020-07-03 14:31:22 +02:00
Julian Mehnle and GitHub
6d1c59d238
pymysql.err.Warning multiple-inherits from builtins.Warning and MySQLError. (#4303 )
...
Previously we declared it as single-inheriting from only `MySQLError`.
2020-07-02 19:53:38 -07:00
John Snow and GitHub
f26a82436c
requests: add type hint for Session.send() ( #4302 )
...
This takes a PreparedRequest and returns a Response.
See https://github.com/psf/requests/blob/master/requests/sessions.py#L614
2020-07-01 15:31:37 -07:00
Federico Bond and GitHub
4225ab2496
Export requests.utils module ( #4301 )
2020-07-01 10:55:55 -07:00
Ivan Levkivskyi and GitHub
5c7cf9f75c
Script for modular typeshed migration ( #4259 )
...
This reshuffles directory structure according to the specification in https://github.com/python/typeshed/issues/2491#issuecomment-611607557
2020-07-01 12:36:23 +01:00
wouter bolsterlee and GitHub
3efb675dba
Use ‘exclude list’ instead of ‘blacklist’ ( #4297 )
...
This replaces all uses of ‘blacklist’ with ‘exclude list’. Benefits:
- It is racially neutral terminology; see e.g. [1]
- It makes the meaning more clear. In fact, with the popular Python
autoformatter called ‘black’, also used by this project, files can be
‘blackened’ which is something completely different from them being on
a blacklist.
[1] https://chromium.googlesource.com/chromium/src/+/master/styleguide/inclusive_code.md#racially-neutral
2020-07-01 09:10:37 +02:00
Sebastian Rittau and GitHub
b8f6d5fc54
Replace a few instances of IO with protocols ( #4296 )
2020-06-30 18:05:30 -07:00
wouter bolsterlee and GitHub
83e955b52f
Use correct return type annotation for BaseException.with_traceback ( #4298 )
...
The return type of the BaseException.with_traceback() method [1] is not
specific enough. The return type is guaranteed to be of the same type as
‘self’, which is usually a subclass of BaseException.
In fact, .with_traceback() returns ‘self’:
try:
raise ValueError
except Exception as exc:
assert exc.with_traceback(None) is exc
Fix the annotation to reflect this using the self-type annotation
technique described in PEP484 [2], which is supported by (at least)
mypy [3].
[1] https://docs.python.org/3/library/exceptions.html#BaseException.with_traceback
[2] https://www.python.org/dev/peps/pep-0484/#annotating-instance-and-class-methods
[3] https://github.com/python/mypy/issues/1212
2020-06-30 11:40:25 -07:00
Christine and GitHub
8cf3cd398e
[redis] Update hset signature to include mapping kwarg ( #4293 )
2020-06-30 09:41:01 +02:00
f0269cd438
fix shutil.chown type annotations ( #4294 )
...
According to the official docs, "user can be a system user name or a uid;
the same applies to group".
Co-authored-by: Artem Simonov <artem.simonov@dejero.com >
2020-06-30 09:39:38 +02:00
Nipunn Koorapati and GitHub
ad8fd9dba7
Add typing for google protobuf mapping containers ( #4265 )
2020-06-30 09:37:50 +02:00
6bffc6534b
Add nmap type information ( #4292 )
...
Author: Philipp Hahn <hahn@univention.de >
Co-authored-by: Philipp Hahn <hahn@univention.de >
2020-06-29 18:52:41 +02:00
Jelle Zijlstra and GitHub
0142a87da8
adjust isort config ( #4290 )
...
Fixes #4288 .
- Default imports to THIRD_PARTY, so in effect we merge the FIRST_PARTY and THIRD_PARTY stubs. This means import order is no longer affected by whether typing_extensions is installed locally.
- Treat typing_extensions, _typeshed and some others as standard library modules.
Note that isort master is very different from the latest release; we'll have to do something
different if and when the next isort release comes out.
2020-06-29 00:00:21 -07:00
Vishal Kuo and GitHub
cc8344b8c6
[multiprocessing] fixes more incorrect types ( #4289 )
2020-06-28 16:08:14 -07:00
4586ed9adc
Require black and isort for contributions ( #3329 )
...
* Add explanation to CONTRIBUTNG.md
* Add sample pre-commit script
* Check for correctly formatted files in CI
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-06-28 15:28:28 -07:00
Jelle Zijlstra and GitHub
5d553c9584
apply black and isort ( #4287 )
...
* apply black and isort
* move some type ignores
2020-06-28 13:31:00 -07:00
Shantanu and GitHub
fe58699ca5
collections/typing: fix various arg names ( #4258 )
...
This feels nervous, but if it passes unit tests it's unlikely to break
anything
2020-06-28 12:27:21 -07:00
Denis Laxalde and GitHub
0dd3258ed2
Add __aiter__ and __anext__ methods for asyncio.StreamReader ( #4286 )
...
The following code produces an error in mypy:
import asyncio
from asyncio.subprocess import PIPE
async def main() -> None:
proc = await asyncio.create_subprocess_shell("ls -l", stdout=PIPE)
assert proc.stdout is not None
async for line in proc.stdout:
print(line.decode())
await proc.wait()
asyncio.run(main())
$ mypy --strict file.py
file.py:8: error: "StreamReader" has no attribute "__aiter__" (not async iterable)
This commits fixes this by adding __aiter__/__anext__ methods that are
needed for async iterator protocol.
2020-06-28 11:57:49 -07:00
Peter Law and GitHub
ed04d33def
Make redirect_std{out,err} yield new stream as context var ( #4285 )
...
This matches the implementation, even though this behaviour isn't
actually documented yet. https://bugs.python.org/issue41147 aims
to fix the documentation issue though.
Fixes https://github.com/python/typeshed/issues/4283 .
2020-06-28 07:36:09 -07:00
Sebastian Rittau and GitHub
0704214701
Add pytest_mock stubs ( #4275 )
2020-06-27 19:46:47 -07:00
Vishal Kuo and GitHub
986eff04c3
[redis] replaces _Str with _Value as variable info ( #4281 )
2020-06-27 13:04:20 -07:00
Vishal Kuo and GitHub
e467fd50ab
multiprocessing: add sharedctypes, fix some stubtest cases ( #4282 )
2020-06-26 23:38:34 -07:00
Sebastian Rittau and GitHub
564a8220f4
Add float.__ceil__ and __floor__ ( #4274 )
...
Closes : #3195
2020-06-26 22:26:39 -07:00
Vishal Kuo and GitHub
d4a2cf3da4
[redis] adds additional sorted set type information ( #4278 )
2020-06-27 00:14:42 +02:00
Sebastian Rittau and GitHub
ad7c1cd7eb
Update pytype ( #4280 )
2020-06-27 00:13:12 +02:00
Shantanu and GitHub
64327e02e9
keyword: update for py39 ( #4272 )
2020-06-26 20:50:16 +02:00
afcb46655a
graphlib: add in py39 ( #4268 )
...
Co-authored-by: hauntsaninja <>
2020-06-26 20:49:50 +02:00
Sebastian Rittau and GitHub
b05adddf5a
pytype tests: Specify files or dirs to check ( #4279 )
...
This adds the ability to check single files or directories with
tests/pytype_test.py by specifying the paths to check on the
command line.
2020-06-26 20:45:38 +02:00
Mark Mendoza and GitHub
1d16e6c49e
Replacing Callable[[T], T] with callback protocol in click ( #4045 )
2020-06-26 16:48:40 +02:00
9a16b02187
argparse: fix for latest py39 ( #4267 )
...
https://github.com/python/typeshed/pull/4144 and
https://github.com/python/cpython/pull/11478#pullrequestreview-423968410
resulted in the issue being fixed upstream.
Co-authored-by: hauntsaninja <>
2020-06-26 12:55:23 +02:00
cc150f1d76
compileall: update for py39 again ( #4269 )
...
Co-authored-by: hauntsaninja <>
2020-06-26 12:46:18 +02:00
fc8b0ed94e
builtins: remove __class_getitem__ from type ( #4270 )
...
Co-authored-by: hauntsaninja <>
2020-06-26 12:45:22 +02:00
Shantanu and GitHub
2ba6939788
imaplib: update for py39 ( #4271 )
2020-06-26 12:40:27 +02:00
1c3f526fbf
pickle: improve positional-arg accuracy in py39 and others ( #4273 )
...
Although technically data in loads is not positional-only in py38, but
we decided that that doesn't matter
Co-authored-by: hauntsaninja <>
2020-06-26 12:29:47 +02:00
Jia Chen and GitHub
92fa4e799c
Using dunder parameter name in builtins._SupportsLessThan ( #4264 )
2020-06-25 21:02:00 +02:00
70459abb44
Revert "zip: add some overloads for heterogeneous tuples ( #3830 )" ( #4254 )
...
This reverts commit e857ad6ba9 .
Co-authored-by: hauntsaninja <>
2020-06-25 08:46:02 -07:00
helafumpek and GitHub
534ebd5051
Change argument type in random.shuffle (python/typeshed#4255) ( #4260 )
...
Fixes #4255
2020-06-24 08:17:13 +02:00
9723afef8a
stubtest whitelists: update ( #4257 )
...
Co-authored-by: hauntsaninja <>
2020-06-23 08:55:40 +02:00
Milap Sheth and GitHub
14af8790f3
Added missing properties to struct_time ( #4256 )
2020-06-22 20:43:53 -07:00
Bruce Merry and GitHub
fb398b1d59
Use the ReadableBuffer type in more places ( #4245 )
...
This is a follow-up on #4232 . memoryview, hashlib, and hmac are updated
to use ReadableBuffer type instead of their own home-spun unions of
bytes, bytearray and whatever else each use case used. mmap is being
handled in #4244 , and I'll leave BinaryIO for another day (or possibly
another person) because it's going to require some messy code
duplication because the relevant methods are defined in IO[AnyStr].
There's one corner case I'm not quite sure how best to handle: the
documentation for hmac.digest claim that the parmaeters have the same
meanings as in hmac.new, but in CPython the latter has an explicit check
that `key` is bytes or bytearray while the former works with a
memory-view. For now I've matched the documentation.
Also, the documentation for HMAC.update says that `msg` can be any type
supported by hashlib from Python 3.4; but I can't see anything in the
Python 2.7 implementation that would prevent it also taking bytes-like
objects, so I've not tried to treat Python 2 any different to Python 3.
2020-06-22 06:17:24 -07:00
Jelle Zijlstra and GitHub
e1d89e5742
remove references to "Text" in Python 3-only stubs ( #4251 )
2020-06-22 12:39:01 +02:00
Milap Sheth and GitHub
66a9a4b5ce
Fix type hint of generator throw method ( #4253 )
...
* Fix type hint of generator throw method
* Incorporated changes from #4252
2020-06-21 15:23:28 -07:00
9b3edda33b
Fix unittest stub issues reported by mypy stubtest ( #4248 )
...
Co-authored-by: Shantanu <>
2020-06-21 15:09:17 -07:00
Rune Tynan and GitHub
79111ee8ed
Fix _DispatchProtocol in xmlrpc.server ( #4165 )
2020-06-21 13:42:14 -07:00
Russell Davis and GitHub
aca6bd7e88
Fix os.exec* and os.spawn* to allow PathLike for all args ( #4236 )
2020-06-21 13:41:19 -07:00
Bruce Merry and GitHub
ec6116dfa4
Update mmap stubs for newer Python versions ( #4244 )
...
* Update mmap stubs for newer Python versions
Based on the Python stdlib documentation:
- Since Python 3.5, mmap.{find,rfind,write} all accept any bytes-like.
I've used the _typeshed.ReadableBuffer alias defined in #4232 .
- Since Python 3.6, mmap.write returns the number of bytes written.
- Since Python 3.3, mmap.read allows None as the parameter; while in
Python 2 the argument cannot be omitted.
* Further clean up mmap.pyi
Use the fact that Python 3.0-3.4 are no longer supported to clean up the
version-dependent logic. Functions that always have different signatures
in Python 2/3 are moved from the base _mmap[bytes] to the mmap subclass.
2020-06-21 13:37:19 -07:00
Milap Sheth and GitHub
671d6eb804
Update operator stubs to support slices for getitem/setitem/delitem ( #4250 )
2020-06-20 16:41:46 -07:00
Nipunn Koorapati and GitHub
ca5cb9d006
Restore the global SSL flags to typeshed ( #4247 )
...
Audited this - and ensured the globals were gated under
the appropriate python versions for the boolean vars.
https://docs.python.org/3/library/ssl.html
Fixes #4246
2020-06-19 17:41:28 -07:00
Sebastian Rittau and GitHub
a615a17976
Update black and work around an isort bug ( #4242 )
2020-06-19 08:32:05 -07:00
Mikhail Golubev and GitHub
30bbf02cf1
Add PEP 613 TypeAlias stub to typing_extensions ( #4243 )
2020-06-19 14:49:04 +02:00
Bruce Merry and GitHub
e05fbabdeb
Introduce ReadableBuffer and WriteableBuffer Union aliases ( #4232 )
...
Since typing doesn't yet have a way to express buffer protocol objects
(python/typing#593 ), various interfaces have ended up with a mish-mash
of options: some list just bytes (or just bytearray, when writable),
some include mmap, some include memoryview, I think none of them include
array.array even though it's explicitly mentioned as bytes-like, etc. I
ran into problems because RawIOBase.readinto didn't allow for
memoryview.
To allow for some uniformity until the fundamental issue is resolved,
I've introduced _typeshed.ReadableBuffer and _typeshed.WriteableBuffer,
and applied them in stdlib/3/io.pyi as an example. If these get rolled
out in more places, it will mean that we have only one place where they
have to get tweaked in future, or swapped out for a public protocol.
This unfortunately does have the potential to break code that inherits
from RawIOBase/BufferedIOBase and overrides these methods, because the
base method is now more general and so the override now needs to accept
these types as well (which is why I've also updated gzip and lzma).
However, it should be a reasonably easy fix, and will make the
downstream annotations more correct.
2020-06-19 12:45:12 +02:00
Luciano Ramalho and GitHub
1350e710cc
max, min overloads with Protocol: fix #4051 ( #4227 )
2020-06-19 12:37:43 +02:00
Sebastian Rittau and GitHub
32c638cc88
Run the unused stubtest check only on python/typeshed ( #4240 )
...
Without this check, it is run on daily on every personal fork.
2020-06-18 10:47:05 -07:00
Vlad Emelianov and GitHub
d21370965a
Allow Warning message in showwarning and formatwarning ( #4239 )
2020-06-17 17:44:09 -07:00
Sebastian Rittau and GitHub
68a7b9b178
Collate all stubtest runs into a single output ( #4231 )
2020-06-17 11:48:44 -07:00
Jakub Stasiak and GitHub
37be717886
Add stubs for cryptography's Fernet.[encrypt|decrypt]_at_time() ( #4238 )
2020-06-17 16:11:42 +02:00
Martijn Pieters and GitHub
5c739ef4c3
os.fsencode(PathLike[AnyStr]) produces AnyStr ( #4233 )
...
PathLike is generic over AnyStr of 7587e7f1c1 . Also see 89de36afa4 , which changed this to `Any` before `AnyStr` was available.
2020-06-16 15:57:58 -07:00
Sebastian Rittau and GitHub
51cf2f51b8
Add IO protocols to _typeshed ( #4230 )
2020-06-14 20:44:48 +02:00
Sebastian Rittau and GitHub
ef74bee249
Protocol naming guidelines ( #4229 )
...
Closes : #4174
2020-06-14 17:00:19 +02:00
Sebastian Rittau and GitHub
89d3a55f1a
Preparations for the Big Reformat ( #4228 )
...
A few comments between imports were removed or moved to the top of the
import block, due to behavioral differences between black and isort. See
psf/black#251 for details.
In two instances @overloads at the top of the file needed to be moved
due to psf/black#1490 .
2020-06-14 07:58:26 -07:00
Sebastian Rittau and GitHub
53431cab1d
Remove unused stubtest entries ( #4225 )
...
Rename job
2020-06-12 06:57:23 -07:00
Jelle Zijlstra and GitHub
f67ea2031a
xml.etree: use _typeshed ( #4221 )
2020-06-11 12:41:57 -07:00
Sebastian Rittau and GitHub
cf3b74a0bf
Move stubtest CI to GitHub Actions ( #4223 )
...
This ensures that the Python version used matches the one used in the
scheduled extraneous stubtest whitelist check.
See also PR #4206 .
2020-06-11 12:39:06 -07:00
Jelle Zijlstra and GitHub
8100c0be89
subprocess: use AnyPath ( #4218 )
2020-06-11 09:15:10 +02:00
Jelle Zijlstra and GitHub
d0b85d7efe
remove _types ( #4220 )
2020-06-11 09:10:52 +02:00
ecb43149f7
builtins: NotImplemented is not callable ( #4222 )
...
Fixes #3315
Co-authored-by: hauntsaninja <>
2020-06-10 22:05:16 -07:00
Jelle Zijlstra and GitHub
44a852dff5
Literal: always import from typing_extensions for simplicity ( #4219 )
2020-06-10 21:23:58 -07:00
Jelle Zijlstra and GitHub
43e93f803f
use _typeshed's Path aliases ( #4214 )
2020-06-10 20:57:09 -07:00
86f03f2d7b
stubtest: remove unused whitelist entries ( #4217 )
...
Co-authored-by: hauntsaninja <>
2020-06-11 01:32:42 +02:00
Dmitry Marakasov and GitHub
c14e56bcbb
Add rv annotaton to send_static_file() ( #4216 )
2020-06-10 22:32:27 +02:00
d261f14886
add constructors for configparser errors ( #4215 )
...
Fixes #4058
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com >
2020-06-10 12:32:18 -07:00
Jelle Zijlstra and GitHub
ea577cec1f
move OpenTextMode and friends to _typeshed ( #4213 )
2020-06-10 15:36:21 +02:00
Mikhail Golubev and GitHub
85281b636e
Add __class_getitem__ to builtins generified in PEP 585 ( #4184 )
...
* Add __class_getitem__ to builtins generified in PEP 585
* Declare types.GenericAlias and use it in __class_getitem__
2020-06-09 20:10:07 -07:00
Sebastian Rittau and GitHub
afe1e543b3
Make multiprocessing.Namespace accept any attribute ( #4204 )
...
Update multiprocessing.dummy.Namespace as well
Closes : #4186
2020-06-09 12:34:36 -07:00
72c8907760
tkinter: fix version availability ( #4207 )
...
Co-authored-by: hauntsaninja <>
2020-06-09 12:20:48 +02:00
Sam Bull and GitHub
5f70d3721a
Update root dbm module. ( #4199 )
2020-06-09 12:20:09 +02:00
Eric Masseran and GitHub
40f6856a80
Update the InternalServerError constructor type ( #4210 )
2020-06-09 12:11:30 +02:00
f4b23e4a80
Fix cgi.FieldStorage's __iter__ return type ( #4209 )
...
Co-authored-by: Phillip Huang <phillip@dropbox.com >
2020-06-08 20:40:14 -07:00
Sebastian Rittau and GitHub
206bff44ed
Remove BinaryIO.write() ( #4203 )
...
write() is inherited from IO[bytes], where it's defined as
`def write(self, s: AnyStr) -> int: ...`. If AnyStr is bytes,
this should accept bytes, bytearray, and memoryview, so the
overload is unnecessary.
Closes : #4201
2020-06-08 13:40:41 -07:00
Christopher Head and GitHub
51267a4b12
Add tkinter Event class ( #4200 )
2020-06-08 12:46:16 -07:00
Sebastian Rittau and GitHub
3d84c52a4c
Do not stop other checks if one check fails ( #4205 )
2020-06-08 07:25:52 -07:00
f2f65bcf8d
profile/cProfile: minor improvements ( #4202 )
...
Co-authored-by: hauntsaninja <>
2020-06-08 11:45:55 +02:00
df6136c4ac
logging: various fixes ( #4196 )
...
* logging.disable: update for py37
* RootLogger: fix __init__
* shutdown: add undocumented parameter
* MemoryHandler: add flushOnClose in py36
* NTEventLogHandler: fix dllname type
* makeSocket: add undocumented parameter
* SysLogHandler: fix socktype type
Co-authored-by: hauntsaninja <>
2020-06-07 14:05:29 -07:00
Jaromir Latal and GitHub
4ab1d6f0ae
[stdlib][logging] Make level default in logging.disable for 3.7+ ( #4197 )
2020-06-07 13:09:22 -07:00
Jaromir Latal and GitHub
c36e4517f7
[stdlib][asyncio] Accept optional context in (Timer)Handle ( #4190 )
2020-06-07 06:33:46 -07:00
Christopher Head and GitHub
948c1a63e6
Relax asyncio.TimerHandle.__init__ args parameter ( #4193 )
...
Just like the Handle class, the TimerHandle class can take any sequence
here, not just a list.
2020-06-06 18:33:23 -07:00
Luciano Ramalho and GitHub
bb9e1a649c
using type var to work around List invariance ( #4192 )
2020-06-06 18:32:15 -07:00
Christopher Head and GitHub
7931635b52
Add sys.{get,set}_asyncgen_hooks ( #4195 )
2020-06-06 15:44:48 -07:00
Christopher Head and GitHub
5b36051f77
tkinter: fix variable parameter to wait_variable ( #4194 )
...
The tkinter `wait_variable` function can be called with either the name
of a variable (a `str`) or an actual variable object (a `Variable`).
2020-06-06 14:41:42 -07:00
Vegard Stikbakke and GitHub
34b9cfcdcf
curses.bkgset -> bkgdset ( #4191 )
2020-06-06 08:45:37 -07:00
415da3ddd4
Redis client and others ( #4178 )
...
Co-authored-by: Richard Lindsley <rich.lindsley@gmail.com >
2020-06-06 08:07:45 -07:00
Eric N. Vander Weele and GitHub
4199352287
Fix typing.ForwardRef.__eq__ stub ( #4177 )
...
The return type of `__eq___` should be `bool`.
Otherwise, `mypy --disallow-any-unimported --no-silence-site-packages`
fails because the return type becomes `Union[bool, Any]` due to an
unfollowed import.
2020-06-06 08:04:05 -07:00
7c5a4c96ca
stubtest_unused: fix for py36 and earlier ( #4187 )
...
Co-authored-by: hauntsaninja <>
2020-06-06 16:50:50 +02:00
9ab4ec568d
[stdlib][asyncio] Widen asyncio.events.handle arguments type ( #4188 )
...
Co-authored-by: Jaromir Latal <jaro@fb.com >
2020-06-06 16:48:02 +02:00
52bf411f2b
[stdlib][asyncio] Allow optional policy in ( #4189 )
...
Co-authored-by: Jaromir Latal <jaro@fb.com >
2020-06-06 16:47:04 +02:00
Mikhail Golubev and GitHub
231998a0a1
Fix a typo in the section about type hinting context managers ( #4185 )
2020-06-05 08:43:43 -07:00
karl ding and GitHub
3f141751d7
cProfile: Fix Profile __init__ keyword arguments ( #4183 )
...
The CPython _lsprof module implementation uses the keyword arguments
'timer' and 'timeunit' instead of 'custom_timer' and 'time_unit' for
__init__. In profiler_init, the keyword argument parsing looks like the
following:
static char *kwlist[] = {"timer", "timeunit",
"subcalls", "builtins", 0};
This is the case ever since _lsprof was added in version 2.5.
2020-06-05 07:40:51 -07:00
db819480a5
logging: fix argument names ( #4181 )
...
* logging: fix argument names
* logging: filter method improvements
Co-authored-by: hauntsaninja <>
2020-06-04 19:32:03 -07:00
Shantanu and GitHub
7aabfcc65a
array: update for py39 ( #4180 )
2020-06-04 18:32:24 -07:00
Shantanu and GitHub
5369e813a9
argparse: fix error __init__, add BooleanOptionalAction for py39 ( #4144 )
2020-06-04 16:00:52 -07:00
Sebastian Rittau and GitHub
1f82564ee2
Move wsgiref.types to _typeshed.wsgi ( #4175 )
...
Re-export the types from wsgiref.types for now to avoid breaking
existing code. wsgiref.types should be removed eventually.
Also, reduce the boilerplate description in _typeshed/wsgi.pyi as it
mirrors the description in _typeshed/__init__.pyi.
2020-06-04 15:38:45 -07:00
Sam Bull and GitHub
5b66868156
Allow Path in create_subprocess_* ( #4159 )
2020-06-04 17:11:53 +02:00
Sebastian Rittau and GitHub
eea9be6e73
Add a _typeshed.pyi file and a PathLike alias ( #4161 )
2020-06-04 14:06:43 +02:00
Willy Wu and GitHub
ec3370b2b0
datetimerange: Allow datetime.datetime in addition to str ( #4167 )
...
Closes : #4166
2020-06-04 13:23:21 +02:00
Dakkaron and GitHub
3438cb92e1
pipes.quote takes AnyStr ( #4173 )
2020-06-04 12:37:57 +02:00
Sam Bull and GitHub
bd35cd6bf8
Fixes for ssl ( #4164 )
2020-06-03 21:42:31 +02:00
Sebastian Rittau and GitHub
d76ad4710e
Find unused stubtest whitelist entries ( #4157 )
...
* Find unused stubtest whitelist entries
This is currently a GitHub workflow that runs daily and lists all unused
whitelist entries found by running stubtest against current Python
versions on Linux and Windows. The workflow run will succeed if there
are no such entries, and fail otherwise.
In a second step, this should collate the output of the various runs and
create a PR to remove the entries. In that case, the workflow should
probably only run weekly or even monthly to keep the noise down.
Cf. #3728
2020-06-03 14:37:38 +02:00
Sam Bull and GitHub
dd5ef5ed1e
Add hostname_checks_common_name attribute to SSLContext ( #4160 )
2020-06-03 11:19:02 +02:00
Sebastian Rittau and GitHub
a913af9523
flake8: Enable F811 ( #4158 )
2020-06-02 14:08:54 -07:00
karl ding and GitHub
43cf0ec870
ssl: Improve SSLContext.options stub ( #4152 )
...
In Python 3.6, the SSLContext.options flags were converted from int to
EnumFlag values.
In addition, add the missing OP_ENABLE_MIDDLEBOX_COMPAT constant
introduced in version 3.6.
In addition, add the missing OP_NO_RENEGOTIATION constant introduced in
version 3.7.
2020-06-02 09:19:18 +02:00
17aa20cd95
Add st_file_attributes to stat_result for Windows ( #4156 )
...
This member is documented at https://docs.python.org/3/library/os.html#os.stat_result.st_file_attributes and https://docs.python.org/3/whatsnew/3.5.html#os
Co-authored-by: hauntsaninja <>
2020-06-01 23:53:11 -07:00
c879392b02
CI: remove py39 ( #4154 )
...
I can't find a way to pin it to beta, and if they're going to make
changes that will break typeshed CI we shouldn't run it in CI.
I would like to make this run with Travis' allow_failures, but I can't
seem to make it work.
Co-authored-by: hauntsaninja <>
2020-06-01 22:42:23 -07:00
Steve Dignam and GitHub
10b87bdfbb
redis: add more precise types for hash commands ( #4148 )
2020-06-01 05:33:03 +02:00
Rune Tynan and GitHub
342ce69f88
Add missing asyncio modules ( #4149 )
2020-06-01 02:05:16 +02:00
karl ding and GitHub
2137026681
socket: Add missing CAN_BCM option flag constants ( #4151 )
...
The SocketCAN BCM option flag constants were added in version 3.9,
and only backported to version 3.8, despite the documentation's claims
of supporting all BCM-related constants starting from version 3.4.
Note: The CAN_FD_FRAME flag option was only introduced in the 4.8.x
kernel series, while the rest of the constants were available since the
Broadcast Manager was mainlined in the kernel as part of the SocketCAN
patches.
2020-06-01 01:21:54 +02:00
Jelle Zijlstra and GitHub
adeda24fce
open: introduce concrete return types ( #4146 )
...
* make io classes inherit from typing IO classes
This makes these classes usable if type annotations are given as "IO"
or "TextIO". In the future, we'll then be able to move open() to
return a concrete class instead (#3951 ).
* open: introduce concrete return types
Fixes #3951 .
We use the values of the "mode" and "buffering" arguments to figure out
the concrete type open() will return at runtime. (Compare the CPython
code in https://github.com/python/cpython/blob/master/Modules/_io/_iomodule.c#L231 .)
2020-06-01 00:48:12 +02:00
Rune Tynan and GitHub
d863210335
Improve TypeVar stub ( #4150 )
2020-05-30 20:27:59 -07:00
Markus Pielmeier and GitHub
b7d9a4a584
Add support for __pow__ with pow() builtin ( #4109 )
2020-05-30 15:38:19 -07:00
Jelle Zijlstra and GitHub
3058bec873
make io classes inherit from typing IO classes ( #4145 )
...
This makes these classes usable if type annotations are given as "IO"
or "TextIO". In the future, we'll then be able to move open() to
return a concrete class instead (#3951 ).
2020-05-30 06:50:49 -07:00
de2c2947fe
windows: fix splitunc param name ( #4143 )
...
Co-authored-by: hauntsaninja <>
2020-05-29 20:37:19 -04:00
6590a36776
stubtest whitelists: clean up duplicate entries ( #4142 )
...
Co-authored-by: hauntsaninja <>
2020-05-29 18:32:26 -04:00
Rune Tynan and GitHub
4381eba6f4
Add _sitebuiltins stubs ( #4139 )
2020-05-29 22:33:06 +02:00
karl ding and GitHub
09821cd9ca
Add typing for CAN_J1939 sockets ( #4141 )
...
Add typing for CAN_J1939 sockets implementing support for the SAE J1939
protocol. This is available in Python 3.9+ on Linux 5.4+.
2020-05-29 12:33:47 +02:00
Rune Tynan and GitHub
d035ce57e3
Add platform checks for various sys values ( #4137 )
...
* Add platform checks for various sys values
* Add windows-only constants
2020-05-28 19:00:31 -07:00
Rune Tynan and GitHub
a1953431ff
Move oem_(decode, encode) to be 3.6+ ( #4140 )
2020-05-28 18:57:32 -07:00
b58b8f3b43
Make BytesIO inherit from BufferedIOBase. ( #4082 )
...
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com >
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-05-28 17:07:00 -07:00
Sebastian Rittau and GitHub
b2b397c5ce
Add @CraftSpider and @hauntsaninja as maintainers ( #4138 )
2020-05-28 16:34:45 -07:00
Rune Tynan and GitHub
a9e4ddaf29
Add _py_abc stubs ( #4129 )
2020-05-29 00:26:18 +02:00
62304eb02f
asyncio: update cancels for py39 ( #4135 )
...
Co-authored-by: hauntsaninja <>
2020-05-28 13:42:31 -07:00
da2aa297a2
pathlib: update for py39 ( #4134 )
...
Co-authored-by: hauntsaninja <>
2020-05-28 13:41:53 -07:00
Shantanu and GitHub
feb43f7237
asyncio: add asyncio.threads for py39 ( #4136 )
2020-05-28 13:37:46 -07:00
Brian Wellington and GitHub
0bed1d3956
socket.create_connection source_address is optional. ( #4133 )
2020-05-28 19:56:11 +02:00
Jelle Zijlstra and GitHub
c80622fbb9
remove type ignores about python/mypy#5027 ( #4119 )
...
The mypy issue got fixed by the good people of mypy. I did have to add an
override for __enter__ similar to what we're doing in #4082 .
2020-05-28 09:51:54 -07:00
846d922df2
More precise return types for open(), Path.open(), bz2.open(), etc. ( #3371 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2020-05-28 09:20:23 -07:00
Sebastian Rittau and GitHub
adafaf1964
Add review guidlines ( #4132 )
...
Closes : #3448
2020-05-28 15:18:05 +02:00
313a835bea
Add missing definitions for urllib/response.pyi ( #4118 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-05-28 13:48:27 +02:00
Jelle Zijlstra and GitHub
0cffa59e57
use a Protocol for str.format_map() ( #4122 )
...
Fixes #3824
2020-05-28 13:27:57 +02:00
Jelle Zijlstra and GitHub
ca553cd589
fix type for ipaddress._BaseNetwork.overlaps ( #4124 )
2020-05-28 13:22:50 +02:00
Gregory P. Smith and GitHub
a9d5a1ed99
hmac digestmod is no longer Optional as of 3.8. ( #3367 )
2020-05-28 09:24:32 +02:00
2f0e3dbed2
statistics: add zscore in py39 ( #4130 )
...
Co-authored-by: hauntsaninja <>
2020-05-27 22:09:46 -07:00
1c0403cf83
random: various fixes ( #4128 )
...
* random.sample: make counts keyword-only
* random: mark positional-only args
* random.triangular: fix type of mode
* random: add randbytes
Co-authored-by: hauntsaninja <>
2020-05-27 22:05:55 -07:00
Shantanu and GitHub
eca19f00fb
bdb: various fixes ( #4127 )
2020-05-27 21:42:45 -07:00
e8d0cadf7b
aifc: update for py39 ( #4126 )
...
Co-authored-by: hauntsaninja <>
2020-05-27 21:42:32 -07:00
Shantanu and GitHub
c3c6abc153
gettext: various fixes ( #4125 )
2020-05-27 21:26:58 -07:00
22fd5e916a
wsgiref: fix arg name, make close an instance variable ( #4123 )
...
Co-authored-by: hauntsaninja <>
2020-05-27 21:06:11 -07:00
0041206765
Fix _winapi version availability ( #4120 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-05-27 20:47:15 -07:00
Shantanu and GitHub
e9531e0c18
_tracemalloc: precise types, deduplicate tracemalloc ( #4083 )
2020-05-27 20:36:21 -07:00
Sam Bull and GitHub
5c1806ab88
Add more annotations to jinja2.utils. ( #4004 )
2020-05-27 20:28:56 -07:00
Rune Tynan and GitHub
712f6d3709
Fix winreg pos-only args and parameter names ( #4117 )
...
* Fix winreg pos-only args and parameter names
* Fix consistency check
2020-05-27 20:22:32 -07:00
5cf2fb703a
tempfile: fix TemporaryFile on Windows ( #4112 )
...
Co-authored-by: hauntsaninja <>
2020-05-27 20:22:01 -07:00
c988348179
ctypes: fix arg name on windows ( #4111 )
...
Co-authored-by: hauntsaninja <>
2020-05-27 20:21:45 -07:00
Ilya Konstantinov and GitHub
1dc585385a
lru_cache-wrapped function args must be Hashable ( #3944 )
2020-05-27 20:20:56 -07:00
2a13ba9415
compileall: update for py39 ( #3956 )
...
* compileall: add stripdir, prependdir and limit_sl_dest
* compileall: compile_dir's default value is now None
* compileall: update for current py39 (as of beta1)
Co-authored-by: hauntsaninja <>
2020-05-27 20:18:19 -07:00
Rune Tynan and GitHub
7ba59719b6
Fix asyncio IocpProactor version availability ( #4121 )
2020-05-27 20:14:00 -07:00
Kunal Arya and GitHub
639771a22a
Broaden _Serialized type in protobufs to ByteString. ( #3890 )
2020-05-27 19:53:58 -07:00
Brad Solomon and GitHub
ddb47deb27
Allow Union[unicode, str] rather than just str in several places ( #3887 )
...
* Allow unicode objects throughout urlparse.py
Functions such as `urlparse()`, if given a unicode object,
will happily return a ParseResult of unicode components.
Relatedly, functions like `unquote()` will accept any of
bytes/str/unicode and return an object of the same type
or a composite containing that type.
* Allow unicode in several places in Thread
`name` and `kwargs` to Thread.__init__ function perfectly
well with unicode, not just str.
Note: the .name attribute will always be str even
if the constructor is passed something else, since
__init__ calls:
self.__name = str(name or _newname())
* Use typing.AnyStr properly
...rather than defining a new TypeVar unncessarily.
* Use typing.Text properly
Text is behaviorally equivalent to Union[str, unicode]
for Python 2 argument types.
* Remove outdated import & definition
* [check file consistent] copy changes to _dummy_threading.pyi
2020-05-27 19:52:14 -07:00
Julin S and GitHub
851efa550e
add stubs for language models ( #3848 )
...
* add stubs for language models
* fix syntax error in __init__.pyi
* fix syntax error in universaldetector.pyi
* remove erroneous imports
* delete cli directory
* make tuple types variable length
2020-05-27 19:43:04 -07:00
Michael H and GitHub
a1c6566abe
[Add stub entry for logging._srcfile] ( #3840 )
...
- While this appears to be private, it's also documented as available
to set here: https://docs.python.org/3/howto/logging.html#optimization
- Did *not* update `logging.logThreads` et al to match the
documentation as it may be more appropriate to update the
documentation to set to `False` rather than to `0` based on how these
are used
Type further narrowed based on known type of a parameter to
`os.normcase`
2020-05-27 19:42:33 -07:00
Shantanu and GitHub
fd203e663e
py39: add PEP 616 methods ( #4090 )
2020-05-27 19:24:25 -07:00
Sebastian Rittau and GitHub
694fa80596
Add dateparser module ( #4106 )
...
Based on PR 3704 by @xcthulhu (Matthew Doty)
2020-05-27 18:53:16 -07:00
02e1a68a56
argparse: add Action.format_usage ( #4114 )
...
Co-authored-by: hauntsaninja <>
2020-05-27 18:36:01 -07:00
54c99ff75f
asyncio: add shutdown_default_executor ( #4115 )
...
There are a couple other py39 changes to be made in asyncio, but I'm
trying to avoid merge issues with whitelists / Windows for now.
Co-authored-by: hauntsaninja <>
2020-05-27 18:35:39 -07:00
Rune Tynan and GitHub
d51e13ad80
Add stubtest to Travis for windows ( #4113 )
2020-05-27 18:33:07 -07:00
6575bd06bb
stubtest: run on py39 ( #4110 )
...
I've made mistakes in #4069 and #4010 that would have been caught by
this, so seems worth it to add now, and continue to remove from
whitelists.
Note that we run with --ignore-missing-stub in CI, so this whitelist
isn't all the changes we'd need to fully support Python 3.9
Co-authored-by: hauntsaninja <>
2020-05-27 12:31:16 -07:00
Rune Tynan and GitHub
0c1babd288
Make _codecs pass stubtest on windows ( #4107 )
2020-05-27 19:36:41 +02:00
Rune Tynan and GitHub
fcdfacf944
Fix stubtest failures for socketserver on windows ( #4103 )
2020-05-27 19:34:35 +02:00
Rune Tynan and GitHub
713a2729b4
Fix stubtest failures for asyncio on windows ( #4092 )
2020-05-27 19:08:19 +02:00
Rune Tynan and GitHub
ed4993bd50
Fix stubtest failures for os.__init__ on windows ( #4098 )
2020-05-27 17:25:30 +02:00
Batuhan Taskaya and GitHub
53ede5967b
is_tarfile accepts pathlike ( #3804 )
2020-05-27 17:21:55 +02:00
Rune Tynan and GitHub
e49c156d92
Add winreg stubs ( #3794 )
2020-05-27 17:15:08 +02:00
Ivan Levkivskyi and GitHub
e199c2e4bc
Fix concurrent.futures import for re-export ( #4105 )
...
Also update stubtest whitelist as a workaround.
2020-05-27 13:51:01 +01:00
Shantanu and GitHub
bdb149da78
stubtest: update version, whitelists ( #4088 )
...
This is for https://github.com/python/mypy/pull/8886
2020-05-27 10:11:52 +02:00
Rune Tynan and GitHub
7ac284f641
Add _pydecimal and _decimal stubs ( #4003 )
2020-05-27 10:10:51 +02:00
Rune Tynan and GitHub
f1d96d97fe
Fix stubtest failures for msvcrt on windows ( #4095 )
2020-05-27 10:05:33 +02:00
Zhiming Wang and GitHub
edb7dc1171
xml.etree.ElementTree: add support for os.PathLike for py36+ ( #4097 )
...
xml.etree.ElementTree uses open on filenames (e.g. [1]), so os.PathLike has
been supported as filenames since Python 3.6.
[1] https://github.com/python/cpython/blob/285ff63351bb5a42099527c283f65434e761be83/Lib/xml/etree/ElementTree.py#L584
2020-05-27 10:04:12 +02:00
Rune Tynan and GitHub
9b4eb8c90b
Fix stubtest failures for select on windows ( #4099 )
2020-05-27 09:57:06 +02:00
Rune Tynan and GitHub
8c7bfab7bd
Fix stubtest failures for selectors on windows ( #4100 )
2020-05-27 09:55:27 +02:00
Rune Tynan and GitHub
a9375cf274
Fix stubtest failures for signal on windows ( #4101 )
2020-05-27 09:54:37 +02:00
Rune Tynan and GitHub
d310a16e7c
Fix stubtest failures for time on windows ( #4104 )
2020-05-27 09:51:37 +02:00
Rune Tynan and GitHub
ab58c8148e
Fix stubtest failures on _winapi ( #4091 )
2020-05-27 09:50:00 +02:00
Rune Tynan and GitHub
19a797c0ca
Fix stubtest failures for asyncore on windows, remove unnecessary imports ( #4093 )
2020-05-27 09:42:05 +02:00
Rune Tynan and GitHub
bd6eed8700
Fix stubtest failures for mmap on windows ( #4094 )
2020-05-27 09:40:06 +02:00
Rune Tynan and GitHub
5e80ca9e44
Fix stubtest failures for path files on windows ( #4096 )
2020-05-27 09:39:26 +02:00
Rune Tynan and GitHub
f83e4aef7c
Fix stubtest failures for socket on windows ( #4102 )
2020-05-27 09:38:45 +02:00
a94d6511fd
xml.etree.ElementInclude: update include for py39 ( #4086 )
...
Co-authored-by: hauntsaninja <>
2020-05-26 17:39:36 -07:00
Shantanu and GitHub
d313e170b7
threading: update for py39 ( #4087 )
2020-05-26 17:37:07 -07:00
3eb6fb8714
functools: add cache ( #4089 )
...
Co-authored-by: hauntsaninja <>
2020-05-26 17:36:01 -07:00
Alexandre Yang and GitHub
a8834fcd46
Add pyVmomi stubs ( #3921 )
2020-05-26 12:04:56 +02:00
448c4e1fa7
asyncio.protocols: fix version availability ( #4081 )
...
Co-authored-by: hauntsaninja <>
2020-05-25 21:54:05 -07:00
Luciano Ramalho and GitHub
2f82c44af0
Hashable bounded typevar for mode, multimode ( #4084 )
...
Fixes #4057
2020-05-25 21:48:25 -07:00
3b02ce2128
Add _osx_support module ( #4002 )
...
* Add _osx_support module
* fix type
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-05-25 16:11:02 -07:00
18121d71c8
concurrent.futures: fix top level available objects, add InvalidStateError ( #4021 )
...
* concurrent.futures: add InvalidStateError
* concurrent.futures: fix package imports
* asyncio.futures: fix import
* concurrent.futures: fix version availability for BrokenExecutor
* concurrent.futures: make consistent
* concurrent.futures: update whitelist
Co-authored-by: hauntsaninja <>
2020-05-25 15:38:09 -07:00
Markus Wamser and GitHub
1996361adc
cryptography: add signature of Prehashed ( #4048 )
...
* cryptography: add signature of Prehashed
* cryptography: modify signature of Prehashed
mark internal attributes as undocumented
add public attribute digest_size
* cryptography: modify signature of Prehashed
drop Optional from argument of __init__
2020-05-25 15:36:54 -07:00
4daf0df929
tracemalloc: a number of fixes ( #4078 )
...
* tracemalloc.Frame: add __init__
* tracemalloc.Snapshot: add __init__
* tracemalloc.Snapshot: fix a staticmethod
* tracemalloc.Statistic: add __init__
* tracemalloc.StatisticDiff: add __init__
* tracemalloc.Trace: add __init__
* tracemalloc.Traceback: add __init__
* tracemalloc: fix version availability, Trace __init__
* tracemalloc.Traceback: add total_nframe property
* tracemalloc.Trace: add properties
* tracemalloc.Traceback.format: add parameter
* tracemalloc.start: make positional-only
* tracemalloc.Filter: fix version availability
* update whitelists
Co-authored-by: hauntsaninja <>
2020-05-25 15:36:35 -07:00
4b007a50b4
signal: improve version availability ( #4079 )
...
Co-authored-by: hauntsaninja <>
2020-05-25 15:29:52 -07:00
Shantanu and GitHub
6aee098401
fractions: use __new__ instead of __init__ ( #4077 )
...
Tested against some example code.
2020-05-25 15:29:28 -07:00
Shantanu and GitHub
6028226750
plistlib: update for py39 ( #4073 )
2020-05-24 20:38:18 -07:00
Shantanu and GitHub
00a27634b1
threading: fix inheritance ( #4072 )
2020-05-24 18:51:30 -07:00
9b89423f02
chardet: add default value ( #4074 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 18:48:24 -07:00
997c73ae79
travis: start testing 3.9 somewhat ( #4071 )
...
* travis: run stubtest on py39, allowing failures
* travis: run mypy with python version 3.9
* boto.compat, base64: fix version handling of (en|de)codebytes
* venv: fix #4010
Co-authored-by: hauntsaninja <>
2020-05-24 18:45:16 -07:00
8cf04f3a74
boto.compat, base64: fix version handling of (en|de)codebytes ( #4070 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 18:44:43 -07:00
8827f84763
Clarify that cryptography's Fernet accepts text keys ( #4061 )
...
* Clarify that cryptography's Fernet accepts text keys
* simplify code
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-05-24 18:44:36 -07:00
8f6fd0e05a
functools: add TopologicalSorter for py39 ( #4068 )
...
* functools: add TopologicalSorter for py39
* fix flake8 error
Co-authored-by: hauntsaninja <>
2020-05-24 18:44:28 -07:00
e560ce0f57
bisect: hi is Optional ( #4063 )
...
Shows up in 3.9 because of https://github.com/python/cpython/pull/20163
Co-authored-by: hauntsaninja <>
2020-05-24 17:53:03 -07:00
9c53756f9c
random: update for py39 ( #4069 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 17:51:53 -07:00
070be22f7e
venv: fix #4010 ( #4062 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 17:51:43 -07:00
8e03f33d84
difflib: update for py39 ( #4067 )
...
Adds default values, the hi params can now be None
Co-authored-by: hauntsaninja <>
2020-05-24 17:41:45 -07:00
2b3a4e8fbe
wave: openfp is removed in py39 ( #4064 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 17:40:20 -07:00
3910eb1735
argparse: update for py39 ( #4065 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 17:40:06 -07:00
b367799634
sunau: openfp is removed in py39 ( #4066 )
...
Co-authored-by: hauntsaninja <>
2020-05-24 17:34:48 -07:00
karl ding and GitHub
db14610298
Improve undocumented TarFile method type hints ( #4056 )
...
Add type hints for undocumented tarfile.TarFile file methods called via
_extract_member() when extract() is called.
2020-05-23 13:41:07 -07:00
Sebastian Rittau and GitHub
be016c6793
Add retry_after to TooManyRequests and ServiceUnavailable ( #4059 )
...
Added in werkzeug 1.0.0
While the implementation accepts any value for retry_after, the docstring
allows only datetime and int. Using any other value could lead to an
invalid HTTP response.
2020-05-23 13:39:48 -07:00
Nguyễn Gia Phong and GitHub
0aa9060e66
Remove context manager hints in multiprocessing.pool in Python 2 ( #4060 )
2020-05-23 22:11:19 +02:00
Jeff Hunter and GitHub
e1e99245bb
google.protobuf.message.Message.ParseFromString() returns an int ( #4053 )
2020-05-21 19:15:40 +02:00
karl ding and GitHub
9c6e8fd240
Add undocumented unittest.TextTestResult attributes ( #4052 )
...
Add missing type hints for attributes in unittest.TextTestResult.
2020-05-21 12:11:59 +02:00
Markus Wamser and GitHub
960c4eb42d
cryptography: fix signature of ECDSA ( #4049 )
2020-05-20 18:58:21 -07:00
Gal Ben David and GitHub
d11da2c5d1
revert orjson.pyi obj parameter ( #4046 )
...
After submitting a pull request to orjson repository, the author has changed the library and "obj" parameter is now positional only.
Not this behavior is aligned with the stub file and the change can be reverted.
https://github.com/ijl/orjson/releases/tag/3.0.1
2020-05-20 09:11:39 -07:00
Mark Mendoza and GitHub
092fdb2ca5
[pyre] Fix typo in click/decorators ( #4044 )
2020-05-20 00:55:34 +02:00
Serhiy Storchaka and GitHub
9902348c34
Fix stab for TextIOBase.detach() and add stab for TextIOWrapper.buffer ( #4036 )
2020-05-19 18:43:32 +02:00
Serhiy Storchaka and GitHub
de4d43612b
Add stub for TextIOWrapper.reconfigure() ( #4035 )
2020-05-19 18:02:41 +02:00
Paul Ganssle and GitHub
6fc882860b
Add type hints for the zoneinfo module ( #4038 )
...
This is the implementation for PEP 615: https://www.python.org/dev/peps/pep-0615/
It is present starting in 3.9.0 beta 1.
2020-05-18 23:16:31 +02:00
Razzi Abuissa and GitHub
18aa8e0adb
Add cli field to flask helper _PackageBoundObject ( #4040 )
2020-05-18 23:14:41 +02:00
9a5ba013a1
python3: remove _subprocess ( #4022 )
...
This doesn't seem to exist in Python 3.5, which is the earliest Python3
we support, and this folder is in stdlib/3
Co-authored-by: hauntsaninja <>
2020-05-18 14:07:08 -07:00
Nipunn Koorapati and GitHub
1436181587
Make EnumTypeWrapper generic in google.protobuf.internal ( #3995 )
...
This is necessary so that mypy-protobuf can autogenerate NewType
wrappers around the int values of the enum!
2020-05-18 21:42:47 +02:00
Nipunn Koorapati and GitHub
f0927787f0
Update type var typing on protobuf message.pyi ( #3996 )
...
Add support for message type var generics
2020-05-18 11:59:37 -07:00
Razzi Abuissa and GitHub
949378fdd9
flask: Add types for cli_group argument to flask.Blueprint ( #4011 )
...
* Add types for cli_group argument to flask.Blueprint
* Use private _Sentinel type for default argument to Blueprint cli_group
2020-05-18 11:58:42 -07:00
Shantanu and GitHub
1f7023b957
subprocess: mark arg keyword-only, fix name, add property ( #4024 )
2020-05-18 18:59:34 +02:00
Rebecca Chen and GitHub
5fe6a5ba8b
parser: STType.compile() can be called with no arguments. ( #4034 )
...
The filename parameter is optional:
https://docs.python.org/3/library/parser.html#parser.ST.compile .
2020-05-18 08:30:52 -07:00
Rebecca Chen and GitHub
037377f502
Mark the arguments to os.killpg as positional-only in Python 2. ( #4033 )
...
This was already done in Python 3. In Python 2 as well, this method does
not take keyword arguments.
2020-05-17 18:06:35 -07:00
Rebecca Chen and GitHub
a70f4893f8
Add undocumented attribute queue.Queue.queue with type Any. ( #4032 )
...
This attribute was removed in
https://github.com/python/typeshed/pull/3879 because it is undocumented
and was annotated incorrectly. Unfortunately, a surprising (?) amount of
Google code uses this attribute and assumes it is a deque, so it needs
to exist but can't have a more general annotation like Collection[Any].
I also removed a no-longer-used typing.Deque import.
2020-05-17 18:05:52 -07:00
Rebecca Chen and GitHub
53f4f68d71
saxutils.XMLGenerator should accept unicode encodings in Python 2. ( #4031 )
2020-05-17 18:05:21 -07:00
Rebecca Chen and GitHub
8366aa44bb
Add mistakenly removed constants back to tokenize. ( #4030 )
...
These constants were removed in
https://github.com/python/typeshed/pull/3839 because they are imported
from token. However, that is only true in Python 3.7+.
2020-05-17 18:05:07 -07:00
a675778140
dis: various fixes to dis.dis ( #4027 )
...
Co-authored-by: hauntsaninja <>
2020-05-17 08:59:11 -07:00
26566af893
bisect: fix availability, consistency, reduce duplication ( #4028 )
...
Co-authored-by: hauntsaninja <>
2020-05-17 08:52:37 -07:00
462a3e9dcd
asyncio: fix signature of set_write_buffer_limits ( #4025 )
...
Co-authored-by: hauntsaninja <>
2020-05-17 08:50:31 -07:00
4405250ed1
pyclbr: add parent argument for py37 on ( #4029 )
...
Co-authored-by: hauntsaninja <>
2020-05-17 08:25:18 -07:00
9c9eae8462
opcode: fix positional-only args ( #4026 )
...
Co-authored-by: hauntsaninja <>
2020-05-17 07:20:28 -07:00
4a9fdcc7fc
uuid: update for py39 ( #4023 )
...
Closing the long loop started in #3715
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com >
2020-05-16 21:30:45 -07:00
5a3a47264f
ast: add indent to dump in py39 ( #4007 )
...
Co-authored-by: hauntsaninja <>
2020-05-16 17:03:03 -07:00
Shantanu and GitHub
061e58deb8
_ast: fix version availability for py39, fix up some visit_ methods ( #4008 )
2020-05-16 17:02:08 -07:00
fe26ce99da
venv: update for py39 ( #4010 )
...
Co-authored-by: hauntsaninja <>
2020-05-16 17:01:33 -07:00
bedccc7497
fractions: remove gcd in py39 ( #4012 )
...
Co-authored-by: hauntsaninja <>
2020-05-16 16:57:19 -07:00
Rebecca Chen and GitHub
b8b656b437
Import builtins._PathLike instead of os.PathLike in genericpath. ( #4013 )
...
os imports genericpath, so genericpath importing os creates a circular
import that confuses pytype.
2020-05-16 16:56:40 -07:00
Shantanu and GitHub
a997d527fa
sys: update for py39 ( #4018 )
2020-05-16 16:52:56 -07:00
4630f245cc
bz2: update for py39 ( #4015 )
...
Co-authored-by: hauntsaninja <>
2020-05-16 16:52:42 -07:00
3b4b2bfad5
base64: update for py39 ( #4016 )
...
Co-authored-by: hauntsaninja <>
2020-05-16 16:51:53 -07:00
23d85bb45e
nntplib: update for py39 ( #4017 )
...
Undocumented change, because these were never documented: https://bugs.python.org/issue39366
Co-authored-by: hauntsaninja <>
2020-05-16 16:51:13 -07:00
765cd11704
base64: arguments can be None ( #4020 )
...
Co-authored-by: hauntsaninja <>
2020-05-16 16:47:45 -07:00
58147cab20
aifc: fix mode default ( #4019 )
...
By default, if not specified, these functions use the mode from the file
Co-authored-by: hauntsaninja <>
2020-05-16 16:47:14 -07:00
Rebecca Chen and GitHub
af01f1f4be
uuid: import enum inside version check. ( #4009 )
...
Otherwise, pytype tries to import enum in Python 2 and complains that
the library doesn't exist.
2020-05-17 01:32:07 +02:00
Shantanu and GitHub
0a69743bca
hashlib: fix argument kinds, update for py39 ( #4006 )
...
* hashlib: add usedforsecurity in py39
* hashlib: fix positional-only args, arg names
* hashlib: fix positional and keyword only args for blake
* hashlib: add usedforsecurity to blake
2020-05-17 01:31:12 +02:00
Rune Tynan and GitHub
f56fdb99d1
Add _compat_pickle module ( #4001 )
...
* Add _compat_pickle module
* Whoops, rename .py to .pyi
* Fix value not existing in 3.5
2020-05-16 06:57:32 -07:00
Steve Dignam and GitHub
e5dcf06c9e
Update array with more precise type for typecodes ( #3994 )
...
Fixes #3946
2020-05-15 11:55:40 +02:00
Graham Bleaney and GitHub
6dca3f7fc5
New attributes and types on HTTPServerRequest ( #3971 )
...
Porting type information directly from the tornado repository:
https://github.com/tornadoweb/tornado/blob/712d61079defdad23b0a5e9fe0090b54e55cf7d0/tornado/httputil.py#L340-L384
2020-05-14 08:20:24 -07:00
0630c4b1fd
unittest.mock: fix MRO of Mock ( #3990 )
...
* unittest.mock: fix MRO of Mock
* Make consistent
Co-authored-by: hauntsaninja <>
2020-05-14 08:57:50 +02:00
Shantanu and GitHub
baf107a158
check_consistent: print a copy-pasteable cp command ( #3992 )
2020-05-14 08:57:18 +02:00
ad6cf3a314
email.errors: fix aliased class ( #3988 )
...
Co-authored-by: hauntsaninja <>
2020-05-13 19:47:53 -07:00
cc0ffb1648
asyncio.protocols: BufferedProtocol inherits from BaseProtocol ( #3989 )
...
Co-authored-by: hauntsaninja <>
2020-05-13 19:08:47 -07:00
Sam Bull and GitHub
6932ff26c5
Set default for newstyle ( #3962 )
...
* Set default for newstyle
* Change default values to ...
2020-05-13 18:01:30 -07:00
Shantanu and GitHub
3662bf89d5
asyncio.locks: fix _ContextManagerMixin base class ( #3979 )
2020-05-13 17:57:02 -07:00
Rune Tynan and GitHub
e9c7ef7406
Add private _bootlocale stub ( #3985 )
2020-05-13 15:19:18 -07:00
Gal Ben David and GitHub
d1ef2fff7a
added multiprocessing.connection.Connection constructor definition ( #3974 )
2020-05-13 15:13:06 -07:00
Selim Belhaouane and GitHub
3ac1f86499
Change return annotation of Popen.poll to Optional[int] ( #3986 )
...
Fixes #3984
2020-05-13 10:18:25 -07:00
Rune Tynan and GitHub
65b3ef91fd
Remove class variable overrides ( #3987 )
2020-05-13 10:16:38 -07:00
dosisod and GitHub
2ead8123a6
Add Waitress stubs ( #3889 )
2020-05-13 16:22:13 +02:00
Rune Tynan and GitHub
b8045a3fb2
Add xmlrpc package ( #3834 )
...
* Add xmlrpc client module
* Add xmlrpc server module, update client
* Fix mypy errors with protocol and Dict fix
* Add Type[] around requestHandler
* Fix docroutine incompatible override
* Whoops, ignored is also missing
* Remove unnecessary str/repr overrides
* Remove unnecessary __eq__ and quotes around Unmarshall. DateTime __eq__ left for now
* Fix problems from review
* Fix various version-specific differences, make request_type conservative (only bytes, guaranteed to have same len as number of bytes)
* Silly misspelling
* Change from IO to ad-hoc minimal protocols
2020-05-13 07:17:17 -07:00
Kazushi Kitaya and GitHub
d39e58c3bc
asyncio.subprocess: returncode is Optional ( #3981 )
2020-05-13 16:14:42 +02:00
Joost Cassee and GitHub
09093435c3
Make HTTPPasswordMgrWithDefaultRealm realm optional ( #3976 )
...
* Make HTTPPasswordMgrWithDefaultRealm realm optional
* Optional realm in HPMWDefaultRealm.find_password
2020-05-13 15:11:22 +02:00
Jelle Zijlstra and GitHub
d55df54ae2
upgrade flake8 ( #3980 )
2020-05-13 08:52:40 +02:00
e0f9242e76
io: StringIO seems happy enough to take None ( #3973 )
...
Didn't check C code, but the _pyio implementation explicitly checks for
None
Co-authored-by: hauntsaninja <>
2020-05-12 18:33:48 -07:00
111f3f02ef
socket: fix default mode for makefile ( #3978 )
...
Fixes #3977
Co-authored-by: hauntsaninja <>
2020-05-12 18:22:25 -07:00
Gal Ben David and GitHub
1d2ec3cd3b
Update orjson.pyi to support two new flags ( #3975 )
...
Updated orjson.pyi to support two new added flags `OPT_INDENT_2` and `OPT_NON_STR_KEYS`.
Renamed `__obj` to `obj` to allow using named parameter `obj` instead of positional, without getting errors.
2020-05-12 18:06:06 -07:00
637dba1beb
concurrent.futures: fix BrokenProcessPool base ( #3972 )
...
Co-authored-by: hauntsaninja <>
2020-05-11 21:52:55 -07:00
Graham Bleaney and GitHub
66cd36268a
Refine types on tornado.web.RequestHandler ( #3970 )
...
This diff refines the types on `RequestHandler` by porting types directly from the `tornado` repo.
2020-05-08 20:52:14 +02:00
Bruce Merry and GitHub
c81b3cfe59
Fix some incorrect redis Text annotations ( #3969 )
...
I've changed some instances of `Text` to `_Key` so that bytes will be
accepted as well. I'm not sure if they should be `_Str` instead. The
existing annotations seem to use a mix of the two. _Str is a better
reflection of what redis-py will accept (any arguments that it passes
through to the redis server can be _Str and it'll convert to bytes); but
passing an int or float where a key is expected may be a code smell.
2020-05-07 19:32:56 -07:00
Ivan Levkivskyi and GitHub
5342d66dcc
Fix assert_has_calls() signature ( #3967 )
...
See the docs https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_has_calls
2020-05-05 19:20:56 +01:00
Ivan Levkivskyi and GitHub
8c7f489d1b
Organize special forms in typing ( #3966 )
...
This is an accompanying PR for https://github.com/python/mypy/pull/8779 , see https://github.com/python/mypy/pull/8779#issuecomment-624001349
I also noticed that Python 2 and Python 3 versions are a bit out of sync, so I also put them back in sync.
2020-05-05 13:55:31 +01:00
Rahix and GitHub
d818821121
atomicwrites: Allow any PathLike for paths ( #3965 )
...
As of version 1.4.0, from PR untitaker/python-atomicwrites#48 ,
atomicwrites allows any PathLike object for its path args.
2020-05-05 14:01:24 +02:00
Shantanu and GitHub
e857ad6ba9
zip: add some overloads for heterogeneous tuples ( #3830 )
...
Technically this is a lie, since we return a heterogeneous iterator, not
a tuple. But since we don't have a way of typing heterogeneous
iterators, this is the best we can do.
Fixes https://github.com/python/mypy/issues/8454
2020-05-03 21:02:26 -07:00
Paul Ganssle and GitHub
3dfc606670
Correct return type of time.dst ( #3964 )
...
`time.dst` either returns None or the result of tzinfo.dst(None), which
returns datetime.timedelta
2020-05-03 23:13:22 +02:00
Sam Bull and GitHub
545be37c40
Allow Path in gettext. ( #3958 )
2020-05-01 10:43:19 -07:00
Luciano Ramalho and GitHub
38330702fd
Sortable protocol for statistics.median_high/median_low; fix #3894 ( #3961 )
2020-04-30 22:08:09 -07:00
fec46043ed
asyncio: various fixes ( #3947 )
...
* asyncio: remove BaseChildWatcher from top level
* asyncio.sleep: loop is keyword-only
* asyncio: remove Server from top level
* asyncio: add FastChildWatcher to top level
* asyncio.constants: fix version availability
* asyncio: fix arg name for _wakeup
* asyncio: fix arg name for wrap_future
* asyncio.streams: add Optional to various arguments
It might be possible to further improve some of these with overloads.
* stubtest: fix whitelist
Co-authored-by: hauntsaninja <>
2020-04-30 17:04:36 -07:00
Anis and GitHub
630b50e458
feat(3rd_party): adding stub for tzlocal ( #3948 )
...
- tzlocal uses pytz types
2020-04-29 22:28:01 -07:00
7766b2d92b
Use IO[bytes] instead of BytesIO for wave input signatures as it is t… ( #3952 )
...
* Use IO[bytes] instead of BytesIO for wave input signatures as it is the (slightly) more general type.
* add missing import
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-04-29 21:54:34 -07:00
88440b768c
http: add py39 status codes ( #3955 )
...
Co-authored-by: hauntsaninja <>
2020-04-29 20:47:28 -07:00
Anthony Sottile and GitHub
bc90043e54
update Subscript.slice type for python3.9 ( #3950 )
2020-04-28 17:32:08 -07:00
Javier Honduvilla Coto and GitHub
f7d240f06e
ctypes.CDLL name can be None ( #3945 )
2020-04-26 15:51:38 +02:00
Kjell Braden and GitHub
aa06f3bc7b
use socket.sendto argument spec for DatagramTransport ( #3943 )
2020-04-25 13:23:29 +02:00
Jia Chen and GitHub
db2ee3cf3c
Replace value assignments with import statements in requests.__init__ ( #3941 )
2020-04-25 13:18:03 +02:00
Lars and GitHub
9dab57b0e8
Fix attr-defined check for werkzeug.wrappers.BaseRequest ( fixes #3913 ) ( #3925 )
...
The PR #2740 added __setattr__ and __getattr__ to the
werkzeug.wrappers.BaseRequest definition to silence mypy when
monkeypatching this class.
The change disabled the errors for monkeypatching, but disabled disabled the
important check attr-defined.
2020-04-25 13:14:31 +02:00
Max R and GitHub
31705fca7a
Add misc types for mock and unittest.mock ( #3923 )
2020-04-24 08:51:34 +02:00
Sebastian Rittau and GitHub
92f52a2615
flake8 updates and cleanups ( #3940 )
...
* flake8 updates and cleanups
* Update to flake8 3.7.9.
* Update to flake8-bugbear 20.1.4.
* Only ignore errors in stub files.
* Remove obsolete error counts.
* Sort error codes alphabetically.
* Don't ignore the following errors (unneeded):
* E704 Multiple statements on one line (def)
* W504 Line break occurred after a binary operator
* B303 __metaclass__ used
* Remove obsolete comment
* Ignore F822 undefined name in __all__
2020-04-23 19:38:47 -07:00
aa84ff750e
asyncio: remove private methods that don't exist ( #3938 )
...
Co-authored-by: hauntsaninja <>
2020-04-23 19:20:57 -07:00
Sebastian Rittau and GitHub
733c558d60
Add msilib and _msi to stubtest whitelist ( #3939 )
...
* Add msilib and _msi to stubtest whitelist
* Group Windows-only modules
* Move win modules to bottom
Make win modules optional
2020-04-23 19:09:52 -07:00
Rune Tynan and GitHub
19eade5e44
Add msilib and _msi ( #3651 )
2020-04-22 20:02:19 +02:00
Shantanu and GitHub
496d758769
typing: minor changes ( #3933 )
...
* typing: fix argument names of cast
* typing: use private _Alias class
For py37 and above, this is _GenericAlias, for py36 and below it's
_TypeAlias. I don't think we need to make typing.pyi definitions
correspond more precisely, but we should avoid leaking a
typing.TypeAlias class
2020-04-22 19:38:47 +02:00
Shantanu and GitHub
0532e72e7f
asyncio: mark positional-only args ( #3934 )
2020-04-22 19:34:30 +02:00
Brian Turek and GitHub
990e648928
Change run_in_executor to return a Future rather than be a coroutine ( #3935 )
2020-04-22 19:00:13 +02:00
Alex McGrath Kraak and GitHub
51e5b98076
Fix ftplib .size return type to be an int ( #3937 )
...
Close #3927
2020-04-22 10:06:58 +02:00
Brian Turek and GitHub
6e9e059f0c
Add return type for pathlib.Path.replace on Python >= 3.8 ( #3936 )
2020-04-22 01:52:33 +02:00
Shantanu and GitHub
ec57251010
asyncio.events: various fixes ( #3931 )
...
- connect_accepted_socket isn't a member of AbstractEventLoop, only
BaseEventLoop
- fix types of arguments with defaults. some of these functions could
have their signatures improved with overloads to reduce false negatives
- correctly mark a positional-only argument
- remove abstractmethod from methods that don't have abstractmethod and
go unimplemented in practice
2020-04-20 17:56:24 -07:00
Shantanu and GitHub
626a0f3f73
asyncio.subprocess: loop is Optional ( #3930 )
2020-04-20 12:20:08 +02:00
Anthony Sottile and GitHub
8e46eb7b85
create_subprocess_shell takes a single positional argument ( #3929 )
2020-04-19 13:46:37 +02:00
Philipp Hahn and GitHub
84147ec9cb
sockeserver: Add undocumented internals ( #3924 )
...
the `rfile` and `wfile` members are already implemented by
StreamRequestHandler. In addition to them several (undocumented)
class and instance variables exist according to
<https://github.com/python/cpython/blob/master/Lib/socketserver.py#L742 >:
- `rbufsize`
- `wbufsize`
- `timeout`
- `disable_nagle_algorithm`
- `packet` and `socket` for datagrams
The already exist with Python 2.7
<https://github.com/python/cpython/blob/2.7/Lib/SocketServer.py#L677 >
```mermaid
classDiagram
BaseRequestHandler <|-- DatagramRequestHandler
BaseRequestHandler <|-- StreamRequestHandler
StreamRequestHandler <|-- BaseHTTPRequestHandler
```
2020-04-14 13:22:40 -07:00
Denis Laxalde and GitHub
b3c86bd7ff
Fix type of of optparse.Option's _{check,set}_opt_strings() methods ( #3895 )
2020-04-10 00:17:34 +02:00
Florian Ludwig and GitHub
00f5240b88
add more constants to tarfile ( #3917 )
2020-04-09 14:42:11 +02:00
Peter Pentchev and GitHub
0503fb0f50
Fix some pkg_resources variable types. ( #3919 )
...
Allow passing proper metadata to Distribution.from_location() and
Distribution.from_filename().
Correct the order of arguments for the importer functions.
Note that some functions accept any iterables, not just sized ones.
Correct the type of the VersionConflict classes' context.
2020-04-09 12:22:14 +02:00
Peter Pentchev and GitHub
0d7665d7b8
SyntaxError's filename and lineno may be undefined. ( #3918 )
...
The Python source (Objects/exceptions.c) explicitly checks for null
pointers before using the filename and lineno members. Some libraries,
e.g. pkg_resources, set filename and lineno to undefined values if
indeed none are appropriate.
2020-04-08 20:50:49 +02:00
Benjamin Poirier and GitHub
ea919fdce9
email: Fix BytesFeedParser method arg ( #3916 )
2020-04-08 09:28:02 +02:00
Jocelyn Boullier and GitHub
60cdee5b2d
ftplib: fix all_errors type to tuple of type of exception ( #3910 )
2020-04-05 09:02:34 -07:00
Debjyoti Biswas and GitHub
af3596f950
Add array.array type to zlib.crc32 ( #3904 )
2020-04-05 09:02:02 -07:00
Jelle Zijlstra and GitHub
23e380ac83
add overload to difflib.get_close_matches ( #3908 )
...
Fixes #3906 . Fixes #2067 .
2020-04-05 14:12:29 +02:00
Vishal Kuo and GitHub
12b53fa46d
[redis] add some missing stubs to redis ( #3907 )
2020-04-04 21:51:06 -07:00
Ethan Smith and GitHub
8b3e27d76d
Fix _winapi stub ( #3903 )
2020-04-04 21:26:47 +02:00
e56adddc48
dataclasses: change hash to unsafe_hash, add a minor overload ( #3892 )
...
Co-authored-by: hauntsaninja <>
2020-04-03 17:23:05 -07:00
Shantanu and GitHub
591522fb6a
functools.singledispatchmethod: add __call__ for better results ( #3899 )
...
It doesn't actually have __call__, it does some descriptor stuff, but
this makes things work. _SingleDispatchCallable has a __call__ too,
which is what this mirrors.
Fixes #3898
2020-04-03 17:17:26 -07:00
David Euresti and GitHub
5f4ad2b014
Update stubs for attrs 19.3.0 ( #3900 )
2020-04-02 20:14:53 +02:00
Debjyoti Biswas and GitHub
f4a646d43c
Add PathLike to genericpath.exists and re-export ( #3897 )
...
Closes#3492
2020-04-02 09:51:59 +02:00
Debjyoti Biswas and GitHub
cb87bd1f53
Remove queue ( #3879 )
2020-04-01 10:47:36 -07:00
Shantanu and GitHub
ab6811aa4f
yaml: fix python version availability ( #3891 )
2020-03-31 17:05:39 +02:00
Katelyn Gigante and GitHub
bf502024da
Return types for some flask methods ( #3888 )
2020-03-31 16:44:47 +02:00
Christopher Whelan and GitHub
410174d90e
Add types for distutils.command.config ( #3739 )
2020-03-28 18:54:06 -07:00
Debjyoti Biswas and GitHub
132aebd2d8
Add stub for PathFinder and remove whitelist ( #3885 )
2020-03-28 13:29:49 -07:00
68238e0c9e
stubtest whitelists: use regexes, add comments ( #3883 )
...
Co-authored-by: hauntsaninja <>
2020-03-27 10:27:16 -07:00
Diego Elio Pettenò and GitHub
71804c38fc
Add empty stubs for xml.dom.* modules. ( #3856 )
2020-03-27 09:13:37 +01:00
Jaromir Latal and GitHub
d4c3ccbc16
[stdlib][xml] Initial typestubs for xml.dom ( #3852 )
2020-03-27 09:12:09 +01:00
Julian Andres Klode and GitHub
009b269882
fcntl: make mutate_flag optional for ioctl w/ read-only buffer ( #3882 )
...
Fixes #3881
2020-03-24 15:54:59 +01:00
Debjyoti Biswas and GitHub
e571d1a2c2
Change Task[Any] to Task[_T] in return statements ( #3878 )
2020-03-24 15:46:03 +01:00
Rodrigo Castro and GitHub
4b14e245d4
Mock and MagickMock subclassing NonCallableMock ( #3871 )
2020-03-24 15:32:57 +01:00
Florimond Manca and GitHub
efe23f8cc1
Add ssl.PROTOCOL_TLS for Python 2.7 ( #3855 )
2020-03-24 00:12:32 +01:00
Debjyoti Biswas and GitHub
56d557bbcd
Add support for PathLike to mimetypes.guess_types() ( #3874 )
2020-03-22 11:50:48 -07:00
Shantanu and GitHub
4de4cd0428
locale: various improvements ( #3860 )
...
- fix delocalize return type
- fix arg names
- add missing args
2020-03-22 08:53:32 -07:00
Debjyoti Biswas and GitHub
8ac3e46074
Add type annotations for Pathlike arguments ( #3864 )
...
* Add type annotations for Pathlike arguments
* Add version checks
* Change version
* Change to PathLike
2020-03-22 08:53:14 -07:00
Debjyoti Biswas and GitHub
66c20e6b43
Add stub for typing.ForwardRef ( #3876 )
...
* Add stub for class ForwardRef
* Add anotation for localns
* PEP8 and add version info check
2020-03-22 08:51:59 -07:00
c12162e4a1
add missing multiprocessing.connection.Connection context manager methods ( #3875 )
...
Co-authored-by: Ben Motz <ben.motz@bluwireless.com >
2020-03-22 08:50:50 -07:00
Debjyoti Biswas and GitHub
6d3af1c472
Add stubs for multiprocessing.managers.Token ( #3872 )
2020-03-22 08:47:15 -07:00
Rodrigo Castro and GitHub
ef1d7853ee
stdlib.3.unitest.mock.NonCallableMock signatures ( #3846 )
2020-03-20 14:37:18 +01:00
coiax and GitHub
cd1b56662c
Fixes inaccuracies in redis scan methods ( #3870 )
...
The scan() and scan_iter() methods for redis Client objects had
incorrect stubs, this has been fixed.
Tested on pyredis 3.3.8; the output of those functions does depend on
the `decode_responses` configuration, so Any was used instead of a Union
return type.
2020-03-20 12:15:51 +01:00
Debjyoti Biswas and GitHub
24691fa03a
Adding stubs for multiprocessing.managers BaseProxy ( #3868 )
2020-03-20 12:11:53 +01:00
1422fce882
pstats: fix stream type, add class var ( #3862 )
...
Co-authored-by: hauntsaninja <>
2020-03-18 17:49:54 -07:00
2be4dcae03
pydoc: various improvements ( #3863 )
...
Co-authored-by: hauntsaninja <>
2020-03-18 17:47:17 -07:00
Oleg Höfling and GitHub
dc060fac2a
on windows, resolve proactor and selector event loop policies only for python 3.7 and newer ( #3866 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-03-18 17:42:01 -07:00
Shantanu and GitHub
56e2e475e9
plistlib: fix arg name, add exception ( #3861 )
2020-03-18 10:38:19 +01:00
Shantanu and GitHub
814cf53597
doctest: fix testmod types ( #3859 )
2020-03-17 19:44:51 +01:00
Sahith Nallapareddy and GitHub
8e0af4e651
Adding datetimerange stubs ( #3845 )
2020-03-17 15:57:36 +01:00
Shantanu and GitHub
4ccc757d1a
macpath: fix arg names, remove nonexistent functions ( #3853 )
...
* macpath: fix arg names
* macpath: remove commonpath, relpath
2020-03-17 15:05:23 +01:00
Peter Pentchev and GitHub
92741c74ff
subprocess.Popen(cwd) is optional in Python 2.x, too. ( #3857 )
2020-03-17 14:39:05 +01:00
Debjyoti Biswas and GitHub
c0938525d8
Add methods for subnet_of and supernet_of ( #3851 )
2020-03-17 10:06:49 +01:00
1b13e94108
yaml: mark keyword-only args ( #3854 )
...
Co-authored-by: hauntsaninja <>
2020-03-16 15:51:12 -07:00
Shantanu and GitHub
c50fce6ef3
travis: update stubtest version ( #3835 )
...
* stubtest whitelists: add json.loads
2020-03-15 12:52:12 +01:00
4b360ca2c8
TypedDict: fix keys, values, items return value ( #3529 )
...
Fixes #3473
Co-authored-by: hauntsaninja <>
2020-03-13 21:03:22 -07:00
Jan Verbeek and GitHub
6f159d9fc6
Make Python 2's inspect more tolerant of unicode ( #3847 )
2020-03-13 20:48:42 -07:00
Ben Leslie and GitHub
01d4a4c395
Change return type of Future.exception to be Optional[BaseException] ( #3849 )
...
Future.exception can return None if no exception was capture in the future.
As documented: https://docs.python.org/3/library/asyncio-future.html#asyncio.Future.exception
2020-03-13 20:38:58 -07:00
Julin S and GitHub
b44cd294c4
add chardet.universaldetector ( #3734 )
2020-03-12 18:20:41 +01:00
Mickaël Schoentgen and GitHub
62f1aa5385
Fix signature of Connection.iterdump() ( #3843 )
2020-03-12 13:48:20 +01:00
Tim Hatch and GitHub
508fd84499
Expand tokenize stub to include Intnumber etc ( #3839 )
...
The all uppercase tokens, as well as tok_name mentioned in the comment
actually come from the `from token import *`.
2020-03-11 10:54:19 -07:00
Andrew Svetlov and GitHub
52d3b9eaba
Fix remove_child_handler() return type ( #3841 )
2020-03-11 14:50:06 +01:00
Jukka Lehtosalo and GitHub
5162c536c8
Make attributes of inspect.ArgSpec optional in Python 3 ( #3838 )
...
This makes them consistent with Python 2 stubs.
The attributes are documented here:
https://docs.python.org/3/library/inspect.html#inspect.getargspec
2020-03-10 13:15:20 +01:00
Rune Tynan and GitHub
2b8b116a19
Make PathMatcher correctly exclude paths on windows / any OS without / seperators ( #3837 )
2020-03-09 15:33:19 -07:00
Shantanu and GitHub
d8b081130d
email.mime: add policy arguments ( #3827 )
2020-03-08 16:06:55 +01:00
Shantanu and GitHub
60c59a560e
select: various fixes ( #3833 )
2020-03-07 13:06:16 +01:00
Shantanu and GitHub
2d3635f10d
os: fix platform availability ( #3832 )
2020-03-07 12:59:55 +01:00
Rebecca Chen and GitHub
37051ec699
Have datetime.{date,datetime} define __new__ instead of __init__. ( #3829 )
...
This is more faithful to the implementation:
https://github.com/python/cpython/blob/3.5/Lib/datetime.py .
When these classes define __init__, pytype has trouble type-checking
classes that inherit from datetime.datetime (done in, e.g., the third party
datetime_tz library) because it gets confused about what arguments the
constructor expects.
2020-03-07 12:52:04 +01:00
Shantanu and GitHub
de4305760d
configparser: add undocumented parameter to SectionProxy.get ( #3826 )
2020-03-07 12:46:32 +01:00
Shantanu and GitHub
c478d3aa98
asyncio: add arguments to subprocess_shell ( #3825 )
2020-03-07 12:45:30 +01:00
2d82e1fb8b
zipfile.ZipFile: fix fp, extract ( #3828 )
...
* zipfile: fp is None in a lot of error cases
* zipfile: pwd can be None in extract
Co-authored-by: hauntsaninja <>
2020-03-06 14:57:06 -08:00
Rune Tynan and GitHub
e5a276c94f
Add parser stubs ( #3822 )
2020-03-06 20:34:05 +01:00
Ran Benita and GitHub
92d53086be
stdlib/3/ast: add visit_* methods to NodeVisitor ( #3796 )
...
NodeVisitor recurses over an AST tree. When encountering a node, it
checks if a method called `visit_{node.__class__.__name__}` exists, and
calls it if so, otherwise calls the generic visitor.
Add the possible methods to NodeVisitor. This is not exactly correct,
since the methods don't *actually* exist on NodeVisitor, e.g.
`NodeVisitor().visit_Module(...)` doesn't work. But it's nice for
subclasses to know which methods they can override and which type they
should have.
2020-03-06 13:15:04 +01:00
Lawrence and GitHub
337051501b
Update imghdr's what() to broadly accept readable binaries instead of BinaryIO ( #3811 )
...
* Run isort over imghdr.pyi
2020-03-06 12:51:37 +01:00
Shantanu and GitHub
89afe1e014
statistics: fix median_grouped, NormalDist.samples ( #3818 )
2020-03-06 11:34:04 +01:00
Shantanu and GitHub
98c6bf8272
argparse: allow passing a callable to ArgumentParser ( #3821 )
...
Fixes #3806
2020-03-06 11:24:50 +01:00
Shantanu and GitHub
e2a409291d
asyncore: various fixes ( #3820 )
2020-03-06 11:23:03 +01:00
Shantanu and GitHub
af09df9b48
textwrap: various fixes ( #3819 )
2020-03-06 11:12:24 +01:00
Shantanu and GitHub
3c770a7a17
pdb: various fixes ( #3817 )
2020-03-06 11:07:52 +01:00
Shantanu and GitHub
6b4fd79808
builtins: add mod to various power functions ( #3816 )
2020-03-06 11:07:05 +01:00
Shantanu and GitHub
b208f21fbd
imghdr: h can be None ( #3815 )
2020-03-06 11:03:11 +01:00
Shantanu and GitHub
009e650a1d
string: various fixes ( #3814 )
2020-03-06 11:02:18 +01:00
Shantanu and GitHub
11d300587e
urllib: various fixes ( #3813 )
2020-03-06 11:01:19 +01:00
Jelle Zijlstra and GitHub
e9a9103afc
bring back attribute types in warnings.WarningMessage ( #3810 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-03-05 17:15:13 -08:00
Ivan Levkivskyi and GitHub
aa945cde03
Add six.moves.collections_abc. ( #3812 )
2020-03-06 00:13:24 +00:00
Jukka Lehtosalo and GitHub
1c08bf7fa2
Improve an annotation in tornado stubs ( #3809 )
2020-03-05 14:34:14 +00:00
Sebastian Rittau and GitHub
68190cefde
Fix stubs for pymysql ( #3781 )
2020-03-05 09:21:52 +01:00
Jelle Zijlstra and GitHub
6a4044fd9b
Make frozenset covariant ( #3808 )
...
The convariance was lost in #1057
2020-03-04 19:24:03 -08:00
Ivan Levkivskyi and GitHub
8b28b49c61
Mark some obviously incomplete stubs as incomplete ( #3807 )
2020-03-04 17:02:14 +00:00
Rune Tynan and GitHub
efebe6bcec
Add venv module stub ( #3783 )
2020-03-03 10:48:52 +01:00
Ivan Levkivskyi and GitHub
e7d68027e7
Fix some issues in cryptography ( #3802 )
2020-03-02 18:50:45 +00:00
Ran Benita and GitHub
36c6f94de4
stdlib/2and3/builtins: change dict.fromkeys to classmethod ( #3798 )
...
The referenced issue in mypy is fixed.
2020-03-01 23:25:52 -08:00
petsuter and GitHub
95002966ec
Annotations for Py3.6 tkinter additions ( #3778 ) ( #3797 )
...
* Add tkinter.Variable.trace_add()
* Add tkinter.Variable.trace_remove()
* Add tkinter.Variable.trace_info()
https://docs.python.org/3.6/whatsnew/3.6.html#tkinter
2020-03-01 08:53:01 -08:00
Rune Tynan and GitHub
3926e88d13
Add macurl2path stub ( #3785 )
...
* Add macurl2path stub, types based on urllib
* Fix types, remove undocumented
The whole module is undocumented, no reason to just mention it on one call
* Module was removed in 3.7, stubtest shouldn't care about it
* Module was removed in 3.7, stubtest shouldn't care about it
2020-02-29 22:03:50 -08:00
Shantanu and GitHub
b94d23c608
struct: fix arg names, mark positional-only args ( #3792 )
2020-02-29 14:42:04 +01:00
Ran Benita and GitHub
0705cd6435
stdlib/3/importlib/metadata: add missing "group" attribute to EntryPoint ( #3795 )
2020-02-29 14:26:24 +01:00
Shantanu and GitHub
83833116bd
datetime: mark positional-only args ( #3791 )
2020-02-29 14:18:34 +01:00
Shantanu and GitHub
558d88ef92
cgi: various improvements ( #3790 )
...
- add max_num_fields to FieldStorage
- fix various types based on default values
2020-02-29 14:18:06 +01:00
Shantanu and GitHub
e4b4cd99c0
ssl: various fixes ( #3789 )
...
* ssl: fix arg names, mark positional-only args
* ssl: add undocumented parameter to do_handshake
* ssl: fix type of password in load_cert_chain
* ssl: add session parameter to wrap_socket, wrap_bio in py36 on
* ssl: update whitelists
2020-02-29 14:08:47 +01:00
PGijsbers and GitHub
16ba411434
Change annotation of 'function' in Timer.__init__ from Callable[..., None] to Callable[..., Any] ( #3788 )
...
The return value is ignored, but calling a function with a return value should still be valid.
Closes : #3782
2020-02-29 14:05:23 +01:00
Shantanu and GitHub
aa6e3efcca
README.md: better document test_stubtest pitfall ( #3793 )
...
Document that the test will likely fail locally, to help cases like #3782
2020-02-29 13:58:47 +01:00
Andrew and GitHub
d53977221a
Added count argument to spop ( #3786 )
...
* Added `count` argument to `spop`
* Fixed default value
2020-02-28 22:07:15 +01:00
Rune Tynan and GitHub
070a4da85d
Add this module ( #3784 )
2020-02-27 19:18:54 -08:00
Ivan Levkivskyi and GitHub
ca1ca0c14f
Move tornado to 2and3 ( #3780 )
...
This also uses a trick to avoid `Incompatible with supertype` errors for `get()` etc. that used to have signature like `def get(*args, **kwars): ...` (that btw is used in tornado itself, see https://github.com/tornadoweb/tornado/blob/master/tornado/web.py#L266 ).
2020-02-26 22:53:48 +00:00
Ivan Levkivskyi and GitHub
6d33cf3382
Move gflags to 2and3 ( #3779 )
...
Move gflags to 2and3
2020-02-26 17:57:50 +00:00
Shantanu and GitHub
1704d7f58c
stubtest: remove entry from whitelist ( #3776 )
...
travis seems to have just updated from 3.7.5 to 3.7.6 and 3.8.0 to
3.8.1. The stubs match the newer versions, so we remove the previously
whitelisted error.
2020-02-25 10:57:45 +01:00
Sebastian Rittau and GitHub
ca9505c8f4
Improve imaplib return types ( #3670 )
...
* Improve imaplib return types
Mark CommandResults as obsolete.
Also fix types of tagged_commands and untagged_responses.
Based on a discussion in #3655 .
* Fix type of tagged_commands
* Fix IMAP4.tagged_commands type
* Mark CommandResults as private
* Fix
2020-02-22 09:58:14 -08:00
Alex Willmer and GitHub
84c6e679f5
stdlib: Remove duplicated Pickler.reducer_override() ( #3772 )
2020-02-22 18:22:54 +01:00
Sebastian Rittau and GitHub
c710696aed
Remove obsolete stubtest whitelist entries ( #3773 )
2020-02-22 18:05:12 +01:00
Shantanu and GitHub
ab36ecb784
io: add open_code for py38 ( #3769 )
2020-02-22 12:53:16 +01:00
lazytype and GitHub
cfe69831e9
Include typing for Enum __order__ attribute ( #3541 )
...
Based on the behavior here: https://github.com/python/cpython/blob/0b41a922f95f62b620d5a197b9f2ed8e4bb70730/Lib/enum.py#L91
the `__order__` attribute should be treated the same as `_order_`
2020-02-21 21:40:33 -08:00
Rune Tynan and GitHub
7d8e2c8546
Add missing argument types for xml.sax stubs ( #3706 )
...
* Add missing argument types for xml.sax stubs
* Fix xml typings
2020-02-21 21:38:11 -08:00
Rune Tynan and GitHub
9425e359fc
Add missing parameter types for _json ( #3710 )
...
* Add missing parameter types for _json make_encoder
* Fix json typings
2020-02-21 21:37:24 -08:00
Shantanu and GitHub
ed2d3543c7
functools: add singledispatchmethod ( #3764 )
2020-02-21 21:36:47 -08:00
Shantanu and GitHub
1b7eadce95
fcntl: various improvements ( #3680 )
...
* fcntl: mark positional-only args
* fcntl: use overload for fcntl.fcntl
The comment about depending on the type of arg seems incorrect
https://github.com/python/typeshed/commit/bf501353a0668369e53cc1bc97250bb14f61a09e
I checked the docs and examples, CPython implementation and CPython tests, but
I might be missing something
* fcntl: use overload for fcntl.ioctl
Based off of docs and examples
* fcntl: type buffers better
Follows the approach in #2610
2020-02-21 21:31:58 -08:00
Shantanu and GitHub
af2767d9d5
modulefinder: fix types for __init__, remove scan_opcodes from py35 ( #3765 )
...
* modulefinder: fix types
* modulefinder: scan_opcodes isn't present in py35
* modulefinder: update whitelists
* modulefinder: restore previous __init__ for py37 and below
2020-02-21 21:27:56 -08:00
Shantanu and GitHub
0435be3432
curses: various fixes ( #3771 )
...
- fix arg names
- fix types based on default value
- mark positional-only args
2020-02-21 21:27:42 -08:00
Shantanu and GitHub
b1071639b9
sre_parse: various fixes ( #3758 )
...
* sre_parse: NIC is stub implementation detail
* sre_parse: add missing arg to Tokenizer.getuntil
* sre_parse: fix types for parse
* sre_parse: fix types for SubPattern.__init__
* sre_parse: fix arg name for fix_flags
* sre_parse: update whitelists
* sre_parse: fix some availability for py35
2020-02-21 21:23:34 -08:00
Shantanu and GitHub
ff7680cbfe
inspect: various fixes ( #3757 )
...
* inspect: fix BlockFinder.tokeneater args
* inspect: fix formatargspec
* inspect: fix formatargvalues
* inspect: fix various arg names
* inspect: update whitelists
2020-02-21 21:23:21 -08:00
Shantanu and GitHub
003fc6fa31
json: mark keyword-only args, remove deprecated arg ( #3756 )
...
* json: mark keyword-only args
Technically only true for Python 3.6+, but I didn't feel like copying
over the whole file just for Python 3.5. Let me know and I can.
* json: remove encoding from loads
This has been ignored and deprecated since 3.1 and will be removed in 3.9
It no longer even shows up in inspect.signature (in 3.8 it emits the
deprecation warning based on kwargs)
* json: update whitelists
2020-02-21 21:21:32 -08:00
Shantanu and GitHub
d104386b40
difflib: fix various types ( #3755 )
2020-02-21 21:20:15 -08:00
Shantanu and GitHub
d8d755d054
binascii: fix arg names, mark positional-only args ( #3754 )
2020-02-21 21:19:08 -08:00
Shantanu and GitHub
5a2f4c8cde
sys: various fixes ( #3762 )
...
* sys: simplify _getframe
* sys: mark positional-only args
* sys: fix platform availability
* sys: remove settscdump
This function is no longer documented in 3.6 and above (and doesn't
exist on master, was removed in 4fd64b9a6aba9e6e1a5d).
In 3.5 documentation it's mentioned that it's only available if Python
was compiled with a special flag:
https://docs.python.org/3.5/library/sys.html#sys.settscdump
* sys: update whitelists
2020-02-21 20:58:42 -08:00
Jaromir Latal and GitHub
daa738f70e
stdlib: csv.DictReader.fieldnames should be Optional[Sequence[str]] ( #3752 )
2020-02-21 20:50:02 -08:00
Oleg Höfling and GitHub
6600dabd5c
import SelectorEventLoop from asyncio.unix_events when not on windows ( #3753 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-02-21 20:49:31 -08:00
Jaromir Latal and GitHub
7b38214280
cryptography: Make mode in Cipher.__init__ optional ( #3751 )
2020-02-21 20:49:04 -08:00
Oleg Höfling and GitHub
830295074c
add _log() method to Logger and LoggerAdapter ( #3749 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-02-21 20:46:54 -08:00
Shantanu and GitHub
33750df1d7
marshal: fix arg name, mark positional-only args ( #3759 )
2020-02-21 20:39:30 -08:00
Shantanu and GitHub
82d7638018
gc: fix arg name, mark positional-only args ( #3760 )
2020-02-21 20:38:59 -08:00
Shantanu and GitHub
158bfc02d2
token: add TYPE_IGNORE, COLONEQUAL for py38 ( #3761 )
2020-02-21 20:38:01 -08:00
Shantanu and GitHub
406593f6cc
tempfile: various fixes ( #3763 )
...
* tempfile: add errors parameter in py38
* tempfile: add property to SpooledTemporaryFile
* tempfile: fix arg name
* tempfile: better document some of what's going on
* tempfile: update whitelists
2020-02-21 20:35:37 -08:00
Shantanu and GitHub
655bca8450
xml.sax: make_parser accepts iterables in py38 ( #3766 )
...
https://bugs.python.org/issue34789
2020-02-21 20:28:47 -08:00
Shantanu and GitHub
1fb46cb4d1
ast: add visit_Constant to NodeVisitor ( #3767 )
2020-02-21 20:26:15 -08:00
Shantanu and GitHub
67e2d94df6
py_compile: add quiet parameter in py38 ( #3768 )
2020-02-21 20:25:23 -08:00
Shantanu and GitHub
d89ab2a37d
_imp: mark positional-only args ( #3770 )
2020-02-21 20:20:24 -08:00
Oleg Höfling and GitHub
02784bb068
inspect._ParameterKind subclasses from enum.IntEnum ( #3750 )
...
Closes #3467 .
2020-02-21 14:30:15 +01:00
Shantanu and GitHub
374992bff7
resource: various fixes ( #3747 )
...
* resource: mark positional-only args
* resource: alias error to OSError
* resource: no longer seems incomplete
At least for Linux and Mac. Might be some things missing for FreeBSD
* resource: fix platform availability
* resource: update whitelist
2020-02-21 11:57:07 +01:00
Shantanu and GitHub
a19caac361
os.path: fix arg names ( #3748 )
2020-02-21 11:55:21 +01:00
Shantanu and GitHub
87791e4e15
re: various fixes ( #3746 )
...
* re: mark positional-only args
* re: fix escape arg name
* re: update whitelist
2020-02-21 11:55:11 +01:00
Shantanu and GitHub
5324bd02f2
typeshed: run stubtest in CI ( #3727 )
...
* README.md: refactor "Running the tests"
This organises the section a little better. Previously some tests were
unmentioned; it read as if mypy_test and pytype_test were the only
tests. The section is now organised by test, making it easy to keep
track of the requirements and details of each. This also makes it
easier to add documentation for stubtest.
Also mention turning on Travis CI on your fork, since that is very
useful.
* README.md: document stubtest_test.py
* stubtest_test: add it
* travis: add stubtest_test to CI
* stubtest_test: add whitelists
2020-02-20 22:16:52 -08:00
Anthony Sottile and GitHub
9ec0bcf7e4
Add cookie_re / blank_re to py3 tokenize ( #3745 )
2020-02-20 23:10:30 +01:00
Michael J. Sullivan and GitHub
7b630ca24a
Add unquote_to_bytes to py2 six ( #3744 )
2020-02-19 23:42:57 +01:00
Anthony Sottile and GitHub
5d27ffc8c7
Add a few attributes to distutils.ccompiler.CCompiler ( #3741 )
2020-02-19 20:33:17 +01:00
Anthony Sottile and GitHub
c0da627d40
Add cmdclass to distutils.dist.Distribution ( #3742 )
2020-02-19 12:18:41 +01:00
Thomas Schaper and GitHub
91deb7a79f
Make FrameType.f_back optional ( #3740 )
2020-02-16 19:40:10 +01:00
Anthony Sottile and GitHub
b98eaf47cc
Fix typing for plistlib.load{,s} ( #3738 )
2020-02-15 20:25:05 -08:00
ijl and GitHub
ea0a9c2bd6
Update orjson annotations to 2.4.0 ( #3737 )
2020-02-14 08:32:24 -08:00
Romain and GitHub
dd945ee380
fix type of distutils.cmd.Command.sub_commands ( #3736 )
2020-02-14 11:22:43 +01:00
Mark and GitHub
39008d51c1
Make itertools.cycle a type ( #3732 )
2020-02-09 13:34:41 +01:00
Oleg Höfling and GitHub
ba3679e433
Add types for modulefinder instance fields ( #3714 )
2020-02-08 11:38:21 +01:00
Jakub Stasiak and GitHub
17a4371803
Document Annotated and modified get_type_hints (PEP 593) ( #3731 )
2020-02-06 21:34:21 +01:00
Shantanu and GitHub
94ec308742
platform: update for py38 ( #3717 )
...
* platform: update py38 removals
Refer to bpo-28167
* platform: libc_ver takes a None executable in py38
2020-02-05 19:14:30 -08:00
Shantanu and GitHub
7924d36656
os: fix various arg names ( #3726 )
2020-02-05 20:57:51 +01:00
Anthony Sottile and GitHub
e38b110f7b
xml.sax.parse may also take IO[bytes] ( #3725 )
2020-02-05 20:56:57 +01:00
Shantanu and GitHub
10d33f5364
os: fix getenvb, scandir ( #3723 )
...
* os: fix getenvb
* os: scandir accepts None
2020-02-05 20:55:45 +01:00
Shantanu and GitHub
35e45964fc
io: mark positional-only args ( #3721 )
2020-02-05 16:23:31 +01:00
Shantanu and GitHub
a8b63357ff
array: mark positional-only args ( #3722 )
2020-02-05 16:23:06 +01:00
Shantanu and GitHub
fb286e1eb2
os.register_at_fork: fix signature ( #3720 )
2020-02-05 16:22:24 +01:00
Shantanu and GitHub
12cbdcf337
os: mark positional-only args ( #3719 )
...
Also remove unnecessary branch for os.urandom
2020-02-05 16:21:03 +01:00
Shantanu and GitHub
8aa7f92008
signal: mark positional-only args ( #3718 )
2020-02-05 16:19:20 +01:00
Shantanu and GitHub
01f67b1649
uu: fix keyword-only arg ( #3716 )
2020-02-05 13:06:31 +01:00
Shantanu and GitHub
695644807e
uuid: add is_safe, Safe UUID ( #3715 )
...
* uuid: add is_safe, SafeUUID
* uuid: add useless parameter
2020-02-05 13:04:49 +01:00
ebc521869d
Add missing parameter types to optparse ( #3711 )
...
* Add missing parameter types to optparse
* mark add_option_group arg as positional-only
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-02-02 22:13:56 -08:00
Rune Tynan and GitHub
e8f85d9479
Fix missing types in builtins/__builtin__ ( #3705 )
...
* Fix missing type in builtins/__builtin__
* Add return type to memoryview cast
2020-02-02 22:13:48 -08:00
Rune Tynan and GitHub
3e9f03015b
Add missing return type to read ( #3707 )
2020-02-02 22:07:24 -08:00
Rune Tynan and GitHub
9e70c157c9
Add missing parameter types ( #3709 )
2020-02-02 22:06:40 -08:00
Rune Tynan and GitHub
e3ddfd46b4
Fix missing type for dataclasses ( #3708 )
...
* Add missing return type to make_dataclass
* Fix consistency check
2020-02-02 21:58:15 -08:00
Rune Tynan and GitHub
2c2c60bfc8
Add missing return type in sre_constants ( #3712 )
2020-02-02 14:36:34 -08:00
Oleg Höfling and GitHub
94fd3b5101
Add type stubs for asyncio.unix_events ( #3664 )
...
* add 3.7 child watchers
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* add 3.8 child watchers
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* remove 3.7 check
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* fix too strict watcher return type in _UnixDefaultEventLoopPolicy.get_child_watcher
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* group asyncio imports
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* fixed platform check for importing from asyncio.unix_events
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-02-01 14:08:33 -08:00
Shantanu and GitHub
0db4897dab
zipimport: various fixes ( #3701 )
...
- allow path of find_module to be None (the default value)
- add undocumented find_loader and get_resource_reader
- greater consistency for __init__ param names
2020-02-01 13:44:55 -08:00
Wolf Honore and GitHub
211aec7b22
socketserver: Add missing attributes and methods for ForkingMixIn and ThreadingMixin ( #3672 )
...
* Add missing attributes and methods for ForkingMixIn and ThreadingMixin
* Copy socketserver.py to SocketServer.py
* Fix type of timeout
2020-02-01 09:30:43 -08:00
Shantanu and GitHub
a8412b601c
_heapq: add key for py2, mark positional-only args ( #3696 )
...
* _heapq: mark positional-only args
* _heapq: add key argument for py2
2020-02-01 09:28:54 -08:00
Shantanu and GitHub
a8f31b9c51
_random: mark positional-only args ( #3697 )
2020-02-01 09:28:15 -08:00
Shantanu and GitHub
f4787297e9
ast: update for py38 ( #3698 )
2020-02-01 09:25:56 -08:00
Shantanu and GitHub
1ca071a732
collections.Counter: fix default values, allow passing None ( #3699 )
2020-02-01 09:25:03 -08:00
Shantanu and GitHub
f96fe6abc0
xml.etree.ElementTree: update for py38 ( #3700 )
2020-02-01 09:23:11 -08:00
Shantanu and GitHub
4d698711ea
various errors: fix base class ( #3702 )
2020-02-01 09:15:23 -08:00
Shantanu and GitHub
123d2cb093
argparse: fix RawTextHelpFormatter base class ( #3703 )
2020-02-01 09:14:29 -08:00
Gisle Aas and GitHub
ed3f6f5ffd
Add stub for dateutil.easter ( #3695 )
2020-02-01 10:34:09 +01:00
Shantanu and GitHub
70f0dc1491
builtins: fix bytearray.fromhex ( #3691 )
...
bytearray.fromhex is a classmethod, not a staticmethod
Mark positional-only args in the other fromhex's
2020-01-30 18:58:36 -08:00
Shantanu and GitHub
9798c243c9
builtins: start can be passed by keyword to sum in 3.8 ( #3692 )
2020-01-30 18:56:50 -08:00
Shantanu and GitHub
10145fcc3a
webbrowser: fix platform availability, register ( #3694 )
...
* webbrowser: fix platform availability
* webbrowser: add default value to arg instance of register
2020-01-30 18:55:57 -08:00
Shantanu and GitHub
8b5e7f3efd
_curses: fix setupterm, mark positional-only args ( #3690 )
...
* _curses: mark positional-only args
* _curses: fix setupterm
2020-01-30 18:53:08 -08:00
tikki and GitHub
bd55cae8b6
fix arg name to socket.getaddrinfo for py3 ( #3689 )
2020-01-30 18:45:38 -08:00
Brian Maissy and GitHub
48d77d5f06
update SectionProxy.getint()/float/bool stubs to match those of ConfigParser ( #3687 )
2020-01-30 09:37:29 +01:00
Michael Heyns and GitHub
ad2ce11497
Support for PathLike objects in Jinja2 2.11.0 ( #3683 )
2020-01-30 01:51:13 +01:00
47409f3e25
Add missing stubs for logging.handlers.WatchedFileHandler. ( #3686 )
...
Co-authored-by: CyrilRoelandteNovance <cyril@redhat.com >
2020-01-29 08:27:12 -08:00
Brian Maissy and GitHub
e5999ac76b
make stubs for configparser.getint()/float/bool accept a generically-typed fallback ( #3684 )
...
Closes #3681
2020-01-29 14:43:46 +01:00
Jan Verbeek and GitHub
95cafc0b7c
sys: Correct types of sys.displayhook, sys.excepthook and variants ( #3673 )
...
displayhook should accept any object, not just integers.
displayhook and excepthook may be assigned to, so they should be
Callable values rather than function definitions. That way it's fine
to assign a function with different argument names. Their dunder
variants are supposed to be constant.
2020-01-29 11:25:35 +01:00
Shantanu and GitHub
46d9b38fa1
json: mark kwonly args, improve decode ( #3679 )
...
* json: mark args as kwonly for py36 on
* json: add undocumented arg to JSONDecoder.decode
2020-01-29 11:20:08 +01:00
Shantanu and GitHub
26fd2b7968
sqlite3: alias OptimizedUnicode to str for py3 ( #3678 )
2020-01-29 11:18:19 +01:00
Shantanu and GitHub
ac234f2592
turtle: various improvements ( #3677 )
...
* turtle: add None and default value to overloads
* turtle: add default value to write_docstringdict
* turtle: fix _Screen.setup
2020-01-29 11:17:16 +01:00
Shantanu and GitHub
b3a9bfd5db
pyexpat: improve ParserCreate, mark positional-only args ( #3676 )
2020-01-29 11:11:56 +01:00
Shantanu and GitHub
119547b931
xml: fix default values, mark positional-only args ( #3675 )
...
Note xml.etree.ElementTree.TreeBuilder.start has a default value for
attrs in the C-accelerated module.
2020-01-29 11:09:53 +01:00
Shantanu and GitHub
437b6947eb
dbm: mark positional-only args ( #3674 )
2020-01-29 11:03:55 +01:00
eb6ce3cacb
Fix socket.socket.ioctl ( #3669 )
...
Fixes #3495
Co-authored-by: Niels Buwen <nielsbuwen@users.noreply.github.com >
2020-01-27 21:25:33 -08:00
Ilaï Deutel and Jelle Zijlstra
e7ddb21ae6
range.index() takes exactly one argument ( #3668 )
2020-01-27 20:19:12 -08:00
Niklas Fiekas and Jelle Zijlstra
64fea9c543
asyncio: get_returncode() and get_pipe_transport() can return None ( #3663 )
2020-01-26 12:38:11 -08:00
Fionn Fitzmaurice and Sebastian Rittau
d413b4b162
Fix Crypto.Random.randrange argument types ( #3662 )
...
Crypto.random.randrange takes the same argument types as random.randrange.
2020-01-26 18:54:01 +01:00
Oleg Höfling and Sebastian Rittau
99d79696d7
accept optional extras in asyncio.BaseTransport init ( #3661 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-01-26 15:48:44 +01:00
Jason Gilholme and Sebastian Rittau
76b295a669
subprocess: Make stdin, stdout & stderr Optional for py3 to match py2 ( #3652 )
...
Closes : #3646
2020-01-26 15:21:58 +01:00
Shantanu and Sebastian Rittau
b972427ad4
configparser: fix various arguments ( #3632 )
...
* configparser: fix various arguments
* configparser.ConfigParser: inherit __init__
2020-01-26 13:51:04 +01:00
Shantanu and Jelle Zijlstra
ce42c16e03
cmath: fix log, mark positional-only args ( #3659 )
2020-01-25 22:18:23 -08:00
Shantanu and Jelle Zijlstra
6a878bf715
audioop: mark positional-only args ( #3658 )
2020-01-25 20:06:53 -08:00
Shantanu and Jelle Zijlstra
fd7855185e
_thread: fix type of TIMEOUT_MAX ( #3657 )
2020-01-25 20:00:55 -08:00
Shantanu and Sebastian Rittau
d5851eca6f
io: minor fixes for arguments ( #3642 )
2020-01-24 09:22:19 +01:00
Shantanu and Sebastian Rittau
ed95668638
builtins.pow: improve annotation ( #3647 )
2020-01-24 09:20:46 +01:00
crusaderky and Sebastian Rittau
03c9faa375
Pickle 5 ( #3636 )
2020-01-23 19:42:39 +01:00
Shantanu and Sebastian Rittau
edd1ec8a62
_codecs: fix various issues ( #3649 )
...
* _codecs: mark positional-only args as such
* _codecs: rename __data to __str where relevant
* _codecs: fix utf_16_ex_decode and utf_32_ex_decode
* _codecs: fix default value of charmap_encode
* _codecs: fix availability of charbuffer_encode
2020-01-23 15:38:58 +01:00
Shantanu and Sebastian Rittau
32563e9e1d
builtins: mark positional-only args as such ( #3648 )
2020-01-23 15:35:45 +01:00
Shantanu and Sebastian Rittau
b732342333
subprocess: add endtime for py36 and below ( #3641 )
2020-01-23 15:11:54 +01:00
Shantanu and Sebastian Rittau
295c20211d
ssl: fix arguments for py36 and below ( #3640 )
2020-01-23 15:10:36 +01:00
Shantanu and Sebastian Rittau
cae73edebf
http.cookies: add LegalChars for py36 and below ( #3639 )
2020-01-23 15:05:49 +01:00
Shantanu and Sebastian Rittau
7e6dbc4393
asyncio: fix various version availability ( #3638 )
2020-01-23 15:04:04 +01:00
Sebastian Rittau and GitHub
0e3286bc43
Remove consent requirement for third-party stubs ( #3643 )
...
This was discussed a while ago on typing-sig. Consequently the
requirement of asking third-party maintainers for permission was
removed from PEP 484.
2020-01-23 15:01:30 +01:00
Shantanu and Sebastian Rittau
324d18b956
decimal: remove non-existent args from py3, mark positional-only args ( #3633 )
2020-01-23 15:00:48 +01:00
Benjamin Peterson and Sebastian Rittau
2da1b2c426
gflags: Add is_parsed/IsParsed. ( #3650 )
2020-01-23 08:33:25 +01:00
Shantanu and Jelle Zijlstra
b4da2b694b
csv: re-export Dialect from _csv ( #3613 )
...
Resolves #3611
Tested with mypy on:
```
f = open("asdf.csv", "w")
csv.writer(f)
csv.writer(f, dialect=csv.excel)
csv.writer(f, dialect=csv.excel())
csv.DictReader(f)
csv.DictReader(f, dialect=csv.excel)
csv.DictReader(f, dialect=csv.excel())
class CustomDialect(csv.Dialect):
delimiter = "%"
csv.writer(f, dialect=CustomDialect)
csv.writer(f, dialect=CustomDialect())
```
2020-01-22 17:11:52 -08:00
Shantanu and Sebastian Rittau
8b241b5243
asyncio: fix SendfileNotAvailableError availability ( #3631 )
2020-01-22 17:27:58 +01:00
Shantanu and Sebastian Rittau
e3dfaa6608
hashlib: fix arguments ( #3626 )
...
* hashlib: fix argument names
* hashlib: add default values to scrypt, make args Optional
2020-01-22 10:20:40 +01:00
Shantanu and Jelle Zijlstra
e048dd2b3b
heapq: fix arguments ( #3645 )
...
* heapq: mark positional-only args
* heapq: fix types for args with default value None
2020-01-21 17:52:38 -08:00
Shantanu and Sebastian Rittau
d889de033a
argparse: various fixes ( #3630 )
...
- add_subparsers uses keyword-only args
- required parameter is new in py37
2020-01-21 19:38:58 +01:00
Shantanu and Sebastian Rittau
d2da7d17c2
difflib: various fixes ( #3629 )
...
- add undocumented parameters to IS_LINE_JUNK and IS_CHARACTER_JUNK
- add kw-only charset to make_file
2020-01-21 19:30:05 +01:00
Shantanu and Sebastian Rittau
39d72bb61e
distutils: various fixes ( #3634 )
...
- fix parameter name in `move_file`
- make `setup` keyword-only args keyword-only
- add undocumented (positional!) `swig_opts` parameter to `Extension`
2020-01-21 07:08:48 +01:00
Shantanu and Sebastian Rittau
666ecc7cca
pprint: fix argument names ( #3627 )
...
This matters for passing in arguments by keyword
2020-01-20 09:02:23 +01:00
Shantanu and Sebastian Rittau
b374154705
operator: mark positional-only args ( #3628 )
2020-01-20 09:01:02 +01:00
Shantanu and Sebastian Rittau
ba8b2585c6
ast: some fixes for py38 ( #3625 )
...
* ast: make parse args keyword-only
* ast: get_source_segment is py38 on
2020-01-20 08:50:59 +01:00
Shantanu and Sebastian Rittau
32959dfe6e
math: correct argument kinds ( #3624 )
...
* math: make positional-only args positional-only
* math: make keyword-only args keyword-only
2020-01-19 21:04:43 +01:00
Shantanu and Sebastian Rittau
f077918918
zlib: mark positional only args ( #3623 )
...
Found using new stub checking script
2020-01-19 21:02:13 +01:00
Andrew Svetlov and Sebastian Rittau
dfe289e43b
Fix local_addr type ( #3622 )
2020-01-19 19:32:20 +01:00
Shantanu and Sebastian Rittau
995e83ba2a
zipfile: fix various stubs ( #3621 )
...
Found using new stub checking script
2020-01-19 11:52:08 +01:00
Squirrel and Jelle Zijlstra
5d328a0c3f
update stub for pycurl module ( #3530 )
2020-01-18 08:03:35 -08:00
Rune Tynan and Jelle Zijlstra
85afac3bd5
Add (_)dummy_threading module, identical to threading ( #3554 )
...
* Add (_)dummy_threading module, identical to threading
* Remove unnecessary comment, add consistency check
2020-01-18 07:42:32 -08:00
Anthony Sottile and Jelle Zijlstra
d0f57d7d38
Fill out more attributes in six ( #3589 )
2020-01-18 07:41:51 -08:00
Jan Verbeek and Jelle Zijlstra
475d1f75fe
Add missing stubs to pdb and fix related issues in cmd and bdb ( #3600 )
2020-01-18 07:39:35 -08:00
Shantanu and Sebastian Rittau
b6b9df3836
sqlite3: add deterministic parameter to create_function ( #3620 )
2020-01-16 19:13:08 +01:00
Shantanu and Sebastian Rittau
cc58bb0cb1
platform: update for py38 ( #3619 )
2020-01-16 19:13:00 +01:00
Shantanu and Sebastian Rittau
137ff45282
opcode, dis: add jump parameter to stack_effect ( #3618 )
2020-01-16 19:08:18 +01:00
Ian Good and Sebastian Rittau
160b093eb3
MaildirMessage.set_date accepts a float argument ( #3617 )
2020-01-16 19:06:13 +01:00
Shantanu and Sebastian Rittau
375e8c1127
zipfile: fix ZipExtFile parameter ( #3616 )
...
This was changed in bpo-38334 and backported to Python 3.7.6 and 3.8.1.
2020-01-16 09:03:39 +01:00
Alan Du and Sebastian Rittau
42d68dd765
Use overloads for more precise get_context type ( #3605 )
2020-01-15 18:43:46 +01:00
Daniel Däschle and Sebastian Rittau
91d000e434
fix: add samesite parameter to set_cookie ( #3614 )
...
* Fixes #3609
* Implements samesite parameter of the set_cookie method in the werkzeug module (https://werkzeug.palletsprojects.com/en/0.15.x/wrappers/#werkzeug.wrappers.BaseResponse.set_cookie )
2020-01-15 12:04:11 +01:00
Shantanu and Sebastian Rittau
1b5c2dfa1f
logging: update for py38 ( #3595 )
...
* logging: add stacklevel parameter everywhere
* logging: add force to basicConfig
* logging: add validate to Formatter
2020-01-14 19:45:38 +01:00
Daniël van Eeden and Sebastian Rittau
c4bdd90d86
Allow requests to have timeout: Tuple[float, None] ( #3612 )
2020-01-14 15:28:22 +01:00
Cal Paterson and Sebastian Rittau
1421fb1074
Change Response.headers from MutableMapping to CaseInsensitiveDict ( #3610 )
...
This fixes a type error when doing `response.headers.lower_items()`, a method
present on CaseInsensitiveDict
2020-01-14 12:41:30 +01:00
Erick and Sebastian Rittau
394ee4a9ae
added f_fsid: int to os.statvfs_result for >= 3.7 ( #3608 )
2020-01-13 20:08:59 +01:00
Anthony Sottile and Sebastian Rittau
910cfe4b83
Add msvcrt.locking() and associated constants ( #3607 )
2020-01-11 17:23:41 +01:00
Shantanu and Sebastian Rittau
d5f1e58457
binascii: add new parameters to hexlify ( #3601 )
2020-01-11 17:22:06 +01:00
Shantanu and Sebastian Rittau
b8299bd58a
http: update for py38 ( #3606 )
...
* http: add UNAVAILABLE_FOR_LEGAL_REASONS
* http.cookiejar: filename parameter now supports path-like
2020-01-11 17:20:46 +01:00
Shantanu and Jelle Zijlstra
055a907e75
csv: add a return type for things that return ( #3604 )
...
Technically, these return whatever the write object of the underlying
file object return. I'm not sure it's worth making everything generic
over this probably rarely used return type, but happy to do it (or drop
this change) if that seems better.
2020-01-10 14:14:44 -08:00
Rebecca Chen and Sebastian Rittau
3b3fc6a57f
Make os.statvfs_result inherit from typing.NamedTuple. ( #3603 )
2020-01-10 22:42:29 +01:00
Shantanu and Jelle Zijlstra
b25454a76c
signal: update for py38 ( #3602 )
2020-01-10 12:12:08 -08:00
Shantanu and Sebastian Rittau
4c6ae26a0e
codecs: add literal overloads for bytes to bytes, str to str codecs ( #3599 )
...
Closes : #300
2020-01-10 16:38:23 +01:00
Shantanu and Jelle Zijlstra
61600d6877
memoryview: add cast, obj attribute ( #3598 )
...
Fixes #3594
2020-01-09 15:57:17 -08:00
Rebecca Chen and Jelle Zijlstra
e0151e724a
Make unittest.FunctionTestCase inherit from TestCase in Python 2. ( #3597 )
...
This makes the pyi file match the implementation:
https://github.com/python/cpython/blob/249706c1fbce04125d81bd9993e6c010ae30f8e4/Lib/unittest/case.py#L1019 .
I also removed a now-redundant `run` method from FunctionTestCase
because the mypy test complained about it having a different signature
from TestCase.run().
Context:
https://github.com/python/typeshed/pull/3550#issuecomment-572702513 .
2020-01-09 13:04:08 -08:00
Benjamin Peterson and Sebastian Rittau
fe236ed8b2
Add unittest.result.failfast. ( #3596 )
2020-01-09 20:39:10 +01:00
Daniel Farley and Rebecca Chen
955e9c7da4
Unify file descriptor definitions ( #3584 )
...
The _types module can house any common type defintions used throughout
the rest of typeshed to keep defintions in sync.
First candidate is file descriptors where anything with `fileno()`
method is accepted. There were several different implementations in
various files that can be unified.
2020-01-08 17:25:36 -08:00
Rebecca Chen and GitHub
1651348a08
Require a newer version of pytype that supports @type_check_only. ( #3593 )
2020-01-08 17:15:25 -08:00
Sebastian Rittau and Jelle Zijlstra
fdeae5d00e
Enable --disallow-subclassing-any ( #3591 )
...
Closes : #1446
2020-01-08 11:51:44 -08:00
Sebastian Rittau and Jelle Zijlstra
885c2fd65e
Fix example code ( #3592 )
2020-01-08 09:52:23 -08:00
Vury Leo and Sebastian Rittau
e7430508b0
Fix argument name of os.link/symlink ( #3590 )
2020-01-08 13:16:02 +01:00
hauntsaninja and Jelle Zijlstra
0505c100e1
inspect: update _ParameterKind for py38 ( #3587 )
2020-01-07 23:19:04 -08:00
hauntsaninja and Jelle Zijlstra
da9b7dd7c8
token: add TYPE_COMMENT, remove AWAIT, ASYNC for py37 ( #3588 )
...
flake8 is a little picky about how we do checks against
sys.version_info
2020-01-07 23:18:53 -08:00
hauntsaninja and Jelle Zijlstra
4aa6dfccdb
pprint: update for py38, fix kwarg-only parameters ( #3585 )
2020-01-07 21:51:54 -08:00
hauntsaninja and Jelle Zijlstra
485b85e6b8
csv: update DictReader for py38 ( #3586 )
2020-01-07 21:40:19 -08:00
rikhilraithatha and Sebastian Rittau
caca02b096
redis: add ping to PubSub ( #3583 )
2020-01-07 17:20:43 +01:00
hauntsaninja and Jelle Zijlstra
b7a611e211
csv: more precise types, remove TODO ( #3581 )
2020-01-06 20:59:07 -08:00
hauntsaninja and Jelle Zijlstra
1efc1baaf7
stdtypes: update for py38 ( #3580 )
2020-01-06 20:57:34 -08:00
hauntsaninja and Sebastian Rittau
e10b9c70b2
zipfile: update for py38 ( #3572 )
...
* zipfile: add Path, new in py38
* zipfile: use str over Text for py3 branches
* zipfile: add force_zip64 kwarg to open methods
2020-01-06 20:52:46 +01:00
Jens Hedegaard Nielsen and Sebastian Rittau
2cff4e615e
BaseHTTPRequestHandler is a subclass of StreamRequestHandler ( #3579 )
2020-01-06 15:00:31 +01:00
Daniel Hahler and Jelle Zijlstra
89c598f7c9
jinja2: add Template.{name,filename} ( #3578 )
...
Ref::
- https://jinja.palletsprojects.com/en/2.10.x/api/#jinja2.Template.name
- https://jinja.palletsprojects.com/en/2.10.x/api/#jinja2.Template.filename
2020-01-05 17:58:56 -08:00
Christopher Dignam and Sebastian Rittau
bd14fcaaa6
requests: type responses for PreparedRequest ( #3577 )
2020-01-06 00:27:21 +01:00
layday and Sebastian Rittau
2bd06a0a3d
Restrict shutil.move src argument to str ( #3559 )
...
See https://bugs.python.org/issue32689 .
This bug only affects `src`s which are directory
Paths in Python 3.5 to 3.8 inclusive.
Comes at the cost of restricting
`src` to str even where a Path would work but
this might be preferable to exposing the bug.
2020-01-05 16:38:16 +01:00
hauntsaninja and Sebastian Rittau
ac2e59af81
shutil: update which for py38 ( #3575 )
2020-01-05 16:19:03 +01:00
hauntsaninja and Sebastian Rittau
45688b936e
urllib: update for py38 ( #3574 )
...
* urllib.robotparser: add site_maps
* urllib.parse: add max_num_fields parameter
2020-01-05 16:17:23 +01:00
Alex Grönholm and Sebastian Rittau
7b5e9dca48
Added explicit SSLSocket.accept() definition ( #3564 )
2020-01-05 16:14:42 +01:00
hauntsaninja and Sebastian Rittau
64252bfef4
zipfile: fix typo in parameter for PyZipFile ( #3573 )
2020-01-05 16:12:44 +01:00
Daniel Farley and Sebastian Rittau
4fb4c80af7
Fix HTTPConnection timeout type ( #3565 )
...
`HTTPConnection` only passes timeout down to `socket.settimeout()` which is of type `Optional[float]` and has a specific action for `None`. `HTTPConnection` should support the same behavior
2020-01-05 16:11:22 +01:00
Pavel Savchenko and Sebastian Rittau
616b6d0f3b
Add missing definitions to requests.utils ( #3567 )
...
Added:
+ DEFAULT_PORTS
+ extract_zipped_paths
+ select_proxy
+ rewind_body
2020-01-05 16:07:36 +01:00
Mickaël Schoentgen and Sebastian Rittau
b4d1da03aa
Add missing Path.is_mount() introduced in Python 3.7 ( #3566 )
2020-01-05 16:04:52 +01:00
Jason and Sebastian Rittau
a1331accbe
Update int.from_bytes to allow more than sequences ( #3571 )
...
`int.from_bytes` supports both iterables of ints and objects that define
__bytes__'. As an example `int.from_bytes(iter([1, 0]), 'little'))`
returns 1.
2020-01-05 16:02:10 +01:00
hauntsaninja and Sebastian Rittau
b7530cc79e
Add __init__ for subclasses of MappingView in python2 ( #3570 )
...
Resolves #3549 for python2
2020-01-05 15:11:38 +01:00
Faidon Liambotis and Jelle Zijlstra
d87a4ffe0b
socketserver.BaseRequestHandler: add missing hint ( #3524 )
...
Add hint for __init__().
Fixes #3523 .
2020-01-03 08:48:49 -08:00
Jeppe Fihl-Pearson and Jelle Zijlstra
fed3472e7c
Reflect Python 3.8 updates to the pathlib stdlib module ( #3568 )
2020-01-03 08:47:50 -08:00
Alex Grönholm and Sebastian Rittau
f5a1925e76
Corrected type for "data" in two methods ( #3562 )
...
The documentation states:
* datagram_received: "data is a bytes object containing the incoming data."
* pipe_data_received: "data is a non-empty bytes object containing the received data."
2019-12-29 16:03:53 +01:00
Alex Grönholm and Sebastian Rittau
83f9d833fb
Fixed missing methods, wrong names and types ( #3560 )
...
Changes:
* Added the missing methods `selected_alpn_protocol()` and `version()` to `SSLObject`
* Fixed the naming of the `shared_ciphers()` method in `SSLSocket` and `SSLObject` (was missing the last "s")
* Fixed return type of `cipher()` (it's documented to return `None` if no connection has been established)
* Fixed second argument in cipher and shared_ciphers
The TLS version is a string, like "TLSv1.2".
* Added explicit overloads for getpeercert()
Its return type can be determined statically based on the `binary_form` argument.
2019-12-29 16:02:18 +01:00
layday and Sebastian Rittau
21a9e69612
Update shutil.unpack_archive for 3.7 and up ( #3558 )
2019-12-27 11:26:26 +01:00
Batuhan Taşkaya and Sebastian Rittau
387ea1512a
Add ast.unparse ( #3557 )
2019-12-26 16:06:10 +01:00
Rune Tynan and Jelle Zijlstra
89602a89b9
Add antigravity module ( #3555 )
2019-12-21 14:48:00 -08:00
Maarten ter Huurne and Jelle Zijlstra
703b01dd5e
Add __init__ to MappingView and its subclasses ( #3528 )
...
While these implementations don't matter for the 'typing' module
itself, these are also imported to serve as the implementations
for the 'collection.abc' module.
Fixes #3029
2019-12-21 14:45:17 -08:00
François Freitag and Sebastian Rittau
462f71a212
Remove unused type _HTTPResponse ( #3531 )
...
Unused since 8e7c32846f .
2019-12-21 21:48:17 +01:00
Artjoms Iskovs and Jelle Zijlstra
61f139189e
Fix RSAPublicNumbers stub ( #3505 )
...
`RSAPublicNumbers` is supposed to have an exponent `e` and modulus `n` instead of `p` and `q` (typo?)
2019-12-21 12:38:16 -08:00
Jelle Zijlstra and GitHub
6b751ef408
shutil: Fix rmtree type ( #3536 )
...
See my comment in https://github.com/python/typeshed/issues/3533#issuecomment-563366251 .
2019-12-21 12:29:59 -08:00
dave-shawley and Jelle Zijlstra
c44a556fb0
Add typestubs for the warnings module ( #3543 )
2019-12-21 12:29:34 -08:00
Rune Tynan and Jelle Zijlstra
0c563130fd
Add dbm stubs ( #3508 )
2019-12-21 12:25:37 -08:00
Jelle Zijlstra and GitHub
5021b30711
functools: remove first type param of cached_property ( #3553 )
...
Fixes #3547
This removes some type safety in exceptional cases, like code that interacts
directly with cached_property objects, but that seems like a price worth
paying.
2019-12-21 10:42:43 -08:00
layday and Jelle Zijlstra
e404e1592d
Preserve original type in total_ordering annotation ( #3552 )
...
See https://github.com/microsoft/pyright/issues/443
for reference.
2019-12-20 17:18:05 -08:00
abe and Sebastian Rittau
f7119c30ce
Update stubs for Crypto.Random ( #3546 )
2019-12-19 22:26:51 +01:00
Jan Verbeek and Sebastian Rittau
a705d59479
Add undocumented methods and make types more specific in 2/unittest ( #3550 )
2019-12-19 18:17:14 +01:00
Jacob Beck and Sebastian Rittau
9d61baa7be
add jinja macro fields ( #3548 )
2019-12-18 18:56:06 +01:00
Brian Maissy and Sebastian Rittau
c0c780a758
add a couple missing stubs and fix an incorrect return type for redis stubs ( #3545 )
2019-12-18 07:49:19 +01:00
Rune Tynan and Sebastian Rittau
4ed19cdaf5
Add stubs for winsound module ( #3535 )
2019-12-16 01:20:15 +01:00