Commit Graph

46 Commits

Author SHA1 Message Date
Kai Lautaportti
8fec896898 Added RecursionError to builtins for Python >= 3.5 (#620)
Closes #619.
2016-10-19 15:06:10 -07:00
Yegor Roganov
e4073e385a Improve types of staticmethod and classmethod (#609)
Fixes #318
2016-10-15 14:17:17 -07:00
Guido van Rossum
0b04c44710 Revert last two commits.
Reason: https://github.com/python/mypy/issues/328

* Revert "Make fromkeys() take an Iterable instead of a sequence. (#605)"

  This reverts commit 66e8d4a14f.

* Revert "Make dict.fromkeys() a classmethod (which it is). (#604)"

  This reverts commit 26dfcb6859.

* Add an explanation for fromkeys() being a staticmethod.
2016-10-14 21:11:10 -07:00
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
jgarvin
1b9266d801 Let open() take a pathlib.Path starting in 3.6 (#596) 2016-10-13 16:17:39 -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
claws
bed8a60990 add hex to bytes, bytearray, memoryview (#507) 2016-08-29 09:39:35 -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
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
Tomasz Elendt
9451fa922c Add start and stop arguments to Sequence.index in Py >= 3.5 (#489)
Fixes #486.
2016-08-22 14:53:48 -07:00
Daniel F Moisset
3c76029c57 Added attributes for UnicodeEncodeError (#481) 2016-08-18 05:57:16 -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
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
johnklai1
9795200acc Add optional delete argument to bytes.translate and bytearray.translate (#416) 2016-07-28 23:38:56 -07:00
Guido van Rossum
39325bf159 Mypy now supports sys.platform and sys.version_info checks (#410) 2016-07-27 13:25:29 -07:00
Guido van Rossum
df5c64e247 Add StopAsyncIteration; also add StopIteration.value. 2016-07-19 19:45:36 -07:00
Daniel F Moisset
ba349199d7 More general types for frozenset methods (#277)
Fixes #276.
2016-07-18 17:17:57 -07:00
speezepearson
534837e1ee add __{cause,context,traceback}__ to BaseException, per PEP 3134 (#369) 2016-07-13 15:26:55 -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
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
Guido van Rossum
25a45d6daf Revert "WIP: Mapping.{get,pop} can return default type (#223)"
This reverts commit d43adbe97e.

Here's a simple example of code that breaks with this PR:

from typing import Mapping, Dict, Tuple
a = {('0', '0'): 42}  # type: Mapping[Tuple[str, str], int]
b = a.get(('1', '1'), 0)

This gives an error on the last line:
error: No overload variant of "get" of "dict" matches argument types [Tuple[builtins.str, builtins.str], builtins.int]
2016-05-30 11:55:30 -07:00
Valérian Rousset
d43adbe97e WIP: Mapping.{get,pop} can return default type (#223)
* Mapping.{get,pop} can return default type

* Mapping values are covariant
2016-05-30 10:05:44 -07:00
Guido van Rossum
355143851a Use __delete__, not __del__, in class property. See comments on #199. 2016-05-17 11:26:14 -07:00
beckjake
70389d14ee Make property a type (#199) 2016-05-16 13:24:55 -07:00
Jakub Stasiak
cd12f6e255 Add some missing "type" attributes (#200) 2016-05-14 10:18:36 -07:00
rwbarton
2b80cdf75e Use overloading rather than Union for MutableMapping.update (#174)
See https://github.com/python/mypy/issues/1430 for motivation.
2016-05-01 17:50:01 +01:00
Guido van Rossum
79554d6da2 Add type.__call__. Fix #158. (#159) 2016-04-25 16:22:00 +01:00
Jukka Lehtosalo
70c2274e94 Update dict(...) to accept keyword arguments (#147)
We can't describe the fact that a keyword argument results in a 'str'
dictionary key in a stub. This needs to be handled elsewhere.
2016-04-16 16:30:15 +01:00
tharvik
3c92450972 add __dict__ attribute to class instance 2016-04-04 08:46:04 +02:00
David Fisher
d390ef3161 Make all function annotations accessible from builtins complete 2016-03-11 14:27:28 -08:00
Jakub Stasiak
41f0e7c8b6 Define three argument type() overload (Python 3)
This was missing for some reason while the Python 2.7 stubs have it.

Sample test code:

% cat testtype.py
A = type('A', (), {})
print(A.__name__)

Results before:

% python -m mypy --py2 testtype.py
% python -m mypy testtype.py
testtype.py:1: error: Too many arguments for "type"
%

Results after: type checking passes in both modes.
2016-03-03 09:19:59 +00:00
Hong Minhee
9f1ea9c412 Specify attribute types of SyntaxError 2016-02-29 13:35:30 +09:00
David Fisher
48b3b260d1 Remove invalid Python 3 syntax 2016-02-18 16:25:30 -08:00
Robert T. McGibbon
9933080b04 Update builtins.pyi 2016-02-03 15:20:03 -08:00
Robert T. McGibbon
8739c4a188 Improvements to builtins min/max 2016-02-03 15:16:52 -08:00
Guido van Rossum
e40c3eb8c9 Revert "Fix min()/max() overloading with key= parameter. Fixes #1150."
It has other problems, e.g. complains about max(x, 10) when the type of x is Any.

This reverts commit 6a47ac7116.
2016-01-27 11:10:40 -08:00
Guido van Rossum
6a47ac7116 Fix min()/max() overloading with key= parameter. Fixes #1150. 2016-01-26 11:13:14 -08:00
Guido van Rossum
17d8f20fd5 Add message attribute to class BaseException. 2016-01-25 16:32:47 -08:00
Guido van Rossum
cf82278301 Use plain bytes instead of ByteString in 3/builtins.pyi. 2016-01-25 08:12:46 -08:00
Ismail
fd4d063bb4 Implement fromhex and maketrans method 2016-01-25 15:43:06 +00:00
Matthias Kramm
25a3fac0fd Fix default parameter syntax.
Use 'x:bool = ...' instead of 'x:bool = True' or 'x:bool = False'.
2016-01-22 16:39:15 -08:00
Guido van Rossum
8c2118bace Move contents of builtins/* to stdlib/*. This simplifies finding stubs. 2016-01-12 12:53:18 -08:00
Ben Longbons
56fe787c74 Update a bunch of stubs 2015-10-19 20:02:10 -07:00
Ben Longbons
f2a12774ee Use SupportsBytes 2015-10-12 10:45:04 -07:00
Matthias Kramm
337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00