Commit Graph
1290 Commits
Author SHA1 Message Date
Jelle ZijlstraandŁukasz Langa 5c328f12e1 configparser: support PathLike (#1547)
RawConfigParser.read has code explicitly supporting PathLike objects.

Also removed an unused import and widened the accepted type from
Sequence to Iterable.
2017-08-21 13:42:35 -07:00
Artur RodriguesandŁukasz Langa 485c232409 Improve resource stubs for py3 (#1565) 2017-08-21 10:08:51 -07:00
Daniel WatkinsandJelle Zijlstra 1c8f43b86c Add closefd keyword argument to Python 2's FileIO.__init__ (#1555)
Fixes #1553.
2017-08-17 20:47:08 +02:00
Svyatoslav IlinskiyandJelle Zijlstra 4491e415f9 Make operations on set take AbstractSet[object] (#1533)
Previously they were `AbstractSet[Any]`
2017-08-11 17:17:47 -07:00
Ashwini ChaudharyandJelle Zijlstra 4f14617db1 Add stub for codeop to 2and3 (#1534) 2017-08-11 17:09:57 -07:00
Evan KrallandGuido van Rossum 9db63fee91 Make IOBase.__enter__ return the same type as self. Fixes #1540. (#1541) 2017-08-11 16:06:07 -07:00
Alex EllisandJelle Zijlstra 10a3e43a19 Queue stubs: Make LIFOQueue and PriorityQueue generic (#1538) 2017-08-10 20:15:43 -07:00
Adam DangoorandGuido van Rossum 7fe417ca58 In Python 3.4 and above, os.makedirs and os.removedirs use the kwarg "name" rather than "path" (#1536) 2017-08-08 18:42:29 -07:00
Jelle ZijlstraandGuido van Rossum d60f26c448 add object.__dir__ in Python 3 (#1532)
In Python 3 (but not Python 2), `object().__dir__()` works and returns a list of strings.

This is relevant when implementing a custom `__dir__` that invokes `super().__dir__()`.
2017-08-07 19:29:13 -07:00
Brian C. LaneandGuido van Rossum 19275ea38a Make multiprocessing.Queue a subclass of queue.Queue (#1525)
Also change multiprocessing.Queue's put and get timeout arguments to
allow None.

This fixes a problem with logging.handlers.QueueHandler and
QueueListener not accepting a multiprocessing.Queue as the queue
argument.

Declaring the Queue now needs to note what it will be used for. eg.
q = multiprocessing.Queue()    # type: multiprocessing.Queue[List[Any]]
2017-08-07 19:25:53 -07:00
vim345andJelle Zijlstra 228615b307 fix the type definition of namer function (#1498) 2017-08-07 17:36:05 -06:00
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
Ashwini ChaudharyandJelle Zijlstra c6bb8a7c88 Added stub for chunk(py 2 and 3) (#1523) 2017-08-06 08:21:09 -07:00
Matthias KrammandGuido van Rossum 3638bc1f52 Fix Python 2's traceback.format_exception, traceback.print_exception (#1512)
E.g. it's legal to call traceback.format_exception(None, None, None). In
particular, this change makes the following idiom type-check:
  import traceback
  import sys
  exc_type, exc_value, exc_traceback = sys.exc_info()
  traceback.format_exception(exc_type, exc_value, exc_traceback)
2017-08-03 15:58:34 -07: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 0c7b50378b Added stub for mutex(py2) (#1509) 2017-08-02 08:32:10 -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
Ashwini ChaudharyandMatthias Kramm 01a0c51acf Added stub for sre_parse and sre_constants(py2) (#1500)
* Added stub for sre_parse (py2)

* Added missing import

* Added missing hints; Fixed _AvType and _TemplateType

* Added stub for sre_constants
2017-08-01 14:38:22 -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
Matthias KrammandGuido van Rossum 6f23d124c0 Remove subclass IOBase from TextIOBase. (#1505)
This used to cause TextIOBase to subclass both BinaryIO and TextIO, even
though those two are incompatible.
2017-07-28 21:07:37 -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
Luka SterbicandJelle Zijlstra 34c8aa0d4c traceback: use StackSummary where possible (#1495) 2017-07-26 08:27:43 -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 74966bacd9 distutils: make Command classes non-abstract (#1488) 2017-07-19 20:28:16 +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
Ashwini ChaudharyandJelle Zijlstra 11a479fd69 Add stub for formatter (#1481) 2017-07-18 19:19:14 -07:00
eujingandJelle Zijlstra be31439168 Added missing Process fields; More accurate Optional parameters (#1483) 2017-07-18 19:17:23 -07:00
Ashwini ChaudharyandJelle Zijlstra a4a34a0e73 Added stub for stringold module (#1460) 2017-07-16 15:08:27 -07:00
Thomas GraingerandJelle Zijlstra 2bb7ea9595 csv DictReader should only yield OrderedDicts in Py3.6 (#1478) 2017-07-14 21:58:52 -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
rchen152andMatthias Kramm 643aedea1b Fix the definition of LockType.__exit__. (#1485) 2017-07-13 17:30:51 -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
Thomas GraingerandJelle 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 ZijlstraandMatthias Kramm 0e26c1f936 asyncio: fix several types (#1450)
Fixes #1447
2017-07-06 14:22:55 -07:00
rchen152andMatthias 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 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
Ashwini ChaudharyandJelle Zijlstra 1a9685c6ce Added stub for Python 2's _threading_local (#1461) 2017-07-04 20:01:17 -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 7ecc979211 locale: broaden type of val argument to format (#1453)
Fixes #1350
2017-07-04 19:21:12 -07:00
Jelle ZijlstraandMatthias 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