Commit Graph

28 Commits

Author SHA1 Message Date
Nicholas Bishop
a20d5c481a Add type stub for typing.get_type_hints (#480)
Fixes issue #477
2016-08-16 20:41:01 -07:00
Emanuel Barry
0989cb1cb3 Add FrozenSet to the typing stub files (#474) 2016-08-13 19:34:38 -07:00
Michael Lee
9ecc1f2147 Add stubs for NewType helper function (#398)
(Note that this is not enough to support NewType(). However it's a prerequisite for the mypy implementation.)
2016-07-26 07:35:28 -07:00
Michael Lee
368c703078 Add dict views to python 2 (#376) 2016-07-21 11:28:35 -07:00
Alvaro Caceres
d0ac66f5f8 Use "..." for attribute values, instead of None, [], {} 2016-06-15 14:10:04 -05:00
Guido van Rossum
89dfe15008 Add TYPE_CHECKING = True 2016-06-10 17:27:12 -07:00
Tim Simpson
ac9ade5374 Allow use of kwargs in MutableMapping.update (#252)
Discovered while adding MyPy for code that was implementing
MutableMapping and using the update function like this:

```python
class CaseInsensitiveDict(collections.MutableMapping):
    def __init__(self, data=None, **kwargs):
        # type: (dict, **Any) -> None
        self._store = dict()  # type: dict
        if data is None:
            data = {}
        self.update(data, **kwargs)
```

This commit adds kwargs to MutableMapping to allow this.

Shout out to Tim Abbott for assisting me with this.
2016-06-05 18:10:56 -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
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
b6b8554c6b Add stub version of Type[C] (#216) 2016-05-24 16:44:13 -07:00
detlefla
e2ce50b525 enable string arguments for start, end, and span methods of Match object 2016-05-07 09:53:24 -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
Ben Darnell
2ddbf901c9 2.7 stub updates (#149)
* Stubgen modules for 2.7

Cookie
email._parseaddr
email.utils
genericpath
linecache
mimetypes
multiprocessing
multiprocessing.process
multiprocessing.util
posixpath
quopri
runpy
weakref
wsgiref.validate

* 2.7/typing.py: add missing __contains__ definition

* 2.7/subprocess.py: make output argument to CalledProcessError optional

Commit f08160bd did the same for py3.

* 2.7/hmac.pyi: add compare_digest

This function was introduced to the 2.7 series in 2.7.7.

* Stubgen 2.7/ssl.pyi

This replaces a nearly-empty handwritten stub.

* Copy constants and other definitions from py3 to py2 ssl.pyi

* 2.7/__future__.pyi: add methods

* 2.7/_weakref.pyi: backport some definitions from 3.x version

* Stubgen 2.7/locale.pyi

Hand-edited to remove declarations that are redundant (and cause
conflicts with) the "from _locale import *" line.
2016-04-17 19:02:55 -07:00
Guido van Rossum
78e6e9b740 Add Text to typing.pyi; it's an alias for unicode in 2.7, for str in 3. 2016-04-16 13:42:17 -07:00
Guido van Rossum
23ec1ff96a Break cycle between typing and collections. (Requires a fix in mypy.) 2016-04-15 21:31:49 -07:00
Ivan Levkivskyi
db3cc2e8da Enable typing.DefaultDict as an alias for collections.defaultdict (#139) 2016-04-09 09:32:20 -07:00
David Fisher
d390ef3161 Make all function annotations accessible from builtins complete 2016-03-11 14:27:28 -08:00
Guido van Rossum
8539624f05 Fix Reversible.__reversed__() return type. (I should do more testing.) 2016-01-11 16:04:44 -08:00
Guido van Rossum
1c02f14dc1 Make Reversible covariant. Fixes #19. (Though it does not seem to be *necessary*.) 2016-01-11 15:32:43 -08:00
Guido van Rossum
0673b7bab9 Add Generator to 2.7/typing.pyi. Fixes #29. 2016-01-11 15:26:22 -08:00
Guido van Rossum
0f21b59a30 Some updates now typing.Container is defined. 2016-01-06 16:38:14 -08:00
Guido van Rossum
71b8a9f9ec Update 2.7 built-in set to be the same as PY3 set. AbstractSet does not have a union() method. 2016-01-06 16:06:58 -08:00
Greg Price
f3b499fd99 typing: update 2 to match 3 on Sequence and Container 2015-12-21 18:11:14 -08:00
Matthias Kramm
94c9ce8fd0 Consistently use '= ...' for optional parameters. 2015-11-09 13:55:02 -08:00
Matthias Kramm
4fe8915d44 Add missing '-> None' to all __init__ methods. 2015-11-09 10:25:11 -08:00
Ben Longbons
56fe787c74 Update a bunch of stubs 2015-10-19 20:02:10 -07:00
Matthias Kramm
337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00