Jelle Zijlstra
f9135c5aa0
add __init_subclass__ to 3.6 ( #813 )
...
See also https://github.com/python/mypy/pull/2654
2017-01-09 09:22:20 -08:00
David Fisher
2cb8e184cc
Add NoReturn ( #811 )
...
* Add NoReturn
2017-01-04 13:38:05 -08:00
z33ky
93bb4604cb
Add special methods for object ( #774 )
...
* Add special methods for object
* Add __format__ to 2/__builtin__.pyi too
* Remove redundant __format__ from float.
2017-01-04 13:52:51 +00:00
Lukasz Langa
6e2709906b
Fixing flake8 B errors
2016-12-20 01:17:38 -08:00
Lukasz Langa
67e38b6806
Fixing flake8 E231 errors
2016-12-19 23:53:19 -08:00
Lukasz Langa
fe0e3744cc
Fixing flake8 E261 errors
2016-12-19 22:09:35 -08:00
TrueBrain
7e89fc0d49
Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]] ( #780 )
...
* Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]]
* A string as __slots__ value is also valid and represents a single item
2016-12-19 13:09:04 -08:00
David Fisher
beb9183103
Swap order of overloads to fix filter without strict optional ( #779 )
...
Related to python/mypy#2587
2016-12-16 15:57:04 -08:00
David Fisher
957307b785
Make filter work properly with Optional elements ( #775 )
2016-12-15 17:53:38 -08:00
Jelle Zijlstra
97a6d27558
Make first argument to filter optional
...
```
$ python3.4
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> list(filter(None, [False, True]))
[True]
>>>
```
2016-12-12 11:31:12 -08:00
Josiah Boning
c9ad4b8dc0
Have frozenset inherit from FrozenSet ( #726 )
...
Fixes python/mypy#2514
2016-11-30 17:58:11 -08:00
TrueBrain
341c4edc37
Args is a predefined attribute on BaseException, and always Tuple[Any, ...] ( #666 )
2016-11-05 16:33:58 -07:00
Guido van Rossum
7c20adb715
Fix memoryview stub ( #651 )
...
Fixes python/mypy#2390
2016-11-02 17:18:44 -07:00
TrueBrain
15ec66cdd6
Consider __doc__ always Optional. ( #641 )
...
python/mypy#2380 showed a discrepancy between object and FunctionType in stdlib2. The first defined __doc__ to be str, the second Optional[str]. As FunctionType depends on object, this is no longer valid.
As suggested by @gvanrossum in python/mypy#2380 , all __doc__ should be considered Optional.
(Final verdict was just to remove most __doc__ attributes since it's inherited from object.)
2016-10-30 11:48:23 -07:00
Elazar Gershuni
7a623f2cea
Dedicated TypeVar for type.__subclasses__ ( #639 )
2016-10-30 10:29:51 -07:00
Guido van Rossum
c3ddd3c5f2
Improve __subclasses__() signature. Fixes python/mypy#2236 .
2016-10-27 17:31:03 -07:00
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