Commit Graph

608 Commits

Author SHA1 Message Date
Dakkaron
a393897c9a Added JSONEncoder and JSONDecoder to stdlib/2.7/json.pyi (#332) 2016-07-04 18:24:23 -07:00
Eklavya Sharma
df1a655858 email.header: Make decode_header also accept str. (#333)
decode_header accepts a parameter of type str or Header, but the
stub for decode_header types the parameter as Header.  Change
that to Union[Header, str].
2016-07-04 18:11:49 -07:00
Eklavya Sharma
a424eeb1f8 Fix some stubs in urllib.parse (#334)
* urllib.parse: Make return type of unquote_from_bytes str.

* urllib.parse: Reject encoding when quote is passed bytes.

encoding and errors must not be supplied to quote_plus and
quote if the first parameter is a bytes, or a TypeError is raised.
So overload quote and do not put encoding and errors in the
version where bytes is the first parameter.

quote and quote_plus also allow string and safe to be of different
types.  Also allow that in the stubs.
2016-07-04 13:53:46 -07:00
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
David Fisher
c5dcfe96d2 Add exec to Python 2 builtins (#328) 2016-07-01 19:04:12 -07:00
garetht
4fee66c90b Make the 'symmetric' argument to SQLAlchemy's between optional. (#327) 2016-07-01 16:04:36 -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
Drew Haven
b5978b18b6 Add tarfile.open (#324) 2016-06-30 17:36:58 -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
Matthias Kramm
c5d67e155f Merge pull request #322 from amitsaha/stringio_len
stdlib: StringIO - Add len attribute issue #316
2016-06-30 05:52:17 -07:00
Amit Saha
2e555c81b8 stdlib: StringIO - Add len attribute issue #316 2016-06-30 18:52:32 +10: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
Amandine Lee
03326014a5 Use unicode rather than str for os env functions (#312) 2016-06-24 11:18:24 -07:00
Russ Allbery
9f3d84551d Add stub for statvfs and type for fstatvfs (2.7) (#311)
Use the same approach as for resource: define a private NamedTuple
to represent the return value that can be addressed by name or by
sequence.
2016-06-23 17:39:06 -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
Russ Allbery
6e3514ccd0 Fix names of several stat constants (2.7) (#309)
Several of the constants were mistakenly stubbed with names
starting with ST_ instead of S_.  Fix them to match the module
documentation.
2016-06-23 14:42:05 -07:00
Philip House
d2db605008 fixes #131 (#308) 2016-06-21 08:16:24 -07:00
Herbert Ho
186b313f35 a few more stubs for sqlalchemy (#301) 2016-06-20 10:27:39 -07:00
Matthias Kramm
8ff5d7b7e2 Merge pull request #306 from haakenlid/master
add stub for stdlib abc.ABC in python 3.4+ (issue #304)
2016-06-20 09:25:11 -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
Matthias Kramm
37bc4987be Merge pull request #299 from alvarocaceres/csv
csv module: make reader() and writer() return types private and non-abstract
2016-06-15 15:01:28 -07:00
Matthias Kramm
af057ecb7b Merge pull request #298 from alvarocaceres/attributes
Use "..." for attribute values, instead of None, [], {}
2016-06-15 14:02:01 -07:00
Alvaro Caceres
122da1ca3f Add Any for collections.pyi 2016-06-15 15:57:55 -05:00
Alvaro Caceres
84c76f8188 csv module: make reader() and writer() return types private and non-abstract 2016-06-15 14:12:06 -05: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
Skip Montanaro
8b0ff828a6 First cut at stubs for pymssql. 2016-06-11 13:21:23 -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
Guido van Rossum
0b19fb471c Revert "add types to ssl for py2 (#251)"
This reverts commit 4039a1a686.

Reason: several constants (e.g. SSL_ERROR_EOF, SSL_ERROR_SSL, SSL_ERROR_WANT_READ and a few others) are missing.
2016-06-10 17:26:36 -07:00
Mickaël S
4f1eb9a63c Fix argument type for configparser.write (#284) 2016-06-10 19:49:37 +01:00
Herbert Ho
e46d308ab4 fleshing out some more stubs for sqlalchemy (#282) 2016-06-09 17:58:19 -07:00
Dakkaron
59d64f4e2b re methods' pattern-parameters don't affect the return value anymore (#281)
Note that this is a 2.7-only change (in Python 3, the pattern type must match the other parameter and the result).
2016-06-09 09:54:59 -07: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
4039a1a686 add types to ssl for py2 (#251) 2016-06-06 08:42:43 -07:00
Valérian Rousset
4c42061c95 add types to socketserver for py2 (#250) 2016-06-06 08:37:17 -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
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