Commit Graph

270 Commits

Author SHA1 Message Date
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
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
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
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
Matthias Kramm
f75bbae18d Merge pull request #344 from tharvik/improve_unittest
improve unittest
2016-07-07 06:36:06 -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
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
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
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
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
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
Russ Allbery
0c26482488 difflib functions return Iterators, not Iterables (#310)
These functions all use yield.  It's valid to call the next method
on the return value, which is not true of Iterables.
2016-06-23 17:35:25 -07:00
Philip House
d2db605008 fixes #131 (#308) 2016-06-21 08:16:24 -07:00
Håken Lid
569b81c42a add stub for stdlib abc.ABC in python 3.4+ (issue #304) 2016-06-20 16:05:57 +02:00
Alvaro Caceres
d0ac66f5f8 Use "..." for attribute values, instead of None, [], {} 2016-06-15 14:10:04 -05:00
Alvaro Caceres
5886a5dfcd Fix signatures of call, check_call and check_output in subprocess 2016-06-15 13:34:02 -05:00
thomascellerier
f45c00f129 Added os.sync, os.truncate and os.fwalk for Python version >= 3.3 (#293) 2016-06-15 09:53:26 -07:00
Philip House
dee5e7a1df changed format_exception to use BaseException as value (#292) 2016-06-15 09:52:04 -07:00
Eklavya Sharma
b56ebf2b6a Make os.name str in python 3. (#296) 2016-06-14 16:30:07 -07:00
Phil Jones
f6decefd02 Fix email typing errors (#288)
* Change (Py3) email message payload type

The docstring of the Message get_payload method indicates that the
possible return types include None and bytes. Additionally the
set_payload method accepts bytes. Therefore I've changed the
PayloadType to include bytes and the get_payload return type to be an
Optional PayloadType.

* Change email (Py3) message_from_file IO types

Instead of using TextIO and BinaryIO use IO[str] and IO[bytes]
respectively to match the type returned by the open builtin. This
follows the recommendations in #283.

The error that prompts this is reproduced via:
```
from email import message_from_file

with open('email') as file_:
    email = message_from_file(file_)
```
Argument 1 to "message_from_file" has incompatible type IO[Any]; expected "TextIO"
2016-06-11 10:43:08 -07:00
Guido van Rossum
89dfe15008 Add TYPE_CHECKING = True 2016-06-10 17:27:12 -07:00
Mickaël S
4f1eb9a63c Fix argument type for configparser.write (#284) 2016-06-10 19:49:37 +01:00
Tim Abbott
6da0bcec4c Fix argument type for datetime.now. (#268)
It seems to actually take a tzinfo argument, not its subclass
timezone.
2016-06-06 15:21:11 -07:00
Valérian Rousset
c40a260b47 fix sys.exc_info return type (#246) 2016-06-06 08:52:40 -07:00
Valérian Rousset
4c42061c95 add types to socketserver for py2 (#250) 2016-06-06 08:37:17 -07:00
Scott G. Ainsworth
82b9baed3b Changed all regular expression findall() to return list[Any]. Findall() can return both list[AnyStr] and list[Tuple[AnyStr, AnyStr]]. (#269) 2016-06-05 17:50:12 -07:00
Valérian Rousset
e97638d4bd Improve http (#248) 2016-06-05 16:55:51 -07:00
James J Porter
2b55989f7d make xml.etree.ElementTree.Element a Sequence (#254) 2016-06-04 19:28:22 -07:00
Valérian Rousset
a581397c42 add types to logging (#247) 2016-06-04 19:20:15 -07:00
Max Payton
e8e82a7c73 Make Empty a subclass of Exception (#266) 2016-06-04 18:32:13 -07:00