Commit Graph

496 Commits

Author SHA1 Message Date
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
8ee3123e02 Fix log() signatures; change msg: str to msg: Text. 2016-06-05 17:25:56 -07:00
Guido van Rossum
d75e2ab224 Add logging.WARN; TextIO -> IO[str]. 2016-06-05 17:10:15 -07:00
Valérian Rousset
e97638d4bd Improve http (#248) 2016-06-05 16:55:51 -07:00
Valérian Rousset
09e165ec35 Improve socket py2 (#249)
* add vim swap files to gitignore

* add types to socket.socket.send{,all} for py2
2016-06-05 16:51:26 -07:00
James J Porter
2b55989f7d make xml.etree.ElementTree.Element a Sequence (#254) 2016-06-04 19:28:22 -07:00
Valérian Rousset
a581397c42 add types to logging (#247) 2016-06-04 19:20:15 -07:00
Max Payton
e8e82a7c73 Make Empty a subclass of Exception (#266) 2016-06-04 18:32:13 -07:00
Max Payton
a619491060 Add full class definitions for Process, Queue, and Lock (#265)
These should be all the methods one can call on those classes
2016-06-04 18:31:48 -07:00
Tomasz Elendt
9acc9b31ac Fix heapq.merge signature for Python >= 3.5 (#227) (#261)
Add the optional key and reverse parameters:
https://docs.python.org/3.5/library/heapq.html#heapq.merge
2016-06-04 16:00:45 -07:00
Tomasz Elendt
a277980d99 Fix types.MappingProxyType (#259) (#260) 2016-06-04 13:02:07 -07:00
David Euresti
0bfa0636e1 Add http_client to six.moves, add missing functions to urllib2 fix some types in gettext (#262) 2016-06-04 12:02:55 -07:00
David Fisher
49000ccc5e Merge pull request #255 from iamaspacecow/typeshed_calendar_fixes
Update calendar.pyi `timegm` to accept arbitrary length tuples
2016-06-03 17:47:52 -07:00
David Fisher
fb96ee8e50 Revert "replace re patterns AnyStr with Union[str, unicode]"
This reverts commit ba2c8d95ec.
This commit introduced some bugs (it used Pattern[Union[str, unicode]]
when it would need to be Union[Pattern[str], Pattern[unicode]]), and
- on further discussion - it's unclear if we want to allow this
  additional flexibility.  I'm reverting this diff for now, but we'll
revisit this after deciding on the upcoming proposal about how implicit
bytes/unicode conversions should be handled when typing Python 2.
2016-06-03 17:41:01 -07:00
Max Payton
c8f0669ee4 Update calendar.pyi timegm to accept arbitrary length tuples
timegm takes struct_time objects, which are NamedTuples that have 9 elements by default
That would not take Tuple[Int], so typeshed would report errors
2016-06-03 16:10:09 -07:00
Tim Simpson
31a97363a9 Fixes a few tzinfo method's return type (#253) 2016-06-03 12:38:47 -07:00
erinhaswell
2c52d9a612 Correct return value of round in Python 2. (#245)
In Python 2.7, round returns a float, even when ndigits is omitted. In Python 3, round returns an int if ndigits is omitted.
2016-06-02 19:00:20 -07:00
Oren Leaffer
ba2c8d95ec replace re patterns AnyStr with Union[str, unicode] 2016-06-02 17:53:39 -07:00
Tim Simpson
80a37f3f93 Initial stubs for tkinter (#242)
This is the stubgen output for tkinter, tkinter.constants and tkinter.ttk, with only a few manual fixes (#1603).
2016-06-02 10:16:01 -07:00
Valérian Rousset
7721505397 complete ssl (#239) 2016-06-02 10:08:07 -07:00
Valérian Rousset
20d875dc75 complete socketserver (#238) 2016-06-02 10:06:41 -07:00
Valérian Rousset
cf5edec4de add types to socket.socket.send{,all} (#240) 2016-06-02 10:04:15 -07:00
Valérian Rousset
2b776cfb4e complete urllib (#241) 2016-06-02 09:22:29 -07:00
Valérian Rousset
a32d8a9da6 add types to sys.getrefcount (#237) 2016-06-02 00:27:37 -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
Valérian Rousset
5b5f01f33c Improve email.* (#207)
* improve email

* complete email.message

* complete email.policy

* complete email.parser

* complete email.generator

* complete email.headerregistry

* complete email.contentmanager

* complete email.header

* complete email.charset

* complete email.errors

* complete email.feedparser
2016-05-30 10:04:51 -07:00
Valérian Rousset
191e153427 more closely fit to html.parser documentation (#231) 2016-05-30 09:51:34 -07:00
Valérian Rousset
ff94f6def0 specifiy Callable in sys.call_tracing (#230) 2016-05-30 09:32:56 -07:00
Vadim Chugunov
eabecf89d8 Fix setsockopt signature. (#226)
Closes #225
2016-05-26 15:23:31 -07:00
Dakkaron
f32e26ebc2 Added stdlib/2.7/getopt.pyi, updated 3/getopt.pyi (#221)
* Added stdlib/2.7/getopt.pyi

* Small fixes to stdlib/3/getopt.pyi
2016-05-25 07:14:42 -07:00
Jukka Lehtosalo
b98580d299 Don't use basestring in tempfile stub (#205)
Fixes #202.
2016-05-24 16:45:48 -07:00
Guido van Rossum
b6b8554c6b Add stub version of Type[C] (#216) 2016-05-24 16:44:13 -07:00
Dakkaron
25f5c9c6f8 Added type annotations and small fixes (#219)
* json.loads() accepts unicode

* threading.BoundedSemaphore is subclass of Semaphore

* Added type annotations for logging/__init__.pyi and logging/handlers.pyi

* Changed style of variable declaration to fit the rest of the file
2016-05-23 09:16:01 -07:00
Florian Bruhin
11049f9a4f Fix html.escape signature (#218)
The quote argument for html.escape is optional: https://docs.python.org/3.5/library/html.html#html.escape
2016-05-19 14:37:19 -07:00
David Shea
8503f13a41 Add types for gettext (#217)
* Add empty stubs for gettext Translations subclasses

GNUTranslations and NullTranslations do not add any methods to the base
Translations class, so remove the TODO comment and just declare the
classes.

* Add missing types for py3 gettext.
2016-05-19 14:34:38 -07:00
David Euresti
2bb026cd76 Fix type of getsockopt (#213) 2016-05-18 15:30:24 -07:00
Valérian Rousset
9154cd1320 type errors in codecs.EncodedFile (#208) 2016-05-18 14:43:33 +01:00
Guido van Rossum
355143851a Use __delete__, not __del__, in class property. See comments on #199. 2016-05-17 11:26:14 -07:00
jukebox
8e3bde1dab getpass return str (#204) 2016-05-17 14:32:03 +01:00
beckjake
70389d14ee Make property a type (#199) 2016-05-16 13:24:55 -07:00
Guido van Rossum
3e37029bfe Almost all re functions take a compiled pattern. (Even re.compile()!) (#203)
* Almost all re functions take a compiled pattern. (Even re.compile()!)

Fixes #188

Note: I'm using AnyStr so that the type of string used for pattern and
for the rest of the arguments must match.  This is not 100% correct,
since Python 2 sometimes allows mixed types.  But sometimes it
doesn't, depending on the values (e.g. non-ASCII bytes), and Python 3
always insists on matching, so I think this is actually a good idea.

* Same treatment for stdlib/3/re.pyi.
2016-05-16 11:25:59 -07:00
Jukka Lehtosalo
d09cc058a6 Add note about not using basestring in tempfile 2016-05-16 17:46:41 +01:00
Jukka Lehtosalo
d3d6a47302 Accept more unicode in 2.7 tempfile stubs (#201) 2016-05-16 13:37:15 +01:00
Jakub Stasiak
cd12f6e255 Add some missing "type" attributes (#200) 2016-05-14 10:18:36 -07:00
Valérian Rousset
e9efb31aa7 fix integration of io with mypy (#196) 2016-05-12 16:52:36 -07:00
Guido van Rossum
5c881a6b86 Add apply() and coerce() to 2.7 builtins. 2016-05-12 15:50:41 -07:00
Thomas Grainger
833a81d85e Add __future__.generator_stop for Python 3.5 (#195) 2016-05-12 15:39:55 -07:00
Tim Abbott
ea734c69d0 Fix subprocess stubs (#198)
* subprocess.CalledProcessError output argument is optional.

* subprocess.CalledProcessError takes stderr argument in python3.

* subprocess: Fix type for command in call() and friends.

The stubs didn't correctly support the fact that you can pass a string
as well as a sequence of strings.
2016-05-12 14:45:23 -07:00