Commit Graph

2616 Commits

Author SHA1 Message Date
Max Rydahl Andersen
5dda362b05 add autocomplete to click decorators (#2705) 2019-05-06 22:05:48 -04:00
Rebecca Chen
a6d92eca10 Adjust indentation of TODOs in third_party/2/gflags.pyi. (#2964)
Having TODOs at a different level of indentation than
the surrounding lines trips up pytype.
2019-05-06 22:05:17 -04: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
Rebecca Chen
7c475a48d7 Fix typo: __builtins__ should be __builtin__. (#2963) 2019-05-06 22:00:02 -04:00
Rebecca Chen
1379fdcdd9 Remove some files from pytype's third_party blacklist. (#2962)
Removes files that are parseable with the most recent release.
2019-05-06 21:59:12 -04:00
Chad Birch
e0b3cdd6fc Bleach stubs: fix typos, use protocol classes (#2957) 2019-05-06 19:50:29 +02: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
Dan Crosta
e67961e387 add click.types.DateTime to click stubs (#2958) 2019-05-06 11:36:49 -04:00
Philipp Hahn
548dbbbc71 yaml.dump(..., stream) is optional (#2289)
Depending on if a "stream" or the "encoding" is given, the functions
either return None, str/unicode or bytes.
Use @overload fix distinguish those cases.

Also fix the functions using **kwds as they delegate their work to the
more generic functions: copy their signatures.

* yaml.dump(): Drop distinguishing encoding

As far as I know it's currently impossible to use "overloads with return
types depending on optional arguments" (Issue #5621). As "encoding" is
in the middle of 11 optional arguments, it would require ~ 2^6 overloads
for each of those 6 functions.

For now just return Any and wait for Issue #5621 to get fixed.
2019-05-06 10:10:11 -04:00
Rebecca Chen
5081d1e132 Switch pytype_test from a whitelist to a blacklist for third_party. (#2956)
During the PyCon sprints, I'm planning to bash the pytype pyi
parser into shape so we can handle all of third_party. As a first
step, create an explicit blacklist of everything pytype chokes on.
2019-05-05 22:02: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
c4b249c9a8 Use dunder parameter name in _Writer.write (#2954) 2019-05-04 22:51:39 -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
Jonathan Slenders
337c382196 Added termios.error (#2951) 2019-05-04 16:13:53 -04:00
Jon Dufresne
910c71050d Update Black URL (#2950) 2019-05-04 11:42:44 -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
4d61442004 click/types.pyi: Add case_sensitive wrt click 7.0 (#2948)
Fixes #2942
2019-05-03 10:44:36 -04:00
Callum Ryan
1726b31013 Change WatchedFileHandler to inherit from FileHandler (#2947) 2019-05-02 21:55:56 +02:00
Utkarsh Gupta
df953ca385 config.pyi: Return a Thread instance (#2945)
Fixes #2938
2019-05-02 06:22:51 -04:00
Scott Belden
556f354e1e add BadRequestKeyError (#2944) 2019-05-02 11:45:04 +02:00
Jia Chen
cda204a151 Remove MutableMapping from requests.Session.cookies's type (#2946) 2019-05-02 10:39:42 +02:00
Utkarsh Gupta
6d8e610d75 itertools.pyi: Replace Iterable with Iterator. (#2943)
Fixes #2931
2019-04-30 14:53:59 -07:00
Brandt Bucher
1fddec3f90 Positional-only arguments for built-in functions. (#2921) 2019-04-30 11:22:25 +02:00
Sushain Cherivirala
67b42aff6b Add initializer for http.cookiejar.Cookie (#2932) 2019-04-29 10:34:28 +02:00
Jelle Zijlstra
ff650d3275 socket: add .set_inheritable() (#2935) 2019-04-28 17:13:20 +02:00
ijl
5acc22d82a Specify default = ..., positional-only for orjson API (#2936) 2019-04-27 11:09:26 -07:00
Benjamin Peterson
4e572ae6a3 Remove format_map from Python 2 unicode. (#2933) 2019-04-24 00:42:27 +01:00
Rebecca Chen
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
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
Utkarsh Gupta
cf88c79a93 locale.format_string takes strings and numbers, too. (#2922)
Fixes #2879
2019-04-14 09:30:07 -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
Brandt Bucher
4230e6f313 Fix quit's argument and return types to match those of exit. (#2915)
Fixes #2912.
2019-04-12 16:57:26 +02: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 Lee
b87064a274 Add type hints for the turtle module (#2905) 2019-04-11 08:00:53 +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
Anthony Sottile
cfa65b831b flask.Flask.run: port can be str (#2903)
86bf9dca72/flask/app.py (L933)
2019-04-08 11:41:37 -07:00
Josh Morton
d46d36b7d7 Add six.moves types for email_mime sources. (#2902)
As a followup to the work done in #2767 and #2830, and to address a
piece of #66, most of the email_mime submodules aren't typed in six
under python2, only python3. Now they are.
2019-04-08 19:56:29 +02:00
Jelle Zijlstra
ce2b8a838c reword "What to include" (#2861) 2019-04-08 19:02:01 +02:00
Rune Tynan
cb7de8adfa Fix typo in FrameType 3.7 attributes (#2899) 2019-04-03 22:52:34 +01:00