Commit Graph
746 Commits
Author SHA1 Message Date
Svyatoslav IlinskiyandJelle Zijlstra 8ac0694056 Make functions any and all accept Iterable[object] (#1531)
Previously, they were accepting `Iterable`, which expanded to `Iterable[Any]`.
2017-08-07 17:13:43 -06:00
Svyatoslav IlinskiyandGuido van Rossum 3f9fafbbb7 Re-export code from _ast into ast. (#1515)
After mypy [started hiding](https://github.com/python/mypy/pull/3706) imported names in stubs unless `from ... import ...` is used, we found an error with stubs of ast module. 

It looks like ast module should re-export everything in `_ast` and according to PEP 484, it can do that by doing `from _ast import *`, so this is what this PR does.
2017-08-03 15:57:20 -07:00
Svyatoslav IlinskiyandGuido van Rossum aa68403230 Make BaseException's init accept object instead of Any (#1518) 2017-08-03 12:57:59 -07:00
Ashwini ChaudharyandMatthias Kramm baea852b62 Added stub for sre_parse and sre_constants(py3) (#1502)
* Added stub for sre_parse(py3)

* Fixed return type of SubPattern.__getitem__

* Typo

* Fix for issue related to error class

* Added stub for sre_constants(py3)

* Added missing import
2017-08-01 14:38:49 -07:00
blokeleyandMatthias Kramm c5479b11bb Add private methods stubs to queue.Queue (#1507)
It is a common pattern to subclass queue.Queue and override the private methods _init, _get, _put and _qsize so they should have stubs.
2017-08-01 14:37:51 -07:00
Jelle ZijlstraandMatthias Kramm 2d97894fa9 collections: make UserDict, UserList, and UserString concrete (#1477)
* collections: make UserDict, UserList, and UserString concrete

* add version checks

https://github.com/python/cpython/commit/573b44c18f69307d7dbc95c950aab57ef7ea303e

* remove redundant methods
2017-07-26 16:34:43 -07:00
Semyon ProshevandJelle Zijlstra 72fbc459a7 Add __init__ to types.MethodType (#1499) 2017-07-26 08:38:27 -07:00
Thomas GraingerandJelle Zijlstra 15c8474e35 fix email.mime (#1482)
* add missing python 2 email.mime.application stub

* restore missing python 3 mime package

* Delete __init__.py
2017-07-26 08:29:30 -07:00
Michael LeeandJelle Zijlstra 6d3024fb19 Add NoReturn type to typing stubs (#1496) 2017-07-20 21:24:34 -07:00
toejoughandGuido van Rossum f6b013ba52 ignore type for mock.pyi inheritance from Any (#1492)
It is currently required to shut up mypy when run with `--strict`
or `--disallow-subclassing-any`. The `Any` base class is currently
the only way to allow passing an instance of `Mock` to functions
expecting other classes (as is Mock's purpose).
2017-07-19 11:33:59 -07:00
Jelle ZijlstraandŁukasz Langa be7490322b Counter: fix return value of most_common() (#1491)
https://docs.python.org/3/library/collections.html#collections.Counter.most_common
https://docs.python.org/2/library/collections.html#collections.Counter.most_common
2017-07-19 20:29:32 +03:00
Jelle ZijlstraandŁukasz Langa 00ddb1c84a encodings: IncrementalEncoder and Decoder concrete (#1490)
These stubs are identical in Python 2 and 3, but I believe they
should not be merged, because there are numerous other modules
in the encodings package, and some only exist in some Python
versions. I don't think we can support that in the 2and3
directory.
2017-07-19 20:28:43 +03:00
Jelle ZijlstraandŁukasz Langa 32d9c8cb8f make io.IncrementalNewlineDecoder concrete (#1489)
Part of #1476
2017-07-19 20:28:25 +03:00
Jelle ZijlstraandŁukasz Langa ac651d2f8c Fix a few TODOs (#1487)
* fix some easy TODOs

* fix io
2017-07-19 20:27:50 +03:00
Jelle ZijlstraandŁukasz Langa 1515ed9f88 fix some abstract classes in third_party/ (#1486) 2017-07-19 20:27:22 +03:00
eujingandJelle Zijlstra be31439168 Added missing Process fields; More accurate Optional parameters (#1483) 2017-07-18 19:17:23 -07:00
Ivan LevkivskyiandJelle Zijlstra d75ea88da5 Use 'as name' patter to re-export names from stubs (PEP 484) (#1484) 2017-07-14 21:31:53 -07:00
Luka SterbicandŁukasz Langa dd7ff91519 Support mp.Value.value (#1480) 2017-07-12 15:00:14 +02:00
Ashwini ChaudharyandJelle Zijlstra 47b3979a83 Added stub for Python 3's _threading_local (#1462) 2017-07-10 21:20:02 -07:00
Jelle ZijlstraandMatthias 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
Jelle ZijlstraandMatthias 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 ZijlstraandMatthias 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 ZijlstraandMatthias 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
macheinsandJelle Zijlstra ab5f196fca Add maxsize attribute to Queue (#1465) 2017-07-04 08:40:17 -07:00
Ivan LevkivskyiandJelle 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
khyoxandJelle Zijlstra 61154a9ad2 Add more multiprocessing function stubs (#1435)
Fixes #1422
2017-06-30 22:25:05 -07:00
Rhys ParryandJelle Zijlstra 9e7953515d Allow os.readlink to accept path-like objects (#1441) 2017-06-30 22:00:36 -07:00
Rhys ParryandJelle 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 VilimandGuido van Rossum bc9b2f0d4d Fix signature for slite3.fetchmany (#1444)
Also made pymssql.fetchmany simpler.
2017-06-29 15:05:47 -07:00
Roy WilliamsandJelle 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
Jelle ZijlstraandGuido 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
mistermochaandGuido 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 ZijlstraandMatthias 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
Antoine ReversatandJelle Zijlstra 6fe68fd120 [subprocess.run] Make timeout and input optional (#1426) 2017-06-21 13:28:16 -07:00
Guido van RossumandMatthias 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 RossumandMatthias Kramm 30256097ea Use explicit Optional[] on argument types with default None (#1420) 2017-06-20 16:20:13 -07:00
Ask SolemandGuido van Rossum 5e74bb3efc Stub for typing.AsyncIterable should have __aiter__, not __anext__ (#1396) (#1419)
Fixes #1396.
2017-06-20 14:23:56 -07:00
Luka SterbicandMatthias 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 GaiowskiandŁ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 MiyazakiandMatthias Kramm 1c8498228d Update stub for csv (#1398) 2017-06-15 16:35:17 -07:00
Semyon ProshevandJelle 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 KrammandJelle Zijlstra ed6dc176da make itertools.product more precise (#1393) 2017-06-12 20:10:08 -07:00
Jan HermannandMatthias Kramm 0709985d0c fix signatures of sqlite3.register_adapter/converter (#1390) 2017-06-06 18:09:08 -07:00
rchen152andGuido 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 SterbicandMatthias Kramm 0679e0232c Add start, shutdown and context manager methods to BaseManager (#1392) 2017-06-05 14:58:52 -07:00
Carl MeyerandJelle Zijlstra 802f3b21b3 Fix __init__ signature for unittest.mock.MagicMock. (#1388) 2017-06-04 10:08:56 -07:00
Lukasz Langa 0b1f5db630 Remove spurious whitespace 2017-06-02 12:53:38 -07:00
amstreeandŁ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 MeyerandGuido van Rossum 6d88431403 Correct the type of MethodType.__func__. (#1383)
See python/mypy#3484 for background.
2017-06-02 11:06:07 -07:00
Cooper LeesandGuido 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