Skip to content

Commit 467c9af

Browse files
committed
Remove support for mypy_exclude_list
1 parent 7c3c9d1 commit 467c9af

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

tests/mypy_exclude_list.txt

Whitespace-only changes.

tests/mypy_test.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ def log(args, *varargs):
4545
print(*varargs)
4646

4747

48-
def match(fn, args, exclude_list):
49-
if exclude_list.match(fn):
50-
log(args, fn, "exluded by exclude list")
51-
return False
48+
def match(fn, args):
5249
if not args.filter and not args.exclude:
5350
log(args, fn, "accept by default")
5451
return True
@@ -114,12 +111,12 @@ def has_py3_stubs(dist: Path) -> bool:
114111
return len(glob(f"{dist}/*.pyi")) > 0 or len(glob(f"{dist}/[!@]*/__init__.pyi")) > 0
115112

116113

117-
def add_files(files, seen, root, name, args, exclude_list):
114+
def add_files(files, seen, root, name, args):
118115
"""Add all files in package or module represented by 'name' located in 'root'."""
119116
full = os.path.join(root, name)
120117
mod, ext = os.path.splitext(name)
121118
if ext in [".pyi", ".py"]:
122-
if match(full, args, exclude_list):
119+
if match(full, args):
123120
seen.add(mod)
124121
files.append(full)
125122
elif os.path.isfile(os.path.join(full, "__init__.pyi")) or os.path.isfile(os.path.join(full, "__init__.py")):
@@ -130,7 +127,7 @@ def add_files(files, seen, root, name, args, exclude_list):
130127
m, x = os.path.splitext(f)
131128
if x in [".pyi", ".py"]:
132129
fn = os.path.join(r, f)
133-
if match(fn, args, exclude_list):
130+
if match(fn, args):
134131
seen.add(mod)
135132
files.append(fn)
136133

@@ -239,7 +236,6 @@ def add_third_party_files(
239236
major: int,
240237
files: list[str],
241238
args,
242-
exclude_list: re.Pattern[str],
243239
configurations: list[MypyDistConf],
244240
seen_dists: set[str],
245241
) -> None:
@@ -249,7 +245,7 @@ def add_third_party_files(
249245

250246
dependencies = read_dependencies(distribution)
251247
for dependency in dependencies:
252-
add_third_party_files(dependency, major, files, args, exclude_list, configurations, seen_dists)
248+
add_third_party_files(dependency, major, files, args, configurations, seen_dists)
253249

254250
if major == 2 and os.path.isdir(os.path.join("stubs", distribution, "@python2")):
255251
root = os.path.join("stubs", distribution, "@python2")
@@ -261,12 +257,12 @@ def add_third_party_files(
261257
mod, _ = os.path.splitext(name)
262258
if mod.startswith("."):
263259
continue
264-
add_files(files, set(), root, name, args, exclude_list)
260+
add_files(files, set(), root, name, args)
265261
add_configuration(configurations, distribution)
266262

267263

268264
def test_third_party_distribution(
269-
distribution: str, major: int, minor: int, args, exclude_list: re.Pattern[str]
265+
distribution: str, major: int, minor: int, args
270266
) -> tuple[int, int]:
271267
"""Test the stubs of a third-party distribution.
272268
@@ -279,7 +275,7 @@ def test_third_party_distribution(
279275
files: list[str] = []
280276
configurations: list[MypyDistConf] = []
281277
seen_dists: set[str] = set()
282-
add_third_party_files(distribution, major, files, args, exclude_list, configurations, seen_dists)
278+
add_third_party_files(distribution, major, files, args, configurations, seen_dists)
283279

284280
if not files:
285281
print("--- no files found ---")
@@ -293,9 +289,6 @@ def test_third_party_distribution(
293289
def main():
294290
args = parser.parse_args()
295291

296-
with open(os.path.join(os.path.dirname(__file__), "mypy_exclude_list.txt")) as f:
297-
exclude_list = re.compile("(%s)$" % "|".join(re.findall(r"^\s*([^\s#]+)\s*(?:#.*)?$", f.read(), flags=re.M)))
298-
299292
versions = [(3, 10), (3, 9), (3, 8), (3, 7), (3, 6), (2, 7)]
300293
if args.python_version:
301294
versions = [v for v in versions if any(("%d.%d" % v).startswith(av) for av in args.python_version)]
@@ -316,7 +309,7 @@ def main():
316309
mod, _ = os.path.splitext(name)
317310
if mod in seen or mod.startswith("."):
318311
continue
319-
add_files(files, seen, root, name, args, exclude_list)
312+
add_files(files, seen, root, name, args)
320313
else:
321314
supported_versions = parse_versions(os.path.join("stdlib", "VERSIONS"))
322315
root = "stdlib"
@@ -325,7 +318,7 @@ def main():
325318
continue
326319
mod, _ = os.path.splitext(name)
327320
if supported_versions[mod][0] <= (major, minor) <= supported_versions[mod][1]:
328-
add_files(files, seen, root, name, args, exclude_list)
321+
add_files(files, seen, root, name, args)
329322

330323
if files:
331324
this_code = run_mypy(args, [], major, minor, files, custom_typeshed=True)
@@ -337,7 +330,7 @@ def main():
337330
if not is_supported(distribution, major):
338331
continue
339332

340-
this_code, checked = test_third_party_distribution(distribution, major, minor, args, exclude_list)
333+
this_code, checked = test_third_party_distribution(distribution, major, minor, args)
341334
code = max(code, this_code)
342335
files_checked += checked
343336

0 commit comments

Comments
 (0)