Commit Graph

249 Commits

Author SHA1 Message Date
Guido van Rossum
37e42bfa96 ModuleType has a __file__ attribute. 2016-07-02 10:05:02 -07:00
Eklavya Sharma
15714bb0e8 Set a default value for output in CalledProcessError.__init__ (#329) 2016-07-02 07:40:09 -07:00
OrenLeaffer
998d787302 fix return type for traceback.format_exception (#326)
format_exception and format_exception_only both return lists of
strings, not strings.
2016-07-01 16:03:25 -07:00
Brett Cannon
ab08dbbf09 Add stubs for importlib.util (#325) 2016-07-01 10:32:23 -07:00
Brett Cannon
43c3406770 Add stubs for importlib.machinery (#323)
* Fix some misspelled method names that were also missing 'self'

* Initial stubs for importlib.machinery

* Use importlib.machinery.ModuleSpec everywhere
2016-06-30 17:07:49 -07:00
Brett Cannon
05e02c188f Implement stubs for importlib.abc and update types.ModuleType (#321) 2016-06-30 15:02:42 -07:00
Guido van Rossum
3a01aeb562 Fix bad syntax in two stubs. 2016-06-30 09:00:13 -07:00
tewe
c84c138194 Annotate **kwargs with dictionary value type only (#320) 2016-06-29 08:43:13 -07:00
tewe
ab4734ff7f Use actual base type (#313)
Avoids "Exception type must be derived from BaseException"
2016-06-28 18:26:54 +01:00
Brett Cannon
41b3fe2f60 Add stubs for importlib.__init__ (#314)
* Ignore VS Code

* Add stubs for importlib.__init__

Part of #189
2016-06-28 09:30:15 -07:00
Philip House
4a79dec6ba adding type-specific assertEqual cases (#315)
Adding support for type-specific equality methods (see https://docs.python.org/2.7/library/unittest.html?highlight=assertlistequals#unittest.TestCase.addTypeEqualityFunc) in the unittest stub for both 2.7/3. As requested by @gvanrossum in #308
2016-06-28 08:12:27 -07:00
Russ Allbery
0c26482488 difflib functions return Iterators, not Iterables (#310)
These functions all use yield.  It's valid to call the next method
on the return value, which is not true of Iterables.
2016-06-23 17:35:25 -07:00
Philip House
d2db605008 fixes #131 (#308) 2016-06-21 08:16:24 -07:00
Håken Lid
569b81c42a add stub for stdlib abc.ABC in python 3.4+ (issue #304) 2016-06-20 16:05:57 +02:00
Alvaro Caceres
d0ac66f5f8 Use "..." for attribute values, instead of None, [], {} 2016-06-15 14:10:04 -05:00
thomascellerier
f45c00f129 Added os.sync, os.truncate and os.fwalk for Python version >= 3.3 (#293) 2016-06-15 09:53:26 -07:00
Philip House
dee5e7a1df changed format_exception to use BaseException as value (#292) 2016-06-15 09:52:04 -07:00
Eklavya Sharma
b56ebf2b6a Make os.name str in python 3. (#296) 2016-06-14 16:30:07 -07:00
Phil Jones
f6decefd02 Fix email typing errors (#288)
* Change (Py3) email message payload type

The docstring of the Message get_payload method indicates that the
possible return types include None and bytes. Additionally the
set_payload method accepts bytes. Therefore I've changed the
PayloadType to include bytes and the get_payload return type to be an
Optional PayloadType.

* Change email (Py3) message_from_file IO types

Instead of using TextIO and BinaryIO use IO[str] and IO[bytes]
respectively to match the type returned by the open builtin. This
follows the recommendations in #283.

The error that prompts this is reproduced via:
```
from email import message_from_file

with open('email') as file_:
    email = message_from_file(file_)
```
Argument 1 to "message_from_file" has incompatible type IO[Any]; expected "TextIO"
2016-06-11 10:43:08 -07:00
Guido van Rossum
89dfe15008 Add TYPE_CHECKING = True 2016-06-10 17:27:12 -07:00
Mickaël S
4f1eb9a63c Fix argument type for configparser.write (#284) 2016-06-10 19:49:37 +01:00
Tim Abbott
6da0bcec4c Fix argument type for datetime.now. (#268)
It seems to actually take a tzinfo argument, not its subclass
timezone.
2016-06-06 15:21:11 -07:00
Valérian Rousset
c40a260b47 fix sys.exc_info return type (#246) 2016-06-06 08:52:40 -07:00
Valérian Rousset
4c42061c95 add types to socketserver for py2 (#250) 2016-06-06 08:37:17 -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
Valérian Rousset
e97638d4bd Improve http (#248) 2016-06-05 16:55:51 -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 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
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
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
Guido van Rossum
b6b8554c6b Add stub version of Type[C] (#216) 2016-05-24 16:44:13 -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