From 7765b0f6b6c1d6039aea2c736272591afade58de Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Sun, 8 Jan 2023 13:11:59 +0000 Subject: [PATCH] `mypy_test.py`: Simplify `add_third_party_files()` --- tests/mypy_test.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/mypy_test.py b/tests/mypy_test.py index f82b6739bda0..d02cdb663e46 100644 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -284,20 +284,8 @@ def add_third_party_files( if distribution in seen_dists: return seen_dists.add(distribution) - - stubs_dir = Path("stubs") - dependencies = get_recursive_requirements(distribution).typeshed_pkgs - - for dependency in dependencies: - if dependency in seen_dists: - continue - seen_dists.add(dependency) - files_to_add = sorted((stubs_dir / dependency).rglob("*.pyi")) - files.extend(files_to_add) - for file in files_to_add: - log(args, file, f"included as a dependency of {distribution!r}") - - root = stubs_dir / distribution + seen_dists.update(get_recursive_requirements(distribution).typeshed_pkgs) + root = Path("stubs", distribution) for name in os.listdir(root): if name.startswith("."): continue