Guido van Rossum
66e8d4a14f
Make fromkeys() take an Iterable instead of a sequence. ( #605 )
...
(This, too, came up in python/mypy#2254 -- thanks @rwbarton!)
2016-10-14 10:00:43 -07:00
Guido van Rossum
26dfcb6859
Make dict.fromkeys() a classmethod (which it is). ( #604 )
...
This came up in https://github.com/python/mypy/issues/2254 .
I don't know why it was previously defined as a staticmethod, perhaps
there was an old mypy issue?
2016-10-14 09:41:26 -07:00
Eklavya Sharma
7f7a5789bd
Add attribute 'name' to StringIO ( #600 )
...
Add an attribute 'name' of type str to StringIO.StringIO in python2
and io.StringIO in python2 and python3.
Fixes #598 .
2016-10-12 07:34:58 -07:00
Alvaro Caceres
08ac3b7742
2.7/os: remove exception throwing, add misc members ( #591 )
...
* 2.7/os: remove exception throwing, add misc members
* added tempnam, tmpnam
2016-10-12 07:34:35 -07:00
Alvaro Caceres
9b092f353e
2.7/inspect: add getframeinfo, getouterframes, Traceback ( #588 )
2016-10-06 15:20:42 -07:00
Alvaro Caceres
f90a6d1c0e
Inspect: use any instead of object ( #585 )
...
* Have inspect.getmembers' return value use Any instead of object
2016-10-06 11:36:17 -07:00
Alvaro Caceres
9586411dad
Add MONDAY, TUESDAY, ... constants to stdlib/calendar ( #586 )
...
These are undocumented but enough people seem to use them that they
should be considered public
2016-10-06 10:19:16 -07:00
Alvaro Caceres
9e71e54aa9
Add http status code constants to 2.7/httplib ( #584 )
2016-10-06 09:42:42 -07:00
olliewild
68339ebf2e
Add fileinput .pyi for Python 2.7. ( #572 )
2016-09-26 15:23:27 -07:00
dlinnemeyer
bbf0ac2d1f
Fixing timezone utc type ( #568 )
...
* switching to timezone type
* taking a shot at 2.7
2016-09-23 05:39:52 -07:00
Stephen Thorne
4b0efd9343
Allow the first argument to SequenceMatcher.__init__ to be None. ( #566 )
2016-09-21 17:06:02 -07:00
rchen152
b53e4c349d
Fix HTMLParser.HTMLParser, HTMLParseError. ( #565 )
...
Signed-off-by: Rebecca Chen <rechen@rechen0.mtv.corp.google.com >
2016-09-21 11:55:02 -07:00
Gustavo J. A. M. Carneiro
f93642b32a
Add __format__ to float, fixes #560 ( #561 )
...
Fixes #560 .
2016-09-21 08:17:28 -07:00
Guido van Rossum
8be390d2a6
Improve signature of communicate().
...
The input type can be bytes or unicode, the return types are always Optional bytes.
2016-09-19 15:17:09 -07:00
Guido van Rossum
794e51612e
Improve signatures of {get,set}sockopt(): use bytes, not str.
2016-09-19 15:17:09 -07:00
Samuel Colvin
773ad48c04
correct utcoffset return type ( #554 )
2016-09-18 13:44:38 -07:00
Elazar
1d820d48cf
Add signatures for cast() and NewType ( #549 )
...
(Mypy ignores these in favor of hard-coded behaviors, but the signatures here may be useful for other tools.)
2016-09-14 14:55:06 -07:00
Michael Lee
748428d8a4
Refine stubs for Python 2's decimal module ( #545 )
...
* Refine stubs for Python 2's decimal module
The decimal module for Python 2 was relatively incomplete, unlike the
decimal module for Python 3. This commit copies the relevant type
signatures from Python 3's decimal module to Python 2's.
There was a lot of code in both stubs and it wasn't clear to me if it
was safe to merge the two modules together, so I refrained from doing
so.
* Allow comparisions with Decimals and Floats
This commit loosens the types for Decimals to allow comparisons like
`Decimal('3.14') < 4.2`. Previously, you could compare decimals with
only other decimals or ints.
2016-09-14 09:40:14 -07:00
Michael Lee
f29a996501
Refine stubs for numbers.pyi ( #543 )
...
* Partially refine numbers.pyi
This commit refines numbers.pyi. More specifically, it...
- Adds in explicit type annotations where it's obvious how to do
so (leaving more non-obvious type signatures alone).
- Adds in missing '@abstractmethod' decorators
- Combines together the Python 2 and Python 3 versions of numbers.pyi.
* Merges Python 2 and Python 3 numbers.pyi
This commit removes the old `stdlib/2.7/numbers.pyi` file and moves the
previously-committed `stdlib/3/numbers.pyi` to the shared `2and3`
directory.
* Modify comment at top of numbers.pyi
Since the stubs are no longer identical to what stubgen creates, the
comment should also probably be changed.
2016-09-14 08:12:36 -07:00
Elazar
e25b882041
Full signature for namedtuple ( #541 )
2016-09-13 16:17:26 -07:00
Guido van Rossum
312725ed5d
Add next() to more IO classes
2016-09-13 11:48:50 -07:00
Guido van Rossum
8b0e6b886d
Fix signature for __exit__ ( #542 )
2016-09-13 11:00:01 -07:00
Guido van Rossum
0907e2cdda
Add missing BytesIO.next().
2016-09-12 12:24:06 -07:00
Alvaro Caceres
ecc400f125
Make string.Template.substitute's arg optional ( #535 )
2016-09-12 11:12:28 -07:00
Michael Lee
7a48825938
Copy stubs for os.spawn* from Python 3 to Python 2 ( #528 )
...
The stubs for the os module in Python 2.7 were somehow missing the
spawn* functions that were added to Python 3.
2016-09-09 12:00:00 -07:00
Alvaro Caceres
43fee3bc72
Declare 2.7 unittest's private util module ( #526 )
2016-09-09 06:30:58 -07:00
Guido van Rossum
25cb6e4ab4
Make Mapping covariant. ( #512 )
...
* Make Mapping covariant.
Fixes #510 .
This requires a `# type: ignore` on `__getitem__` and `get` because
mypy complains about covariant parameters.
FWIW typing.py needs to be changed too. (It was covariant in the
value but invariant in the key -- typeshed was invariant in both.)
* Delete outdated comment.
* Backpeddle a bit -- Mapping key type should not be covariant.
2016-09-05 20:57:37 +01:00
Valérian Rousset
1d5b35b2a5
Merge tarfile ( #467 )
2016-09-03 08:40:45 -07:00
Alvaro Caceres
23c44d3e36
Use generics for 2.7/weakref ( #516 )
2016-08-31 18:48:45 -07:00
Alvaro Caceres
79a9ae942e
Add DictMixin, IterableUserDict to 2.7/UserDict ( #513 )
2016-08-31 11:12:34 -07:00
Matthias Kramm
044d11f9ee
clean up unittest.py ( #509 )
...
* clean up unittest.py
Remove duplicates, adjust wrapping.
* also remove unittest from pytype blacklist
2016-08-31 07:27:53 -07:00
Michael Lee
97bc450acd
Make typing.IO inherit Iterator, not Iterable ( #502 )
...
In Python, it's possible to use the `next` builtin method on file
objects produced by `open`. This change modifies `typing.IO` so this
usage will successfully typecheck.
2016-08-27 23:31:16 -07:00
David Euresti
5e5b3726f2
Add missing Optional to str.split and socket.socket. ( #504 )
...
* Add Optional to str.split and friends
* Python 3: Make fileno arg of socket.socket Optional
Python 2: Remove fileno arg of socket.socket
2016-08-27 19:09:55 -07:00
David Fisher
e8df136ce8
Fix incorrectly Optional builtin function args ( #500 )
...
Many builtin functions were accidentally marked as Optional because
they were given default values of None.
2016-08-25 19:07:00 -07:00
Valérian Rousset
9f1e90b33f
Merge bisect ( #468 )
...
* merge bisect
* comment while mypy#2035
2016-08-24 06:07:40 -07:00
Tomasz Elendt
34175b888d
Fix __setitem__(slice, ...) of various mutable sequences ( #496 )
...
Adds support of assigning iterables to slice of mutable sequences and
bytes to bytearray's slice.
2016-08-23 19:02:50 -07:00
David Euresti
ed7c0779f7
Add memoryview class for python 2.7 ( #493 )
2016-08-23 18:48:10 -07:00
peterdotran
aef68f323f
Added attributes for URLError and HTTPError ( #494 )
2016-08-23 17:55:51 -07:00
Nicholas Bishop
a20d5c481a
Add type stub for typing.get_type_hints ( #480 )
...
Fixes issue #477
2016-08-16 20:41:01 -07:00
kosaka
5a79ba1abb
Fixes tzinfo return types ( #476 )
2016-08-16 08:07:00 -07:00
tonygrue-dbx
219c57a28c
Add winerror to WindowsError in builtins.pyi for Python 2.7 and 3 ( #470 )
...
Adds the int type member to WindowsError stub
2016-08-15 11:41:05 -07:00
David Euresti
69fdea09c9
Fix some type errors in gettext in python2. ( #469 )
...
Also makes it look more like the python3 version
2016-08-15 11:40:16 -07:00
Emanuel Barry
0989cb1cb3
Add FrozenSet to the typing stub files ( #474 )
2016-08-13 19:34:38 -07:00
Valérian Rousset
2824cd1197
Improve locale ( #462 )
2016-08-10 13:52:29 -07:00
Valérian Rousset
04d799f656
fix unprecise type in sys.exc_info in py2 ( #466 )
2016-08-10 13:37:01 -07:00
Jakub Stasiak
0edb87fc6b
Make functools.cmp_to_key more realistic ( #458 )
...
The documentation[1] says:
A comparison function is any callable that accept two arguments,
compares them, and returns a negative number for less-than, zero for
equality, or a positive number for greater-than.
This doesn't seem possible with the comparison function defined as
returning bool.
[1] https://docs.python.org/3.6/library/functools.html#functools.cmp_to_key
2016-08-10 12:12:52 -07:00
Jakub Stasiak
f3818cabbc
Handle passing a tuple of types to issubclass() ( #459 )
...
It can't be just any sequence hence Tuple is used instead of previously
mentioned Sequence.
2016-08-10 12:09:16 -07:00
Valérian Rousset
4e55f0561f
Improve traceback ( #465 )
2016-08-10 11:18:35 -07:00
David Fisher
f209136b3c
Make appropriate Popen constructor args Optional ( #457 )
2016-08-08 20:14:13 -07:00
Fu Yong Quah
6c1a185e49
Add exception globals in 2.7/sys.pyi. ( #440 )
2016-08-05 12:04:57 -07:00