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

@@ -20,30 +20,7 @@ third_party/2and3/attr/converters.pyi
third_party/2and3/attr/filters.pyi
third_party/2and3/attr/validators.pyi
third_party/2and3/boto/utils.pyi
third_party/2and3/click/README.md
third_party/2and3/click/__init__.pyi
third_party/2and3/click/core.pyi
third_party/2and3/click/decorators.pyi
third_party/2and3/click/exceptions.pyi
third_party/2and3/click/formatting.pyi
third_party/2and3/click/globals.pyi
third_party/2and3/click/parser.pyi
third_party/2and3/click/termui.pyi
third_party/2and3/click/testing.pyi
third_party/2and3/click/types.pyi
third_party/2and3/dateutil/rrule.pyi
third_party/2and3/flask/__init__.pyi
third_party/2and3/flask/app.pyi
third_party/2and3/flask/blueprints.pyi
third_party/2and3/flask/cli.pyi
third_party/2and3/flask/ctx.pyi
third_party/2and3/flask/debughelpers.pyi
third_party/2and3/flask/globals.pyi
third_party/2and3/flask/helpers.pyi
third_party/2and3/flask/logging.pyi
third_party/2and3/flask/templating.pyi
third_party/2and3/flask/testing.pyi
third_party/2and3/flask/views.pyi
third_party/2and3/google/protobuf/any_pb2.pyi
third_party/2and3/google/protobuf/any_test_pb2.pyi
third_party/2and3/google/protobuf/api_pb2.pyi

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):