Commit Graph

419 Commits

Author SHA1 Message Date
Guido van Rossum
6d8628c247 Misc asyncio changes (#373)
* Add stub for cgi.parse_header().

* Improve asyncio stubs (far from complete)

* More asyncio changes.

* Use @overload to solve strange test failures.

* Add some TODOs. Make ProactorEventLoop conditional.

* Future should not inherit from Awaitable or implement __await__.

At least not yet.

* Fix AbstractServer.wait_closed() return type.

It's a generator, not a future.
2016-07-15 15:44:29 -07:00
Guido van Rossum
6aeea2a872 Add stub for cgi.parse_header(). (#371) 2016-07-15 15:42:51 -07:00
Valérian Rousset
8ef221c162 add zipfile for py2 (#345) 2016-07-15 05:55:20 -07:00
Daniel
932737d322 Made the readfp method take in a BinaryIO type (#346)
* Made the readfp method take in a BinaryIO type

* moving from BinaryIO to IO[str]
2016-07-14 12:36:22 +01:00
speezepearson
534837e1ee add __{cause,context,traceback}__ to BaseException, per PEP 3134 (#369) 2016-07-13 15:26:55 -07:00
Jukka Lehtosalo
e05edb60f1 Mypy stub fixes for strict optional mode (#366) 2016-07-13 09:38:40 -07:00
Eklavya Sharma
bca4c81b70 builtins: Remove Exception.message. (#363)
It's not present in 3.4 either, so this looks good to me.
2016-07-13 16:11:51 +01:00
Guido van Rossum
53d126f4d4 More fixes for argparse. (#362) 2016-07-13 07:51:29 -07:00
speezepearson
e815c803a6 add ChainMap class to collections module (#361)
* add ChainMap class to collections module

* ...and add it for Python 2 as well.
2016-07-13 06:16:37 -07:00
speezepearson
e436795124 add default arguments to traceback.format_exception (#360) 2016-07-13 06:14:16 -07:00
Matthias Kramm
e19e10c891 Merge pull request #348 from sharmaeklavya2/fix-subprocess-check-output
subprocess: Fix return type of check_output.
2016-07-12 17:12:33 -07:00
Guido van Rossum
b63e09c239 Fix some issues for dateutil and argparse (#357)
* Fix stubs for 2.7/dateutil. They were pretty broken.

(The 3/dateutil share some of the brokenness but that's still a TODO.)

* Fix argparse stubs.

- Container is not strong enough for choices.
- add_subparsers() returns something with an add_parser() method.
2016-07-12 16:24:33 -07:00
Guido van Rossum
1c4662d2f3 Two small changes to help the mypy test suite pass (#355)
* Condition arg for skip{If,Unless} should be object, not bool.

* Env arg to os.get_exec_path() is a Mapping, not a Dict.
2016-07-12 14:10:36 -07:00
Matthias Kramm
b48ddf7532 Merge pull request #352 from tharvik/improve_argparse
merge py2 and py3 argparse
2016-07-11 06:36:25 -07:00
tharvik
87235ad72b merge py2 and py3 argparse 2016-07-11 15:23:51 +02:00
Matthias Kramm
90b9d4d77c Merge pull request #339 from tharvik/improve_os
add some types to os
2016-07-11 06:18:38 -07:00
tharvik
1833e8e4b6 add some types to os 2016-07-11 15:09:52 +02:00
tharvik
0e635efa6c add bytearray.insert 2016-07-11 14:04:18 +02:00
Eklavya Sharma
1cccc2d115 __builtin__: Fix bytearray on python 2
bytearray should inherit from MutableSequence[int] instead of
Sequence[int].
2016-07-09 02:34:20 +05:30
Eklavya Sharma
a62a7af1c5 __builtin__: Change signature of bytearray.__delitem__.
Signature of bytearray.__delitem__ is overloaded to support both
int and slice as parameters.  Use a union instead.
This is needed to change bytearray's superclass from Sequence[int]
to MutableSequence[int], because the current signature of
__delitem__ is incompatible with that of MutableSequence.
2016-07-09 02:31:13 +05:30
Matthias Kramm
0c75a22ffb Merge pull request #303 from sharmaeklavya2/sort-cmp
Add cmp to list.sort in python 2.7
2016-07-07 13:22:49 -07:00
Michael Lee
adc6bf5f94 Update set methods to take multiple iterables (#349)
As of Python 2.7, you can pass in multiple iterables into some set
methods like union, intersection, difference, and update. So, for
example, `new_set = a.union(b, c)`.
2016-07-07 11:52:22 -07:00
Eklavya Sharma
a7754c3eff subprocess: Fix return type of check_output.
check_output's return type can be str if universal_newlines=True.
2016-07-07 22:04:29 +05:30
Fu Yong Quah
8a23acc8ee Add stdlib/2.7/traceback._print 2016-07-07 08:41:16 -07:00
Matthias Kramm
f75bbae18d Merge pull request #344 from tharvik/improve_unittest
improve unittest
2016-07-07 06:36:06 -07:00
Eklavya Sharma
5962927d3d Add cmp to list.sort in python 2.7 2016-07-07 14:55:29 +05:30
Guido van Rossum
5088131e5a Correct type of formatter_class arg to ArgParse(). 2016-07-06 11:42:57 -07:00
Matthias Kramm
7bef3added Merge pull request #297 from alvarocaceres/subprocess
Fix signatures of call, check_call and check_output in subprocess
2016-07-06 10:54:01 -07:00
Valérian Rousset
3eedf73a3a Add types to stub for warnings module. (#342) 2016-07-06 09:58:49 -07:00
tharvik
e102c99f36 improve unittest 2016-07-06 11:33:48 +02:00
Guido van Rossum
8515cf5de8 Attempt to reduce cyclical dependencies between types and importlib. (#335)
- Move Loader and ModuleType into _importlib_modulespec.pyi.
- Add "import X as X" for these to types.pyi and importlib/abc.pyi.

The goal is to ensure mypy -i still works, to fix https://github.com/python/mypy/issues/1797.
2016-07-05 10:23:24 -07:00
Elazar
8fb9f4a8f1 Add stubs for dis and opcode (#331) 2016-07-05 10:18:58 -07:00
Eklavya Sharma
c98c2afb58 os: Add buffering to fdopen. (#337) 2016-07-04 20:12:06 -07:00
Dakkaron
a393897c9a Added JSONEncoder and JSONDecoder to stdlib/2.7/json.pyi (#332) 2016-07-04 18:24:23 -07:00
Eklavya Sharma
df1a655858 email.header: Make decode_header also accept str. (#333)
decode_header accepts a parameter of type str or Header, but the
stub for decode_header types the parameter as Header.  Change
that to Union[Header, str].
2016-07-04 18:11:49 -07:00
Eklavya Sharma
a424eeb1f8 Fix some stubs in urllib.parse (#334)
* urllib.parse: Make return type of unquote_from_bytes str.

* urllib.parse: Reject encoding when quote is passed bytes.

encoding and errors must not be supplied to quote_plus and
quote if the first parameter is a bytes, or a TypeError is raised.
So overload quote and do not put encoding and errors in the
version where bytes is the first parameter.

quote and quote_plus also allow string and safe to be of different
types.  Also allow that in the stubs.
2016-07-04 13:53:46 -07:00
Guido van Rossum
37e42bfa96 ModuleType has a __file__ attribute. 2016-07-02 10:05:02 -07:00
Eklavya Sharma
15714bb0e8 Set a default value for output in CalledProcessError.__init__ (#329) 2016-07-02 07:40:09 -07:00
David Fisher
c5dcfe96d2 Add exec to Python 2 builtins (#328) 2016-07-01 19:04:12 -07:00
OrenLeaffer
998d787302 fix return type for traceback.format_exception (#326)
format_exception and format_exception_only both return lists of
strings, not strings.
2016-07-01 16:03:25 -07:00
Brett Cannon
ab08dbbf09 Add stubs for importlib.util (#325) 2016-07-01 10:32:23 -07:00
Drew Haven
b5978b18b6 Add tarfile.open (#324) 2016-06-30 17:36:58 -07:00
Brett Cannon
43c3406770 Add stubs for importlib.machinery (#323)
* Fix some misspelled method names that were also missing 'self'

* Initial stubs for importlib.machinery

* Use importlib.machinery.ModuleSpec everywhere
2016-06-30 17:07:49 -07:00
Brett Cannon
05e02c188f Implement stubs for importlib.abc and update types.ModuleType (#321) 2016-06-30 15:02:42 -07:00
Guido van Rossum
3a01aeb562 Fix bad syntax in two stubs. 2016-06-30 09:00:13 -07:00
Amit Saha
2e555c81b8 stdlib: StringIO - Add len attribute issue #316 2016-06-30 18:52:32 +10:00
tewe
c84c138194 Annotate **kwargs with dictionary value type only (#320) 2016-06-29 08:43:13 -07:00
tewe
ab4734ff7f Use actual base type (#313)
Avoids "Exception type must be derived from BaseException"
2016-06-28 18:26:54 +01:00
Brett Cannon
41b3fe2f60 Add stubs for importlib.__init__ (#314)
* Ignore VS Code

* Add stubs for importlib.__init__

Part of #189
2016-06-28 09:30:15 -07:00
Philip House
4a79dec6ba adding type-specific assertEqual cases (#315)
Adding support for type-specific equality methods (see https://docs.python.org/2.7/library/unittest.html?highlight=assertlistequals#unittest.TestCase.addTypeEqualityFunc) in the unittest stub for both 2.7/3. As requested by @gvanrossum in #308
2016-06-28 08:12:27 -07:00