Commit Graph

227 Commits

Author SHA1 Message Date
Matthias Kramm
0c75a22ffb Merge pull request #303 from sharmaeklavya2/sort-cmp
Add cmp to list.sort in python 2.7
2016-07-07 13:22:49 -07: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
Fu Yong Quah
8a23acc8ee Add stdlib/2.7/traceback._print 2016-07-07 08:41:16 -07:00
Eklavya Sharma
5962927d3d Add cmp to list.sort in python 2.7 2016-07-07 14:55:29 +05:30
Guido van Rossum
5088131e5a Correct type of formatter_class arg to ArgParse(). 2016-07-06 11:42:57 -07:00
Matthias Kramm
7bef3added Merge pull request #297 from alvarocaceres/subprocess
Fix signatures of call, check_call and check_output in subprocess
2016-07-06 10:54:01 -07:00
Dakkaron
a393897c9a Added JSONEncoder and JSONDecoder to stdlib/2.7/json.pyi (#332) 2016-07-04 18:24:23 -07:00
David Fisher
c5dcfe96d2 Add exec to Python 2 builtins (#328) 2016-07-01 19:04:12 -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
Drew Haven
b5978b18b6 Add tarfile.open (#324) 2016-06-30 17:36:58 -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
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
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
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
Alvaro Caceres
5886a5dfcd Fix signatures of call, check_call and check_output in subprocess 2016-06-15 13:34:02 -05:00
Philip House
dee5e7a1df changed format_exception to use BaseException as value (#292) 2016-06-15 09:52:04 -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
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
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
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
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
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