Commit Graph

552 Commits

Author SHA1 Message Date
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
Amandine Lee
03326014a5 Use unicode rather than str for os env functions (#312) 2016-06-24 11:18:24 -07:00
Russ Allbery
9f3d84551d Add stub for statvfs and type for fstatvfs (2.7) (#311)
Use the same approach as for resource: define a private NamedTuple
to represent the return value that can be addressed by name or by
sequence.
2016-06-23 17:39:06 -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
Russ Allbery
6e3514ccd0 Fix names of several stat constants (2.7) (#309)
Several of the constants were mistakenly stubbed with names
starting with ST_ instead of S_.  Fix them to match the module
documentation.
2016-06-23 14:42:05 -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
Matthias Kramm
37bc4987be Merge pull request #299 from alvarocaceres/csv
csv module: make reader() and writer() return types private and non-abstract
2016-06-15 15:01:28 -07:00
Alvaro Caceres
122da1ca3f Add Any for collections.pyi 2016-06-15 15:57:55 -05:00
Alvaro Caceres
84c76f8188 csv module: make reader() and writer() return types private and non-abstract 2016-06-15 14:12:06 -05: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
Guido van Rossum
0b19fb471c Revert "add types to ssl for py2 (#251)"
This reverts commit 4039a1a686.

Reason: several constants (e.g. SSL_ERROR_EOF, SSL_ERROR_SSL, SSL_ERROR_WANT_READ and a few others) are missing.
2016-06-10 17:26:36 -07:00