Jelle Zijlstra and Łukasz Langa
1515ed9f88
fix some abstract classes in third_party/ ( #1486 )
2017-07-19 20:27:22 +03:00
Ashwini Chaudhary and Jelle Zijlstra
11a479fd69
Add stub for formatter ( #1481 )
2017-07-18 19:19:14 -07:00
eujing and Jelle Zijlstra
be31439168
Added missing Process fields; More accurate Optional parameters ( #1483 )
2017-07-18 19:17:23 -07:00
Ashwini Chaudhary and Jelle Zijlstra
a4a34a0e73
Added stub for stringold module ( #1460 )
2017-07-16 15:08:27 -07:00
Thomas Grainger and Jelle Zijlstra
2bb7ea9595
csv DictReader should only yield OrderedDicts in Py3.6 ( #1478 )
2017-07-14 21:58:52 -07:00
Ivan Levkivskyi and Jelle Zijlstra
d75ea88da5
Use 'as name' patter to re-export names from stubs (PEP 484) ( #1484 )
2017-07-14 21:31:53 -07:00
rchen152 and Matthias Kramm
643aedea1b
Fix the definition of LockType.__exit__. ( #1485 )
2017-07-13 17:30:51 -07:00
Luka Sterbic and Łukasz Langa
dd7ff91519
Support mp.Value.value ( #1480 )
2017-07-12 15:00:14 +02:00
Ashwini Chaudhary and Jelle Zijlstra
47b3979a83
Added stub for Python 3's _threading_local ( #1462 )
2017-07-10 21:20:02 -07:00
Thomas Grainger and Jelle Zijlstra
7637549ced
fix DictReader definition ( #1475 )
...
* constructable with Iterable
* __iter__ returns another DictReader
* supports `__next__` on python 3
* supports `next` on python 2
2017-07-10 21:02:59 -07:00
Jelle Zijlstra and Matthias Kramm
0e26c1f936
asyncio: fix several types ( #1450 )
...
Fixes #1447
2017-07-06 14:22:55 -07:00
rchen152 and Matthias Kramm
6368baf42a
Remove duplicate names from posixpath.pyi. ( #1468 )
...
posixpath.pyi did a '*' import of genericpath.pyi and then redefined
everything it imported. Removes the duplicate definitions from posixpath
and improves the ones in genericpath.
2017-07-06 14:22:18 -07:00
Jelle Zijlstra and Matthias Kramm
16aa0651ae
Revert "Add __new__ to str and int stubs in both Pythons. ( #1352 )" ( #1466 )
...
This reverts commit fed4e03e53 .
2017-07-06 14:21:54 -07:00
Ashwini Chaudhary and Jelle Zijlstra
1a9685c6ce
Added stub for Python 2's _threading_local ( #1461 )
2017-07-04 20:01:17 -07:00
Jelle Zijlstra and Matthias Kramm
318cada66c
os: merge the top and bottom of os/__init__.pyi ( #1458 )
...
* os: merge the top and bottom of os/__init__.pyi
Part of #1427 . In preparation for merging the two stubs, I'm making the files
identical as much as possible. This PR merges the top of the file, down to
but not including the definition of statvfs_result, and the bottom up to
and including os.utime.
This PR mostly adds more "if sys.version_info" block. Until the merger
completes, we'll have some Python 2 blocks in the Python 3 stub and vice versa.
I also add a few missing constants and arguments.
In followup PRs I'll merge the rest of the file. I'll put the trickiest part
(the return values of functions like os.stat) in its own PR.
* back out DirEntry from py2
It relies on stat_result which we don't have yet in py2.
2017-07-04 19:30:55 -07:00
Jelle Zijlstra and Matthias Kramm
a419b696d4
make os.path identical in Python 2 and 3 ( #1459 )
...
Part of #1427 . I don't think we can actually merge these until we merge
os/__init__.pyi too, which will take a few more PRs.
2017-07-04 19:27:27 -07:00
Jelle Zijlstra and Matthias Kramm
7ecc979211
locale: broaden type of val argument to format ( #1453 )
...
Fixes #1350
2017-07-04 19:21:12 -07:00
Jelle Zijlstra and Matthias Kramm
f264eda4ed
builtins: mode argument to open can be unicode ( #1452 )
...
Part of #1411
Also remove some explicit parameter defaults.
2017-07-04 19:20:45 -07:00
Jelle Zijlstra and Matthias Kramm
9947c9d513
urlparse: allow unicode arguments in more places ( #1451 )
...
* urlparse: allow unicode arguments in more places
Part of #1411
urlunsplit() and similar functions accept either unicode or str in all
places. Their actual return type is unicode if any of the arguments is
unicode and nonempty, which the type system can't exactly express. I
left the return type as str because str is implicitly promoted to
unicode, so using the return type in a place that accepts unicode should
work.
unquote, parse_qs, and parse_qsl return unicode if you pass them unicode,
so AnyStr is appropriate in their stubs.
* fix type for urldefrag
The return type was wrong; this function returns a 2-tuple. The second member of the tuple is always a `str` if the argument type does not contain '#', and otherwise matches the type of the argument.
2017-07-04 19:20:23 -07:00
Jelle Zijlstra and Matthias Kramm
fee2eaae30
xml.sax.saxutils: make some functions take AnyStr ( #1457 )
...
Fixes #1062
2017-07-04 19:18:43 -07:00
Jelle Zijlstra and Matthias Kramm
2b97c02801
logging: make Logger inherit from Filterer ( #1448 )
...
Fixes #1401
2017-07-04 19:18:01 -07:00
Jelle Zijlstra and Matthias Kramm
e980c8987b
tokenize: add generate_tokens in py3 ( #1449 )
...
Fixes #1433
This is undocumented but somebody is asking for it to be included.
2017-07-04 19:17:39 -07:00
macheins and Jelle Zijlstra
ab5f196fca
Add maxsize attribute to Queue ( #1465 )
2017-07-04 08:40:17 -07:00
Ivan Levkivskyi and Jelle Zijlstra
97737ce8c2
Add collections import in typing for type aliases to always work ( #1456 )
...
* Add collections import in typing for type aliases to always work
* Add mypy issue number to the comment
2017-07-03 10:01:19 -07:00
Ashwini Chaudhary and Jelle Zijlstra
83d5ba157c
Added stub for toaiff module ( #1455 )
2017-07-02 21:24:21 -07:00
Ashwini Chaudhary and Jelle Zijlstra
489696e9a1
Added stub for user module ( #1454 )
2017-07-02 15:17:37 -07:00
khyox and Jelle Zijlstra
61154a9ad2
Add more multiprocessing function stubs ( #1435 )
...
Fixes #1422
2017-06-30 22:25:05 -07:00
Rhys Parry and Jelle Zijlstra
9e7953515d
Allow os.readlink to accept path-like objects ( #1441 )
2017-06-30 22:00:36 -07:00
Rhys Parry and Jelle Zijlstra
683c6e90a0
Support named attributes in os.uname() result ( #1445 )
...
`os.uname` changed in version 3.3: Return type changed from a tuple to
a tuple-like object with named attributes.
2017-06-30 21:58:44 -07:00
Peter Vilim and Guido van Rossum
bc9b2f0d4d
Fix signature for slite3.fetchmany ( #1444 )
...
Also made pymssql.fetchmany simpler.
2017-06-29 15:05:47 -07:00
Roy Williams and Jelle Zijlstra
ac87de50dd
Add __name__ field to MethodType ( #1442 )
...
See https://github.com/python/cpython/blob/08c16016e2a2d1368d001ddebfe9ca92465773c4/Lib/types.py#L32-L34
```python
>>> class _C:
... def _m(self): pass
...
>>> _C()._m.__name__
'_m'
```
2017-06-29 10:05:25 -07:00
Roy Williams and Jelle Zijlstra
5a95e19322
Allow csv module to support both str and unicode types in Python 2 ( #1437 )
...
* Replace keys in DictReader with Any
2017-06-27 14:24:22 -07:00
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
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
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
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 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
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
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