Commit Graph
3039 Commits
Author SHA1 Message Date
秋葉andSebastian Rittau a80066952e Add missing annotation in cmath module (#2989) 2019-05-16 11:00:44 +02:00
Rebecca ChenandGitHub 78982de5be Remove all pyi files that use nested classes from the pytype blacklist. (#2993)
We finally support this!
2019-05-15 14:53:13 -07:00
Jelle ZijlstraandGitHub cd9b7158ec fix CI (#2992) 2019-05-15 14:20:08 -07:00
Mark MendozaandJelle Zijlstra 2cf4af784c Convert typing.ContextManager.exit to use dunder parameter names (#2980) 2019-05-15 13:30:20 -07:00
Ivan LevkivskyiandSebastian Rittau 50d98acc76 Remove redundant variable definitions in ast module (#2986) 2019-05-13 19:32:24 +02:00
Jukka LehtosaloandGitHub e3773ad691 Fix typos in yaml stubs (save_* -> safe_*) (#2985) 2019-05-13 11:57:34 -04:00
Simon KohlmeyerandJelle Zijlstra a868221347 Update dateutil to 2.7.5 (#2694)
This is still missing the easter and tzinfo module, but includes newer
functions like today and isoparse.
2019-05-13 07:58:43 -07:00
Jean HominalandSebastian Rittau 897148073a Add functions to six.moves.urllib.request (#2982)
parse_http_list and parse_keqv_list were added to six.moves.urllib.request
in version 1.11.
2019-05-13 10:29:34 +02:00
Rebecca ChenandGitHub aa4a84ef3f Always use fully qualified names to refer to nested classes. (#2983)
The main purpose of this change is to get the stubs into a
form that pytype will support with its next release. Since
these stubs already mostly use fully qualified names, this
will also increase consistency.
2019-05-12 15:10:48 -07:00
Danny WeinbergandSebastian Rittau b4376fc3d2 Have click.style return a str (#2981)
This previously was missing a return type and therefore defaulting to
`Any`, but it actually returns a `str`.
2019-05-11 22:20:31 +02:00
Ivan LevkivskyiandSebastian Rittau 75723e3885 Add an optional opener parameter to open() function (#2977)
Fixes #2976
2019-05-09 16:59:32 +02:00
zadamahandSebastian Rittau c03100230d Add new show_choices argument to click options (#2978) 2019-05-09 16:28:08 +02:00
Rebecca ChenandJelle Zijlstra 5799b8dfcf Unblacklist more third_party stubs from pytype parsing. (#2975) 2019-05-08 20:18:08 -07:00
Jennifer TaylorandSebastian Rittau 36b28e5b97 Split unittest stubs and add a few field (#2973) 2019-05-08 17:46:45 +02:00
Chad DombrovaandSebastian Rittau feb74cf9de Add subprocess.list2cmdline for python 2 (#2971) 2019-05-08 10:21:32 +02:00
Ivan LevkivskyiandGitHub d61635e243 Add TypedDict to typing_extensions (#2940)
Since there is a PEP for `TypedDict` (PEP 589), it is being added to `typing_extension`, see https://github.com/python/typing/pull/628. This PR essentially copies the definition from `mypy_extensions`.

Corresponding mypy PR https://github.com/python/mypy/pull/6744 can be merged independently of this PR.
2019-05-07 14:45:45 -04:00
Mark VismonteandJelle Zijlstra a193aacea8 Add py3.7 support to Future.add_done_callback (#2970) 2019-05-07 13:14:03 -04:00
Anirudh PadmaraoandJelle Zijlstra 53d4610579 Add stub for asyncio.BaseEventLoop (#2960) 2019-05-07 12:08:33 -04:00
Mark VismonteandSebastian Rittau 8451cd7819 Add annotation for Future._callbacks (#2965) 2019-05-07 18:02:41 +02:00
Jelle ZijlstraandSebastian Rittau b5493e8639 add types.FunctionType.__init__ (#2968)
Fixes #2930
2019-05-07 17:31:01 +02:00
Jelle ZijlstraandSebastian Rittau d7e9af4492 allow callables in dis() (#2969)
Fixes #2914
2019-05-07 17:21:54 +02:00
Jelle ZijlstraandGitHub bdb1de57f5 narrow signature of __contains__ for str-like classes (#2967)
Fixes #2937
2019-05-07 10:24:28 -04:00
Rebecca ChenandSebastian Rittau 4990830c8f Make pytype happy with the third_party click stubs. (#2966)
This also makes the flask stubs that depend on click parseable.

* In pytype_test, only parse files with the .pyi extension.
  (There's a README in third_party/2and3/click/.)
* Annotate with ContextManager rather than using the
  contextmanager decorator. This is shorter, removes a
  dependency, and gets rid of the slight weirdness of a
  decorator needing to be evaluated in a stub.
* Fix non-stub things.
2019-05-07 08:50:24 +02:00
Max Rydahl AndersenandJelle Zijlstra 5dda362b05 add autocomplete to click decorators (#2705) 2019-05-06 22:05:48 -04:00
Rebecca ChenandGitHub 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 VismonteandJelle Zijlstra e4a81132c4 Fix Future.__init__'s loop variable annotation (#2961) 2019-05-06 22:02:56 -04:00
Mark VismonteandJelle Zijlstra fe06e8e3c5 Add annotation to Future._loop (#2959) 2019-05-06 22:00:40 -04:00
Rebecca ChenandJelle Zijlstra 7c475a48d7 Fix typo: __builtins__ should be __builtin__. (#2963) 2019-05-06 22:00:02 -04:00
Rebecca ChenandJelle Zijlstra 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 BirchandSebastian Rittau e0b3cdd6fc Bleach stubs: fix typos, use protocol classes (#2957) 2019-05-06 19:50:29 +02:00
berdarioandJelle Zijlstra 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 ShellandJelle Zijlstra 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 CrostaandJelle Zijlstra e67961e387 add click.types.DateTime to click stubs (#2958) 2019-05-06 11:36:49 -04:00
Philipp HahnandJelle Zijlstra 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 ChenandJelle Zijlstra 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 SzopinskiandJelle Zijlstra bf2d51742b unittest: Add overloads to assert(Not)AlmostEqual(s) (#2901) 2019-05-05 15:15:17 -04:00
Ethan MaddenandJelle Zijlstra 12fa5c4fdb Added defs for undocumented attrs on enums (#2941)
This should resolve #2934
2019-05-05 15:07:22 -04:00
Michael A. SmithandJelle Zijlstra 54069f4341 Annotate copy for MappingProxyType (#2955) 2019-05-05 14:10:59 -04:00
Jia ChenandJelle Zijlstra c4b249c9a8 Use dunder parameter name in _Writer.write (#2954) 2019-05-04 22:51:39 -04:00
Jia ChenandJelle Zijlstra 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 SlendersandJelle Zijlstra 337c382196 Added termios.error (#2951) 2019-05-04 16:13:53 -04:00
Jon DufresneandJelle Zijlstra 910c71050d Update Black URL (#2950) 2019-05-04 11:42:44 -04:00
Jelle ZijlstraandSebastian Rittau 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 GuptaandJelle Zijlstra 4d61442004 click/types.pyi: Add case_sensitive wrt click 7.0 (#2948)
Fixes #2942
2019-05-03 10:44:36 -04:00
Callum RyanandSebastian Rittau 1726b31013 Change WatchedFileHandler to inherit from FileHandler (#2947) 2019-05-02 21:55:56 +02:00
Utkarsh GuptaandJelle Zijlstra df953ca385 config.pyi: Return a Thread instance (#2945)
Fixes #2938
2019-05-02 06:22:51 -04:00
Scott BeldenandSebastian Rittau 556f354e1e add BadRequestKeyError (#2944) 2019-05-02 11:45:04 +02:00
Jia ChenandSebastian Rittau cda204a151 Remove MutableMapping from requests.Session.cookies's type (#2946) 2019-05-02 10:39:42 +02:00
Utkarsh GuptaandJelle Zijlstra 6d8e610d75 itertools.pyi: Replace Iterable with Iterator. (#2943)
Fixes #2931
2019-04-30 14:53:59 -07:00
Brandt BucherandSebastian Rittau 1fddec3f90 Positional-only arguments for built-in functions. (#2921) 2019-04-30 11:22:25 +02:00