Commit Graph

529 Commits

Author SHA1 Message Date
Jelle Zijlstra
984307bf45 fix odd version comparisons (#988)
"> (3,)" works but looks like the code is checking for Python 4.

"<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that
way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater
than (3, 5), so a hypothetical type checker that uses the full version info would interpret
this check incorrectly.

This ensures that all version_info comparisons use <, >=, ==, or !=.
2017-03-12 20:48:48 -07:00
Jelle Zijlstra
b6eec58d2c remove checks against patch versions (#987)
Both mypy and pytype only use the major and minor version in type checking. Using
checks like "sys.version_info >= (3, 4, 4)" won't actually work properly for
people type checking their code using version 3.4, because (3, 4) >= (3, 4, 4) will
always be false (at least in mypy's approach; not sure if pytype is different).
2017-03-12 20:16:09 -07:00
Marcin Kurczewski
2dbb5f0bc3 Fix unicodedata (#983)
Fixes #982.
2017-03-12 19:38:39 -07:00
Jelle Zijlstra
47a19c761c fix typo in http.client (#985) 2017-03-12 19:33:47 -07:00
Jelle Zijlstra
555f45b876 remove "return" statements from builtins.pyi (#986)
Type checkers shouldn't care that these methods are returning the same object.
2017-03-12 19:33:29 -07:00
Jelle Zijlstra
155fdd0cd4 Fixes to tempfile stubs (#981)
Fixes #975

And a few more things I noticed while reading the tempfile docs.

    In 3.5, most functions in tempfile were changed to accept either str or bytes in their prefix and suffix arguments, and return bytes or str accordingly. This seemed like a case for AnyStr.
    We were missing tempdirb and tempprefixb, added in 3.5.
    TemporaryFile and others were declared as returning BinaryIO, but they actually return either binary or text IO depending on the mode passed in. I changed the return type to IO[Any], similar to builtins.open.
2017-03-12 19:32:46 -07:00
=^_^=
82f1104e59 Add Collection to typing.pyi (#967)
Fixes #965
2017-03-10 15:52:08 -08:00
Jelle Zijlstra
cf6c563ce1 codecs: merge 2 and 3 stubs (#960) 2017-03-10 15:50:14 -08:00
Ivan Levkivskyi
bd5b33f3b1 Fix frozenset (#979) 2017-03-10 13:59:32 -08:00
Sebastian Meßmer
85866fe1b9 Fix unittest/mock.pyi (#973)
* Fix unittest/mock.pyi

Add a lot of missing types

* Fix formatting

* Make two and from_kall bool

* Further style fixes

* style fixes
2017-03-08 06:50:28 -08:00
Dominik Miedziński
4f51a4f2fc Improve ABCMeta.register signature (#962)
* Improve ABCMeta.register signature

* Fix ABCMeta.register return type for Python 3.3+
2017-03-07 16:42:06 -08:00
Hong Minhee
aa54fc1958 Add missing attribs to urllib.response.addinfourl (#968) 2017-03-07 16:38:52 -08:00
Sebastian Meßmer
6ffaadbd67 Fix string.pyi (#971)
Add missing types for two arguments
2017-03-06 08:08:36 -08:00
Sebastian Meßmer
ba82ac08ed Fix type stubs in type.pyi (#970)
Mypy recognized the type hints as parameter names. This fixes that.
2017-03-06 08:04:51 -08:00
Michael Walter
58efa1fe55 Update json.pyi (#957)
According to https://docs.python.org/3/library/json.html#json.loads, the s parameter can be "a str, bytes or bytearray instance".
2017-02-27 17:51:41 +00:00
David Euresti
91ff50ad7a Fix AbstractDigestAuthHandler to have correct types. 2017-02-22 20:29:17 -08:00
David Euresti
70e39d9ad2 Fix and unify type of socket.getaddrinfo 2017-02-22 20:24:47 -08:00
David Euresti
da11ecf773 Add missing __init__ and isclosed to http.client.HTTPResponse 2017-02-22 20:18:15 -08:00
David Euresti
e3fb935ca4 Move opcode to 2and3 (#938)
* Move opcode to 2and3

* Fix python3 versions

* Fix tests

* Bring Dict back
2017-02-21 14:27:34 -08:00
David Euresti
1260d41cd1 Fix type of IO.writelines. (#949)
This lets you use generators to writelines
2017-02-21 14:25:00 -08:00
Andrey Vlasovskikh
295788b672 Missing special attributes of class instances inherited from object (#943)
* Missing special attributes of class instances inherited from object
* object.__reduce__ returns a tuple

It's up to its inheritors to return either a tuple or a string.
2017-02-20 11:50:14 -08:00
David Euresti
dbea48fc7a Make 2nd argument to ModuleType an optional kwarg (#941) 2017-02-20 11:10:59 -08:00
Andrey Vlasovskikh
7212f23f7b Added missing 'property' attributes 2017-02-20 11:04:27 -08:00
Andrey Vlasovskikh
43c1369901 More precise type for 'slice' constructor
start and stop arguments are required even though they can be None.
2017-02-20 11:03:30 -08:00
Richard Hansen
55d4c08a8e Use BaseException for Future.exception() and .set_exception(). (#935)
The concurrent.futures.Future class's set_exception() method might be
called with a BaseException that is not an Exception, so change
set_exception()'s parameter type from Exception to BaseException.  The
exception set via set_exception() is returned by exception(), so
change exception()'s return type from Exception to BaseException.
2017-02-15 08:19:49 -08:00
Ivan Levkivskyi
22c0353498 Add missing imports from typing (#933) 2017-02-14 10:59:00 -08:00
Jelle Zijlstra
a778704b30 add Counter, Deque, ChainMap (#928) 2017-02-11 10:52:09 -08:00
Jelle Zijlstra
e80b25d1be allow instantiating ChainMap (#929)
A previous PR led mypy to refuse to instantiate ChainMap,
because it had unimplemented abstract methods.
This PR adds the abstract methods to the stub,
which is enough to persuade mypy to allow instantiating
ChainMap.
2017-02-11 10:10:13 -08:00
5j9
3973f5851a Define __getitem__ for Match objects of Python 3.6 (#925)
In Python 3.6 __getitem__ was added as a new method for match objects.
m[g] is identical to m.group(g).
2017-02-09 15:23:52 -08:00
5j9
f192b8c784 Update count, (r)find, and (r)index type hints for bytes and bytearray (#923)
The above methods have changed in version 3.3 to also accept an integer in
the range 0 to 255 as the subsequence.

Fixes python/mypy#2831
2017-02-08 15:21:41 -08:00
Sunghyun Hwang
28f3fde09f improve HTTPStatus type definition (#920) 2017-02-07 10:39:44 -08:00
David Euresti
db84eb7844 Fix hashlib to accept multiple data types (#918) 2017-02-06 17:24:48 -08:00
David Euresti
6eca1a04da Some ssl fixes (#919)
Fix return of wrap_socket.
Add read, write, pending to SSLSocket
Fix argument to socket.setdefaulttimeout
2017-02-06 17:23:22 -08:00
Matt Kimball
31d4a4277b Added 'shutil' API changes between 3.3 and 3.5 (#915)
As of Python 3.3, copymode, copystat, copy and copy2 take an
optional argument, 'follow_symlinks'.

As of Python 3.3, copytree and move return the destination.

As of Python 3.5, move takes an optional copy function.

As of Python 3.3, disk_usage, chown, which and get_terminal_size
were added.
2017-02-06 10:18:27 -08:00
Mike Patek
c760a4e949 Make OrderedDict inherit from Reversible (#912)
Fixes #904
2017-02-01 09:23:43 -08:00
syrrim
9625cc738f Update accumulate signature to account for optional function arg (#896)
See https://docs.python.org/3/library/itertools.html#itertools.accumulate
2017-01-30 13:22:06 -08:00
Valérian Rousset
fe15d91041 merge */xml/etree into 2and3/xml/etree (#899)
Fixes #287.
2017-01-30 13:19:28 -08:00
Mike Patek
1a49669711 Add quote_via argument to urlencode (#897)
Fixes #873
2017-01-30 12:03:52 -08:00
Mike Patek
0e7b2e1acf Add 'sys.is_finalizing' function (#898)
Fixes #856
2017-01-30 10:25:39 -08:00
Andrey Vlasovskikh
92534805b5 Added missing special attributes for PY3 functions (#875) 2017-01-29 20:34:35 -08:00
Jelle Zijlstra
6e84021f56 ChainMap fixes (#878)
- It didn't exist before 3.3 (https://docs.python.org/3/library/collections.html#chainmap-objects)
- It's not a subclass of dict
2017-01-29 20:29:29 -08:00
Jelle Zijlstra
a9bb7f89d3 Fixes to subprocess.CompletedProcess (#895) 2017-01-29 20:16:49 -08:00
miedzinski
d486e2a8d5 Add typing.ClassVar (fixes #888) (#889) 2017-01-29 17:15:04 -08:00
Andrey Vlasovskikh
bb33cb0119 Added __instancecheck__ and __subclasscheck__ to type (#887) 2017-01-29 11:17:01 -08:00
Andrey Vlasovskikh
8ce64ce782 Updates to slice built-in (#891)
Makes args and attributes optional.
2017-01-29 11:16:23 -08:00
Andrey Vlasovskikh
2b25b3ef6d Argument of input() is not restricted to str (#890) 2017-01-29 10:34:32 -08:00
Andrey Vlasovskikh
c8435f4315 Added object.__sizeof__ (#865)
* Added object.__sizeof__

* Removed __sizeof__ inherited from object

* Made sqlite3 classes for Python 2 inherit from object

* Removed __sizeof__ inherited from object
2017-01-26 12:05:53 -08:00
Andrey Vlasovskikh
025f31dcc9 Added class super to builtins (#867) 2017-01-26 11:53:59 -08:00
Andrey Vlasovskikh
1d1a2e458c Added methods of typing.NamedTuple (#864) 2017-01-26 11:52:59 -08:00
Bertrand Bonnefoy-Claudet
c5ffe4f1d9 Fix returned decoder/encoder types in codecs 2017-01-23 10:32:53 -08:00