Jelle Zijlstra and Guido van Rossum
ced5d61bb6
make urllib.response.addinfourl instantiable ( #2134 )
...
Fixes #1377 (because HTTPError is a subclass of addinfourl). Also part of #1476 .
2018-06-11 15:43:53 -07:00
Guido van Rossum and GitHub
c4bf27b835
Copy __builtin__.pyi to builtins.pyi, to fix breakage caused by #2128 ( #2215 )
2018-06-11 15:10:22 -07:00
Jelle Zijlstra and Guido van Rossum
4e6af84640
improve multiprocessing.Pool types ( #2126 )
...
Fixes #1703
Mostly introduce typevars to express that the return types match the return types of the
callbacks.
Removed comment about incompleteness since all documented classes from
https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool
are covered.
2018-06-11 14:42:57 -07:00
Jelle Zijlstra and Guido van Rossum
82c930e66c
Improve asyncio.tasks stubs ( #2139 )
...
- Use PEP 526-style variable annotations where possible
- Use FrameType instead of Any
- Remove workaround for mypy issue that was since fixed
2018-06-11 14:40:54 -07:00
Jelle Zijlstra and Guido van Rossum
f5a74fd5da
remove Optional from type of __slots__ ( #2128 )
...
Fixes #1853
2018-06-11 14:29:11 -07:00
Jelle Zijlstra and Guido van Rossum
f65caed181
allow socket.recv_into to take a memoryview ( #2127 )
...
Fixes #1862
2018-06-11 14:25:11 -07:00
Jelle Zijlstra and Guido van Rossum
cb293ebd2e
switch order of base classes on awaitable classes ( #2125 )
...
Fixes #1940 .
This makes it so that mypy will infer the common base class of these
classes to be Awaitable instead of Iterable. I verified that this
fixes the errors in the script posted by @neilconway.
2018-06-11 14:20:31 -07:00
Jelle Zijlstra and Guido van Rossum
7abcd0f71f
add ConfigParser.readfp in Python 3 ( #2123 )
...
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.readfp
Fixes #2112
2018-06-11 14:10:52 -07:00
Jelle Zijlstra and Guido van Rossum
53fde2ddf7
make timeout argument to Connection.poll Optional ( #2122 )
...
Fixes #2094
2018-06-11 14:04:45 -07:00
Jelle Zijlstra and Guido van Rossum
91af6291b1
make shlex.shlex and multiprocessing.pool.IMapIterator instantiable ( #2120 )
...
Part of #1476 .
2018-06-11 14:04:05 -07:00
Jelle Zijlstra and Guido van Rossum
c5bc3bd7fa
make contextvars.Context instantiable ( #2119 )
...
Part of #1476 .
2018-06-11 14:03:02 -07:00
Jelle Zijlstra and Guido van Rossum
f789ee25ad
make EnumMeta instantiable ( #2118 )
...
part of #1476 . Verified that len(Enum) is still allowed by mypy.
2018-06-11 14:02:16 -07:00
Jelle Zijlstra and Guido van Rossum
f73351f5bf
make tracemalloc.Traceback instantiable ( #2117 )
2018-06-11 14:01:46 -07:00
Jelle Zijlstra and Guido van Rossum
28f6c095d4
make http.cookies.{Base,Simple}Cookie instantiable ( #2116 )
...
Part of #1476 .
2018-06-11 14:01:17 -07:00
Jelle Zijlstra and Guido van Rossum
a33a124537
make BZ2File and LZMAFile instantiable ( #2115 )
...
Part of #1476 .
2018-06-11 13:59:38 -07:00
Yusuke Miyazaki and Guido van Rossum
46a59fc9b1
Add nis stub ( #2213 )
2018-06-11 11:26:32 -07:00
Jelle Zijlstra and Guido van Rossum
38fb53eab6
add __init__ to SimpleNamespace ( #2207 )
...
```In [11]: SimpleNamespace(x=3)
Out[11]: namespace(x=3)
```
2018-06-11 08:08:41 -07:00
Daniel Li and Jelle Zijlstra
87c296c964
Some inspect.formatargspec args cannot be None ( #2212 )
...
The annotations, formatarg, formatvarargs, formatvarkw, formatvalue,
formatreturns, and formatannotations arguments to inspect.formatargspec
have default values, but they cannot be None.
2018-06-11 08:07:47 -07:00
Guido van Rossum and Jelle Zijlstra
af3b015aa8
mock.patch.object() attribute arg should be Text ( #2210 )
...
It works and is needed for code using the dreaded
'from __future__ import unicode_literals'.
2018-06-09 22:36:24 -07:00
Ethan Smith and Guido van Rossum
7831f8d883
Add _winapi stub ( #2209 )
...
This module is going to be used by mypy for the daemon on Windows. To that end I ran stubgen on _winapi, then read through Modules/_winapi.c to add the function types. This seems to have been added in Python 3.1, but I think it is completely fine to just leave it in stdlib/3.
2018-06-09 18:48:30 -07:00
Scott Belden and Jelle Zijlstra
84cafafe73
TracebackType is optional ( #2202 )
2018-06-09 16:22:50 -07:00
mbarkhau and Jelle Zijlstra
8d852c3785
3.6+ Updates for ast module ( #2208 )
...
Added AnnAssign
Added comprehension.is_async
Fixed typo on FormattedValue.format_spec
2018-06-09 10:30:39 -07:00
mbarkhau and Jelle Zijlstra
d7067fb287
Add FormattedValue and JoinedStr to ast for py3.6+ ( #2206 )
...
Fixes #2205
For reference https://docs.python.org/3/library/ast.html#abstract-grammar
2018-06-08 19:13:17 -07:00
Max R and Jelle Zijlstra
34b926008e
Remove Python 3.3 check in mock.pyi ( #2201 )
2018-06-05 15:30:28 -07:00
Froger David and Jelle Zijlstra
ffba2ea87a
compile builtin accept PathLike ( #2200 )
2018-06-05 14:02:46 -07:00
Froger David and Jelle Zijlstra
ae91695fb7
Inspect ( #2178 )
...
* add inspect.{isasyncgenfunction,isasyncgen} (3.6)
* reorder inspect.CO_* as in Python 3.6 doc
* add inspect.CO_{COROUTINE,ITERABLE_COROUTINE} (3.5)
* add inspect.CO_ASYNC_GENERATOR (3.6)
* use variable annotations
* use version checks
* Parameter.empty is a class attribute
* Signature.empty is a class attribute
2018-06-05 09:59:09 -07:00
Daniel Li and Jelle Zijlstra
e02eb70cb3
pkgutil.iter_modules accepts iterable of str ( #2195 )
2018-06-05 09:58:51 -07:00
Ivan Levkivskyi and GitHub
7dd4d0882d
Update return type of dataclasses.field ( #2197 )
2018-06-05 16:57:20 +01:00
Anthony Sottile and Jelle Zijlstra
270fba2e4e
Add headers attribute to HTTPResponse ( #2190 )
2018-06-05 08:11:12 -07:00
Michael Hirsch, Ph.D and Jelle Zijlstra
48904699ec
urlretrieve can accept filename: pathlib.Path for Python>=3.6 ( #2194 )
2018-06-05 07:58:39 -07:00
Jelle Zijlstra and Łukasz Langa
eef0b1d562
fix type for TestCase.assertIn ( #2186 )
...
* fix type for TestCase.assertIn
This does essentially `assert member in container`, so we want a `Container`, not an `Iterable`.
This came up in https://github.com/ambv/black/pull/288/files/68e9d426a86edc187a3f58ea889a2002620f0de6..0bbee43d60dfc16d8bbdd0bbdaad754a2c8c7ec0#r192525658 .
* use any for assertIn
2018-06-04 15:34:09 -07:00
Michael and Jelle Zijlstra
9ec6d476c4
Broaden type of val argument to locale.currency ( #2192 )
...
Similar to python/typeshed#1350
2018-06-04 07:54:26 -07:00
Hanaasagi and Jelle Zijlstra
7faa41984b
Closes python/mypy/#5141 ( #2191 )
2018-06-03 21:52:19 -07:00
Anthony Sottile and Jelle Zijlstra
2d4bb04ab3
json.load can also take IO[bytes] in py36+ ( #2188 )
2018-06-03 19:02:55 -07:00
Stephen Thorne and Jelle Zijlstra
a25ff0bddf
get_grouped_opcodes() returns an iterable of groups, not an iterable of opcodes. ( #2183 )
...
The type signature of get_grouped_opcodes() was incorrect. Resulting in type errors when checking return values.
The usage of this function is like this:
groups = sm.get_grouped_opcodes() # groups is Iterable[List[Tuple[str, int, int, int, int]]]
for group in groups: # group is List[Tuple[str, int, int, int, int]]
for opcode in group: # opcode is Tuple[str, int, int, int, int]
2018-06-01 09:59:57 -07:00
Robert Collins and Jelle Zijlstra
98badb6eff
Fix mock patch.dict stub and add mock stub ( #2173 )
...
The dict stub was referring to an instance, not the type, leading to
__call__ being considered when using as a decorator, rather than
__init__.
mock is a backport of the stdlib module and should be defined the same.
2018-05-31 21:45:54 -07:00
Sebastian Rittau and Jelle Zijlstra
a3031adb46
Merge Python 2 and 3 SSL stubs ( #2175 )
2018-05-31 21:44:42 -07:00
George King and Jelle Zijlstra
66226ab2d7
Preliminary implementation of stdlib/3.7/dataclasses.pyi. ( #1944 )
2018-05-30 12:57:02 -07:00
Mathieu Leduc-Hamel and Jelle Zijlstra
351d019241
Mark inspect.getmembers as Optional for both Py2 and Py3 ( #2172 )
2018-05-29 10:43:34 -07:00
Sushain Cherivirala and Jelle Zijlstra
0193ee87a8
Add OpenDirector.addheaders and PEP 526 refactoring ( fixes #2163 ) ( #2164 )
...
* Add OpenDirector.addheaders and replace type comments with annotations
* Use ClassVar/eliminate `= ...` and add BaseHandler.handler_order (exists in Py2 versions)
2018-05-28 08:09:35 -07:00
Sebastian Rittau and Jelle Zijlstra
b1cd9fedf8
Complete wsgiref ( #2165 )
...
* Add wsgiref.handlers
* Add wsgiref.simple_server
2018-05-28 08:08:27 -07:00
Sushain Cherivirala and Jelle Zijlstra
dc0fcdcaa0
Add missing signals to Py2/3; missing events to Py2; PEP 526 refactoring ( fixes #1576 ) ( #2168 )
2018-05-27 22:50:10 -07:00
Sushain Cherivirala and Jelle Zijlstra
226f0553fe
Add compact keyword arg to pprint ( #2162 )
2018-05-24 21:10:17 -07:00
Michael J. Sullivan and GitHub
2ba90a65c0
Remove __all__ = ... from stubs ( #2161 )
...
The presence of a __all__ causes everything to not get picked up by
import *, which among other things breaks the new six.moves stubs.
2018-05-24 19:00:07 -07:00
Michael J. Sullivan and GitHub
c55cf13d8e
make difflib use str on 3 and AnyStr on 2 ( #2160 )
2018-05-24 13:53:42 -07:00
Michael J. Sullivan and GitHub
db1316d26b
os.path.relpath can use a default argument and still use str ( #2159 )
2018-05-24 13:23:17 -07:00
Sebastian Rittau and Jelle Zijlstra
8b84e9cf13
Improve wsgiref stubs ( #2145 )
...
* Use typing.Text
* Add InputStream and ErrorStream WSGI protocols
* Fix return type of WSGIApplication
* Add type hints to wsgiref.validate
* Replace _Bytes by plain bytes
* Add wsgiref.util
* Add wsgiref.headers
* ErrorWrapper.writelines() takes an Iterable
* Fix start_response return type
* Make Python 2 and 3 branches resemble each other more closely
* Use typing.NoReturn
* Fix WriteWrapper.writer type
* Change return type of WriteWrapper.writer to Any
2018-05-23 08:19:07 -07:00
Jelle Zijlstra and Guido van Rossum
b89f9553e9
keep os.path in 2 and 3 consistent ( #2152 )
...
We can't merge these because os/__init__ is still different.
Also slight refactor of tests/check_consistent.py to avoid `from os import path`.
2018-05-22 07:14:13 -07:00
Jakub Nabaglo and Jelle Zijlstra
d84069e78d
Add stub for random.Random.choices ( #2156 )
2018-05-21 19:38:00 -07:00
Ilya Konstantinov and Jelle Zijlstra
128a49a32d
Fix LoggerAdapter.process first argument ( #2153 )
...
Standard implementation is:
```
def process(self, msg, kwargs):
kwargs["extra"] = self.extra
return msg, kwargs
```
so the signature is clearly `(Text, ...) -> (Text, ...)` (or `(str, ...) -> (str, ...)`, but following the other stubs here, I gather it's `Text`).
2018-05-21 08:27:16 -07:00