Commit Graph

1150 Commits

Author SHA1 Message Date
Utkarsh Gupta 8e7c32846f request.pyi: Change Union[] -> Any for attributing status. (#3045)
Fixes #3026
2019-06-13 12:01:13 +02:00
John Freeman e4a9cd580c Add missing path-like annotation (#3053)
Fixes #3052
2019-06-12 20:03:14 +02:00
Walter Scott Johnson 901cb33a3c Mark asyncio loop parameters as Optional (#3047) 2019-06-10 20:58:31 +02:00
Rebecca Chen 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
nabnut 87f96dc1f0 Add stub for queue.SimpleQueue in 3.7 (#2995)
Closes: #2994
2019-06-07 11:50:39 +02:00
J Rob Gant 40c4e4ff3d Annotate HTMLParser attribute optional value (#3034)
Closes #3031
2019-06-05 18:51:52 +02:00
Radu Matei Lăcraru a7785151aa Make AsyncGeneratorType.aclose() properly return Awaitable[None] (#3032) 2019-06-05 11:20:23 +02:00
Rebecca Chen f8093d63cd Move stdlib/3/curses to stdlib/2and3/curses. (#3025)
Also add the A_ITALIC constant, which is new in 3.7.
2019-06-01 10:51:07 +02:00
Viktor Roytman 07d4938251 Add missing methods to ItemsView and KeysView, including isdisjoint (#2997) 2019-05-20 02:12:22 +02:00
Saul Shanabrook 38a7f14658 Bound arguments are ordered (#2998)
The `arguments` attribute of the `BoundArguments` is specified as an "ordered, mutable mapping (collections.OrderedDict)"
not just a mutable mapping: https://docs.python.org/3/library/inspect.html#inspect.BoundArguments.arguments
2019-05-18 22:00:05 +02:00
Dominic 5b63540b4b Add sys.breakpointhook() and sys.__breakpointhook__ (#2991)
Closes #2979
2019-05-16 11:58:54 +02:00
Chad Dombrova 840631657f Add undocumented member glob.has_magic (#2972) 2019-05-16 11:28:49 +02:00
Mark Mendoza 2cf4af784c Convert typing.ContextManager.exit to use dunder parameter names (#2980) 2019-05-15 13:30:20 -07:00
Jennifer Taylor 36b28e5b97 Split unittest stubs and add a few field (#2973) 2019-05-08 17:46:45 +02:00
Mark Vismonte a193aacea8 Add py3.7 support to Future.add_done_callback (#2970) 2019-05-07 13:14:03 -04:00
Anirudh Padmarao 53d4610579 Add stub for asyncio.BaseEventLoop (#2960) 2019-05-07 12:08:33 -04:00
Mark Vismonte 8451cd7819 Add annotation for Future._callbacks (#2965) 2019-05-07 18:02:41 +02:00
Jelle Zijlstra b5493e8639 add types.FunctionType.__init__ (#2968)
Fixes #2930
2019-05-07 17:31:01 +02:00
Mark Vismonte e4a81132c4 Fix Future.__init__'s loop variable annotation (#2961) 2019-05-06 22:02:56 -04:00
Mark Vismonte fe06e8e3c5 Add annotation to Future._loop (#2959) 2019-05-06 22:00:40 -04:00
berdario e45f443d85 Define functools.partial as overloaded function instead of its own class (#2878) 2019-05-06 12:05:02 -04:00
The Fox in the Shell e7d7a44411 Make the signature of ConfigParser.get() polymorphic (#2406)
The documentation [explicitly specifies](https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get) that `None` is a legitimate `fallback` value.

Thanks to @wiml for suggesting this approach.
2019-05-06 12:00:52 -04:00
Jan Szopinski bf2d51742b unittest: Add overloads to assert(Not)AlmostEqual(s) (#2901) 2019-05-05 15:15:17 -04:00
Ethan Madden 12fa5c4fdb Added defs for undocumented attrs on enums (#2941)
This should resolve #2934
2019-05-05 15:07:22 -04:00
Michael A. Smith 54069f4341 Annotate copy for MappingProxyType (#2955) 2019-05-05 14:10:59 -04:00
Jia Chen ec16e435eb Use dunder parameter name in Container.__contains__ (#2953)
According to Ivan, PEP 544 intentionally did not specify whether method conformance check in protocol inference should look at parameter names. For example, it's up to the type checker to decide whether a class with method defined as `def foo(self, x: int)` would implement a protocol with method `def foo(self, y: int)`.
Mypy decided to ignore parameter names altogether, but we Pyre team decided to be more strict and refuse to match different parameter names (as it is unsound to do so when those methods are invoked with named parameters). Since we rely on the typeshed stubs, we want to make sure at least the important stubs on typeshed conform to our standard. 
This PR changes `Container.__contains__` to use dunder (i.e. positional-only) parameter name specified in PEP484. This change should not affect mypy since it ignores parameter names, but will make Pyre happy as it eliminate the naming requirement for all classes that want to conform to the `Container` protocol.
2019-05-04 22:00:47 -04:00
Jelle Zijlstra 8bd744a38f fix type of msg argument to HTTPRedirectHandler.redirect_request (#2949)
It's not really documented (https://docs.python.org/3/library/urllib.request.html#urllib.request.HTTPRedirectHandler.redirect_request), but logically a message is a str, and reading the code for the stdlib confirms that it's intended to be a str.
2019-05-03 20:44:56 +02:00
Utkarsh Gupta 6d8e610d75 itertools.pyi: Replace Iterable with Iterator. (#2943)
Fixes #2931
2019-04-30 14:53:59 -07:00
Sushain Cherivirala 67b42aff6b Add initializer for http.cookiejar.Cookie (#2932) 2019-04-29 10:34:28 +02:00
Stephen Thorne 97240083c4 Correct the type signature of assertRaisesRegexp (#2926)
assertRaisesRegexp is the old name of assertRaisesRegex, they are the
same, just that the old one is deprecated.
2019-04-18 20:31:00 -07:00
Yegor Roganov 4cd9a8ef91 Make loop optional in asyncio.Queue (#2923)
Default value is `None`, so `loop` should be optional.
2019-04-14 12:43:33 -07:00
Philipp Schrader d9c5422ebf Add stub for multiprocessing.Value.get_lock() (#2920)
I also noticed that the "lock" parameter for Value's __init__ was
incomplete. The parameter also accepts lock objects directly.

https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.Value

Fixes #2917
2019-04-13 11:35:52 -07:00
Michael Lee efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
秋葉 b3c76aab49 KeysView and ItemsView should accecpt Iterable argument in set operation (#2906) 2019-04-12 23:05:58 -07:00
Michael J. Sullivan 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 bd10d8aad4 Add @typing.type_check_only (#2679)
Cf. python/typing#597
2019-04-12 15:32:22 -07:00
Masashi SHIBATA c85fed8d98 Fix TextTestResult and TextTestRunner in unittest (#2910)
Co-Authored-By: c-bata <c-bata@users.noreply.github.com>
2019-04-12 12:50:12 +02:00
Sergey Machulskis bec2fef7fa threading.Lock issue when using it with ExitStack (#2908)
* Make threading primitives ContextManagers
* Make catch_warnings ContextManager
* Make SMTP ContextManager
* Fix type of exc_type for SMTP
2019-04-11 21:39:17 +02:00
Michael J. Sullivan 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
Rebecca Chen 50a661afed Complete the stub for _thread.pyi. (#2900)
Definitions based on https://docs.python.org/3/library/_thread.html.
2019-04-09 20:02:04 +02:00
Rune Tynan cb7de8adfa Fix typo in FrameType 3.7 attributes (#2899) 2019-04-03 22:52:34 +01:00
Rebecca Chen 9b9ff64fc5 tempfile.mkdtemp() should return a str when passed no arguments. (#2893)
Otherwise, pytype expands `AnyStr` to `Union[str, bytes]`, leading
to spurious type errors later on.

* Mark the `dir` argument to mkdtemp as AnyStr.
2019-03-29 23:11:42 +01:00
William Ayd bce70d1ca6 Added excepthandler to ast stubfiles (#2891) 2019-03-28 08:23:56 -07:00
Michael J. Sullivan cc596aefbc Add a type: ignore as a hacky workaround for some mypy bazel issues (#2887) 2019-03-27 15:10:47 -07:00
Chen Li 094974c3f5 [re] Add attribute '_pattern_type' to re. (#2877)
This is only available before python 3.7 based on:
https://github.com/python/cpython/blob/3.6/Lib/re.py#L283
https://github.com/python/cpython/blob/3.7/Lib/re.py
2019-03-20 01:20:24 +01:00
Rebecca Chen 03878d732a Add attribute queue.Queue.queue. (#2870) 2019-03-16 22:11:48 +01:00
Rebecca Chen 7b6bb60fe2 Remove an unused import from stdlib/3/importlib/__init__.pyi. (#2866)
pytype has trouble resolving unused imports, since it looks at usage
to distinguish submodules from other imports.
2019-03-14 19:51:19 +01:00
Guido van Rossum 6b6d8c82ac Support new ast features and node types introduced in Python 3.8 (#2859)
Had to adjust the return type of ast.parse() from Module to AST, which
is more truthful anyways.
2019-03-12 16:34:56 +01:00
Vasily Zakharov 34cc5545fe email.mime.application.MIMEApplication expects data to be bytes, while it should be Union[str, bytes] (#2855)
Fixes #2831
2019-03-11 20:42:55 +01:00
Vasily Zakharov 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