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.
This commit is contained in:
Rebecca Chen
2019-05-07 02:50:24 -04:00
committed by Sebastian Rittau
parent 5dda362b05
commit 4990830c8f
7 changed files with 17 additions and 85 deletions

View File

@@ -172,7 +172,7 @@ def pytype_test(args):
for root, _, filenames in itertools.chain.from_iterable(
os.walk(p) for p in paths):
for f in sorted(filenames):
for f in sorted(f for f in filenames if f.endswith('.pyi')):
f = os.path.join(root, f)
rel = _get_relative(f)
if not skipped.search(rel):