Rebecca Chen and Jelle Zijlstra
d64a26cf99
Add missing constructor to types.CodeType. ( #3040 )
...
I got the argument order from
https://github.com/python/cpython/blob/2bfc2dc214445550521074f428245b502d215eac/Objects/codeobject.c#L263
and the types from the attributes already in the stub.
2019-06-08 07:07:29 -07:00
Rebecca Chen and Jelle Zijlstra
e7184d6dfc
Add undocumented but used method LWPCookieJar.as_lwp_str. ( #3041 )
...
The method is defined here:
https://github.com/python/cpython/blob/e36ed475ea429f7cc80a4d65f80b44686a74b246/Lib/http/cookiejar.py#L1864
2019-06-08 07:06:14 -07:00
Paul Dagnelie and Jelle Zijlstra
d13eb937f7
Implement SupportsIndex ( #2996 )
2019-05-16 21:55:57 -07:00
Chad Dombrova and Sebastian Rittau
840631657f
Add undocumented member glob.has_magic ( #2972 )
2019-05-16 11:28:49 +02:00
Mark Mendoza and Jelle Zijlstra
2cf4af784c
Convert typing.ContextManager.exit to use dunder parameter names ( #2980 )
2019-05-15 13:30:20 -07:00
Ivan Levkivskyi and Sebastian Rittau
50d98acc76
Remove redundant variable definitions in ast module ( #2986 )
2019-05-13 19:32:24 +02:00
Ivan Levkivskyi and Sebastian Rittau
75723e3885
Add an optional opener parameter to open() function ( #2977 )
...
Fixes #2976
2019-05-09 16:59:32 +02:00
Chad Dombrova and Sebastian Rittau
feb74cf9de
Add subprocess.list2cmdline for python 2 ( #2971 )
2019-05-08 10:21:32 +02:00
Jelle Zijlstra and Sebastian Rittau
b5493e8639
add types.FunctionType.__init__ ( #2968 )
...
Fixes #2930
2019-05-07 17:31:01 +02:00
Jelle Zijlstra and GitHub
bdb1de57f5
narrow signature of __contains__ for str-like classes ( #2967 )
...
Fixes #2937
2019-05-07 10:24:28 -04:00
berdario and Jelle Zijlstra
e45f443d85
Define functools.partial as overloaded function instead of its own class ( #2878 )
2019-05-06 12:05:02 -04:00
Jan Szopinski and Jelle Zijlstra
bf2d51742b
unittest: Add overloads to assert(Not)AlmostEqual(s) ( #2901 )
2019-05-05 15:15:17 -04:00
Jia Chen and Jelle Zijlstra
c4b249c9a8
Use dunder parameter name in _Writer.write ( #2954 )
2019-05-04 22:51:39 -04:00
Brandt Bucher and Sebastian Rittau
1fddec3f90
Positional-only arguments for built-in functions. ( #2921 )
2019-04-30 11:22:25 +02:00
Benjamin Peterson and Ivan Levkivskyi
4e572ae6a3
Remove format_map from Python 2 unicode. ( #2933 )
2019-04-24 00:42:27 +01:00
Rebecca Chen and Sebastian Rittau
fd57aee5da
Make shlex.shlex convertable to a list in Python 2. ( #2927 )
...
This simply copies the relevant lines over from the Python 3 stub.
2019-04-21 09:21:00 +02:00
Michael Lee and Sebastian Rittau
efb67946f8
Use variable annotations everywhere ( #2909 )
2019-04-13 10:40:52 +02:00
Michael J. Sullivan and Jelle Zijlstra
f06f2e97bb
Make os.altsep Optional on non-win32 platforms ( #2918 )
...
Keep it str on win32 to avoid breaking win32-specific code that relies
on it.
2019-04-12 23:00:19 -07:00
Sebastian Rittau and Guido van Rossum
bd10d8aad4
Add @typing.type_check_only ( #2679 )
...
Cf. python/typing#597
2019-04-12 15:32:22 -07:00
Brandt Bucher and Sebastian Rittau
4230e6f313
Fix quit's argument and return types to match those of exit. ( #2915 )
...
Fixes #2912 .
2019-04-12 16:57:26 +02:00
Michael J. Sullivan and GitHub
0350e9fa89
Fix some issues with __round__ ( #2907 )
...
In python 3, add an overload for there being no digits argument
and make it return int.
In python 2, __round__ doesn't exist and SupportsRound doesn't exist
in the typing module. Use SupportsFloat for python 2 round().
Remove decimal's __round__ overload that takes None, since it doesn't exist
2019-04-09 11:45:10 -07:00
William Ayd and Jelle Zijlstra
bce70d1ca6
Added excepthandler to ast stubfiles ( #2891 )
2019-03-28 08:23:56 -07:00
Chen Li and Sebastian Rittau
598d0d6ae1
[builtins] Add 'AST' type to 'source' parameter for 'compile()' ( #2889 )
2019-03-27 08:29:16 +01:00
Rebecca Chen and GitHub
a1d1870779
Fix a py2 parameter type in string.Template.(safe_)substitute. ( #2888 )
...
Context: https://github.com/python/typeshed/pull/2871#issuecomment-476806895
2019-03-26 23:25:15 -07:00
Michael J. Sullivan and GitHub
c526975a1b
Add overloads for min/max that don't take default ( #2885 )
...
PR #2833 introduced more flexible handling for the type of the default
parameter, but the extra type variable caused some issues. Add another
overload for the case where there is no default param.
This is I think related to the issues we have had with `get` recently?
2019-03-25 15:38:21 -07:00
wouter bolsterlee and Sebastian Rittau
afe665690c
Add missing BaseException.__suppress_context__ attribute ( #2876 )
...
See also PEP 415: https://www.python.org/dev/peps/pep-0415/
Fixes #2875 .
2019-03-16 22:16:01 +01:00
Rebecca Chen and Sebastian Rittau
e541cdd1a6
Add unicode support to py2 string.Template. ( #2871 )
2019-03-16 22:12:36 +01:00
Rebecca Chen and Sebastian Rittau
03878d732a
Add attribute queue.Queue.queue. ( #2870 )
2019-03-16 22:11:48 +01:00
Rebecca Chen and Sebastian Rittau
8c252052f9
Move pydoc from 2/ to 2and3/. ( #2873 )
2019-03-16 09:37:24 +01:00
Sebastian Rittau and Jelle Zijlstra
26fefcc704
Use protocol for print() file argument ( #2848 )
...
Also, use object instead of Any for values list
2019-03-12 19:26:32 -07:00
Vasily Zakharov and Sebastian Rittau
e4e19d6e98
Add email.charset.SHORTEST, QP, BASE64 to the stub for Python 2 ( #2857 )
...
Also mark Python 3 constants as undocumented.
Fixes #2830
2019-03-11 20:41:19 +01:00
Vasily Zakharov and Sebastian Rittau
08555f80d1
Make vars arguments Optional, as they default to None ( #2853 )
...
Closes #2847
2019-03-11 15:12:35 +01:00
Brandt Bucher and Jelle Zijlstra
ab4c262043
Add isascii methods to str, bytes, and bytearray [Python 3.7]. ( #2834 )
2019-03-08 11:07:28 -08:00
herr kaste and Sebastian Rittau
4dcd516caa
Improve min/max ( #2833 )
...
* For min/max return Union type if default given
* For min/max mark keyword only arguments
* Also mark positional arguments
2019-03-08 19:25:34 +01:00
Michael J. Sullivan and Jelle Zijlstra
939be9a787
Make 2.7's json.load use a protocol for fp ( #2826 )
...
This matches what the 3 stub does
2019-03-05 12:14:00 -08:00
Maxim Kurnikov and Sebastian Rittau
b80b2e4b98
make IMapIterator a subclass of Iterator ( #2814 )
2019-03-05 10:15:25 +01:00
Michael J. Sullivan and GitHub
f569957bbe
Make urllib2.urlopen return a non-optional addinfourl ( #2821 )
...
This is technically wrong. The documentation states that:
"Note that None may be returned if no handler handles the request
(though the default installed global OpenerDirector uses
UnknownHandler to ensure this never happens)."
This is super marginal and making it optional causes a few dozen
errors in an internal dropbox code base.
2019-03-01 16:08:26 -08:00
Jelle Zijlstra and Sebastian Rittau
14e387b6fd
fix some minor lint errors ( #2820 )
...
Caught by a newer version of flake8
2019-03-01 12:29:23 +01:00
Ivan Levkivskyi and GitHub
3d638b0677
Revert "Fixing signature for Mapping.get's default parameter ( #2810 )" ( #2817 )
...
This reverts commit 3f83195558 .
2019-02-27 18:09:46 +00:00
Mark Mendoza and Jelle Zijlstra
3f83195558
Fixing signature for Mapping.get's default parameter ( #2810 )
2019-02-22 21:20:02 -08:00
Philipp Hahn and Sebastian Rittau
25c96400f6
Add some urllib2 annotations ( #2688 )
2019-02-18 12:04:50 +01:00
Rebecca Chen and Jelle Zijlstra
d275e73e1f
Remove pytype workaround in os/__init__.pyi. ( #2797 )
...
Pytype release 2019.02.13 fixed the bug that
necessitated this workaround.
2019-02-14 12:29:19 -08:00
Sebastian Rittau and Jelle Zijlstra
0989d9507e
Fix groupby with key=None ( #2794 )
...
Cf #2790
2019-02-13 08:45:24 -08:00
Alun Champion and Sebastian Rittau
9b545a01ab
Added Optional[] around the itertools.groupby() key attribute to allow None to pass the type ( #2790 )
...
Fixes #2788
2019-02-12 11:59:37 +01:00
Michael Brandt and Sebastian Rittau
1442cc02bf
Add stubs for HTTP Handler classes in py2/urllib2 & py3/urllib.request ( #2710 )
...
* HTTP Handler class annotations for py2/urllib2 & py3/urllib.request
Add full annotations for the following classes:
* Python 2:
* `urllib2.AbstractHTTPHandler`
* `urllib2.HTTPHandler`
* `urllib2.HTTPsHandler`
* Python 3:
* `urllib.request.AbstractHTTPHandler`
* `urllib.request.HTTPHandler`
* `urllib.request.HTTPsHandler`
This information is largely undocumented, and was obtained by directly examining
the Python source code:
* Python 2 (v2.7.15) - https://github.com/python/cpython/blob/v2.7.15/Lib/urllib2.py#L1115-L1243
* Python 3 (v3.7.1) - https://github.com/python/cpython/blob/v3.7.1/Lib/urllib/request.py#L1224-L1364
`urllib2.AbstractHTTPHandler.do_open` takes as a parameter either
`HTTPConnection` or `HTTPSConnection`--one of the classes, not an instance of
either--and constructs an object using only a few of the parameters that either
constructor could use. `HTTPConnectionProtocol` in `stdlib/2/httplib.pyi`
follows a similar patten to `HTTPConnectionProtocol` added to
`stdlib/3/http/client.pyi` in pull request #2582 to describe the type of the
`http_class` that is passed to `do_open`.
2019-02-11 11:25:02 +01:00
Łukasz Hanuszczak and Sebastian Rittau
c8c6271365
Make NamedTuple accept Text names ( #2762 )
...
Closes #2761
2019-02-09 19:06:07 +01:00
Aymeric Augustin and Sebastian Rittau
f0c5ac04b0
Support *contiguous attributes of memoryview. ( #2755 )
2019-02-09 16:05:00 +01:00
Paul Dagnelie and Sebastian Rittau
5ef6cb7f46
Add types to some cross-platform functions in the platform library ( #2781 )
2019-02-08 20:28:53 +01:00
Michael J. Sullivan and GitHub
d8faf503ec
Make SyntaxError.offset be optional (again) ( #2782 )
...
This was originally done in #2557 , but got lost in #2533 .
2019-02-08 11:09:18 -08:00
Joel Rosdahl and Sebastian Rittau
3eb66ba633
Add type annotation for collections.deque.__iadd__ ( #2774 )
...
* Add type annotation for collections.deque.__iadd__
Fixes #2771 .
2019-02-01 19:39:09 +01:00