Jelle Zijlstra and Guido van Rossum
22f47fd478
add typing.AsyncContextManager and contextlib.asynccontextmanager ( #1432 )
...
Implements:
- https://github.com/python/typing/pull/438
- https://github.com/python/cpython/pull/360
Note that https://github.com/python/cpython/pull/1412 , which adds
contextlib.AbstractAsyncContextManager, has not yet been merged.
2017-06-27 10:39:40 -07:00
Roy Williams and Jelle Zijlstra
31d7393cae
Support calling eval and ast module with unicode in Python 2 ( #1440 )
2017-06-26 19:06:17 -07:00
Max Rozentsveyg and Jelle Zijlstra
d3f9c55203
Add type stub for requests.packages.urllib3.util.connection.HAS_IPV6 ( #1436 )
...
This is defined at https://github.com/requests/requests/blob/v2.14.2/requests/packages/urllib3/util/connection.py#L130
2017-06-26 11:52:24 -07:00
Harmen and Jelle Zijlstra
d260bb4889
support for with socket.create_connection ( #1429 )
2017-06-24 09:11:12 -07:00
Elliot Marsden and Jelle Zijlstra
2a115b1714
Indicate that float() accepts Real objects ( #1434 )
...
This contradicts CPython, in `Lib/numbers.py`, because `Real` does not
actually inherit from `SupportsFloat`. But it suppresses errors from
mypy when passing sub-classes like `fractions.Fraction` to `float()`.
2017-06-24 07:55:41 -07:00
Svyatoslav Ilinskiy and Jelle Zijlstra
ee5e3affe1
Update Num stub for typed_ast 2.7 ( #1430 )
...
Field `n` should be a `Union[int, float, complex]`, not just `Union[int, float]`
2017-06-23 16:43:23 -07:00
mistermocha and Guido van Rossum
5306d6f5a7
Correct implementation of standard types besides "object" ( #1340 )
...
Per https://github.com/python/mypy/issues/2989
2017-06-23 09:45:48 -07:00
Jelle Zijlstra and Matthias Kramm
4a5ff0bb11
use PEP 526-style annotations in os stubs ( #1428 )
...
And fix some TODOs.
This will help me check these stubs with my stubcheck tool, and is better
for consistency anyway.
2017-06-22 05:49:23 -07:00
Matthias Kramm and Jelle Zijlstra
c4e0580a4a
make io.pyi import everything from _io.py(i), like io.py does ( #1395 )
...
* make io.pyi import _io.py(i), like io.py does
* make write/writelines take 'Any', on _IOBase
* Add missing constructors, fix inconsistencies.
* Also, as far as possible, try to simplify, by moving methods into base
classes.
* fix lint+mypy warnings
* add missing __enter__ methods
* make _IOBase inherit from BinaryIO
* make _TextIOBase not subclass _IOBase
2017-06-21 20:04:04 -07:00
Antoine Reversat and Jelle Zijlstra
6fe68fd120
[subprocess.run] Make timeout and input optional ( #1426 )
2017-06-21 13:28:16 -07:00
Guido van Rossum and Matthias Kramm
9238c737de
Make HasField and ClearField use Text instead of str ( #1425 )
...
This allows one to write `x.HasField("ok")` even if the file has
`from __future__ import unicode_literals`"
2017-06-21 10:51:49 -07:00
Guido van Rossum and Matthias Kramm
350563223f
Add Optional[] for all remaining cases of x: <type> = None ( #1424 )
...
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Guido van Rossum and GitHub
81f77b17ec
Remove double Optional[] ( #1423 )
2017-06-21 09:54:40 -07:00
Guido van Rossum and Jelle Zijlstra
04fe184dcf
Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy ( #1421 )
...
* Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy
* Make implicit Optional explicit in arg types (2and3 part)
* Convert {stdlib,third_party}/2 to explicit Optional
2017-06-20 22:18:49 -07:00
Guido van Rossum and Matthias Kramm
30256097ea
Use explicit Optional[] on argument types with default None ( #1420 )
2017-06-20 16:20:13 -07:00
Ask Solem and Guido van Rossum
5e74bb3efc
Stub for typing.AsyncIterable should have __aiter__, not __anext__ ( #1396 ) ( #1419 )
...
Fixes #1396 .
2017-06-20 14:23:56 -07:00
Atul Varma and Guido van Rossum
b8b3146904
Add PyJWT type annotations ( #1281 )
2017-06-20 13:19:09 -07:00
amstree and Guido van Rossum
b8a96045d9
add __init__ to Logger ( #1415 )
2017-06-20 13:17:26 -07:00
Ray Kraesig and Guido van Rossum
44127444d4
asynchat + asyncore: Python 3 compatibility ( #1402 )
...
Includes an update to smtpd, which uses asynchat.
2017-06-20 13:15:58 -07:00
Guido van Rossum and Matthias Kramm
86070643ac
Improve csv module and float() signature ( #1418 )
...
* DictReader should not be abstract. Reformat long lines.
* Make restval optional for DictWriter.__init__.
* The arg to reader() is *Iterable*, not *Iterator*.
* Improve signature of float() (use Union instead of overload).
2017-06-20 13:04:10 -07:00
rchen152 and Matthias Kramm
945527dbc0
Add a __new__ method to datetime.datetime. ( #1417 )
2017-06-19 17:05:34 -07:00
Luka Sterbic and Matthias Kramm
4a8a20f04e
Allow passing lambdas as init arguments in multiprocessing ( #1416 )
...
* Use NoReturn in multiprocessing init functions
* Use Any for init functions
2017-06-19 06:45:57 -07:00
Svyatoslav Ilinskiy and Matthias Kramm
d5eb32d67e
Support iteration over enums with enum34 ( #1412 )
...
* Support iteration over enums in python 2
* fix lint
2017-06-19 06:39:56 -07:00
Miguel Gaiowski and Łukasz Langa
a8dea5e05c
Update types for ThreadPoolExecutor for py3.6 ( #1414 )
...
* Update types for ThreadPoolExecutor for py3.6
* Removed Optional from ThreadPoolExecutor thread_name_prefix argument
2017-06-16 17:06:22 -07:00
Yusuke Miyazaki and Matthias Kramm
1c8498228d
Update stub for csv ( #1398 )
2017-06-15 16:35:17 -07:00
Matthias Kramm and Jukka Lehtosalo
5d1aacfed3
special-case overload for itertools.product with 'repeat' ( #1410 )
...
Add an additional overload for the `repeat = n` case. Since we don't know
the numeric value of `repeat`, this just produces an iterator over an
arbitrary-length tuple.
2017-06-15 19:13:46 +01:00
Guido van Rossum and Matthias Kramm
4fbdcf5b03
Revert "add back 'repeat' argument to itertools.product ( #1407 )" ( #1409 )
...
This reverts commit d5e7663f93 .
2017-06-14 13:10:29 -07:00
Guido van Rossum and Jelle Zijlstra
ab0de25949
Bump typed-ast version to 1.0.4 ( #1408 )
2017-06-14 10:43:28 -07:00
Matthias Kramm and Guido van Rossum
d5e7663f93
add back 'repeat' argument to itertools.product ( #1407 )
...
Fixes a regression introduced by #1393 .
2017-06-14 09:33:37 -07:00
Matthias Kramm and Jelle Zijlstra
6849262df6
add _levelNames to logging/__init__.py ( #1404 )
...
* add _levelNames to logging/__init__.py
* add Python 3's _levelToName and _nameToLevel
2017-06-13 08:26:14 -07:00
Semyon Proshev and Jelle Zijlstra
fed4e03e53
Add __new__ to str and int stubs in both Pythons. ( #1352 )
...
* Update default values to `...` in `__init__` and `__new__` in `int` and `str`.
* Add `__new__` to `enum.IntEnum` to override inherited `__new__`.
* Add `type: ignore` comment to `IntEnum`
2017-06-12 20:53:32 -07:00
Matthias Kramm and Jelle Zijlstra
ed6dc176da
make itertools.product more precise ( #1393 )
2017-06-12 20:10:08 -07:00
Ethan Smith and Guido van Rossum
ac36193550
Add Gitter chat badge ( #1399 )
...
And update other gitter links.
2017-06-12 15:55:05 -07:00
Matthias Kramm and Guido van Rossum
d4c13e73f9
gzip.GzipFile.__init__ accepts any Text for 'mode' ( #1403 )
2017-06-12 15:36:47 -07:00
Yusuke Miyazaki and Matthias Kramm
8f476378e0
Update stub for tarfile ( #1389 )
2017-06-09 06:59:45 -07:00
Thomas Grainger and Matthias Kramm
55f1883928
requests.(post|put|patch) json kwarg should be Any. ( #1387 )
...
```python
>>> requests.post('https://httpbin.org/post ', json=["ham", "spam", {"eggs": "bacon"}]).json()
{'args': {}, 'data': '["ham", "spam", {"eggs": "bacon"}]', 'files': {}, 'form': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Content-Length': '34', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.17.3'}, 'json': ['ham', 'spam', {'eggs': 'bacon'}], 'origin': '82.70.100.78', 'url': 'https://httpbin.org/post '}
>>> requests.post('https://httpbin.org/post ', json=("ham", "spam", {"eggs": "bacon"})).json()
{'args': {}, 'data': '["ham", "spam", {"eggs": "bacon"}]', 'files': {}, 'form': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Content-Length': '34', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.17.3'}, 'json': ['ham', 'spam', {'eggs': 'bacon'}], 'origin': '82.70.100.78', 'url': 'https://httpbin.org/post '}
```
2017-06-08 11:53:26 -07:00
Alex Khomchenko and Matthias Kramm
25b3a818d3
add required to click.option decorator ( #1397 )
2017-06-08 11:52:25 -07:00
Jan Hermann and Matthias Kramm
0709985d0c
fix signatures of sqlite3.register_adapter/converter ( #1390 )
2017-06-06 18:09:08 -07:00
rchen152 and Guido van Rossum
16ec7cbdf0
Add __new__ to time.struct_time ( #1394 )
...
This is needed because otherwise pytype uses the `__new__` inherited from the `NamedTuple` base class.
2017-06-06 15:36:01 -07:00
Luka Sterbic and Matthias Kramm
0679e0232c
Add start, shutdown and context manager methods to BaseManager ( #1392 )
2017-06-05 14:58:52 -07:00
pkordas and Matthias Kramm
4dd40465e7
added stub file for popen2 ( #1385 )
2017-06-05 12:27:34 -07:00
Carl Meyer and Jelle Zijlstra
802f3b21b3
Fix __init__ signature for unittest.mock.MagicMock. ( #1388 )
2017-06-04 10:08:56 -07:00
amstree and Jelle Zijlstra
1d4c73d708
Fix type annotations for glob ( #1386 )
2017-06-02 21:05:21 -07:00
Lukasz Langa
0b1f5db630
Remove spurious whitespace
2017-06-02 12:53:38 -07:00
mpage and Łukasz Langa
dca968102e
Fix stub for the ipaddress module ( #1384 )
...
* Fix stub for the ipaddress module
All methods that accept an "address" work on arbitrary objects. They
call str() on them and attempt to parse the result. As such, the type
of "address" should be object.
2017-06-02 12:49:12 -07:00
amstree and Łukasz Langa
66765c1fdb
add glob1 glob0 to glob ( #1368 )
...
* add glob1 glob0 to glob
* add glob1 glob0 to python 3 stub
* fix types to take str and unicode
* Update glob.pyi
2017-06-02 11:22:07 -07:00
Carl Meyer and Guido van Rossum
6d88431403
Correct the type of MethodType.__func__. ( #1383 )
...
See python/mypy#3484 for background.
2017-06-02 11:06:07 -07:00
Michael Lee and Łukasz Langa
d25c5b9ce4
Move stubs for 'click' into 2and3 folder ( #1364 )
2017-06-02 11:01:24 -07:00
Matthias Kramm and Guido van Rossum
a02f9b6d46
switch order of ContextManager and Generic ( #1382 )
...
Since ContextManager inherits from Generic, too, listing Generic first, in the list of base classes, results in a cyclic MRO.
2017-06-01 18:06:43 -07:00
Cooper Lees and Guido van Rossum
4656153478
Allow subprocess stdout + stderr be Optional ( #1375 )
...
- Adding optional to _FILE for stderr + stdout arguments to subprocess functions
- Sometimes you might want subprocess commands to be quiet and other time print the output
2017-06-01 17:46:14 -07:00