@@ -45,10 +45,7 @@ def log(args, *varargs):
45
45
print (* varargs )
46
46
47
47
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 ):
52
49
if not args .filter and not args .exclude :
53
50
log (args , fn , "accept by default" )
54
51
return True
@@ -114,12 +111,12 @@ def has_py3_stubs(dist: Path) -> bool:
114
111
return len (glob (f"{ dist } /*.pyi" )) > 0 or len (glob (f"{ dist } /[!@]*/__init__.pyi" )) > 0
115
112
116
113
117
- def add_files (files , seen , root , name , args , exclude_list ):
114
+ def add_files (files , seen , root , name , args ):
118
115
"""Add all files in package or module represented by 'name' located in 'root'."""
119
116
full = os .path .join (root , name )
120
117
mod , ext = os .path .splitext (name )
121
118
if ext in [".pyi" , ".py" ]:
122
- if match (full , args , exclude_list ):
119
+ if match (full , args ):
123
120
seen .add (mod )
124
121
files .append (full )
125
122
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):
130
127
m , x = os .path .splitext (f )
131
128
if x in [".pyi" , ".py" ]:
132
129
fn = os .path .join (r , f )
133
- if match (fn , args , exclude_list ):
130
+ if match (fn , args ):
134
131
seen .add (mod )
135
132
files .append (fn )
136
133
@@ -239,7 +236,6 @@ def add_third_party_files(
239
236
major : int ,
240
237
files : list [str ],
241
238
args ,
242
- exclude_list : re .Pattern [str ],
243
239
configurations : list [MypyDistConf ],
244
240
seen_dists : set [str ],
245
241
) -> None :
@@ -249,7 +245,7 @@ def add_third_party_files(
249
245
250
246
dependencies = read_dependencies (distribution )
251
247
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 )
253
249
254
250
if major == 2 and os .path .isdir (os .path .join ("stubs" , distribution , "@python2" )):
255
251
root = os .path .join ("stubs" , distribution , "@python2" )
@@ -261,12 +257,12 @@ def add_third_party_files(
261
257
mod , _ = os .path .splitext (name )
262
258
if mod .startswith ("." ):
263
259
continue
264
- add_files (files , set (), root , name , args , exclude_list )
260
+ add_files (files , set (), root , name , args )
265
261
add_configuration (configurations , distribution )
266
262
267
263
268
264
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
270
266
) -> tuple [int , int ]:
271
267
"""Test the stubs of a third-party distribution.
272
268
@@ -279,7 +275,7 @@ def test_third_party_distribution(
279
275
files : list [str ] = []
280
276
configurations : list [MypyDistConf ] = []
281
277
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 )
283
279
284
280
if not files :
285
281
print ("--- no files found ---" )
@@ -293,9 +289,6 @@ def test_third_party_distribution(
293
289
def main ():
294
290
args = parser .parse_args ()
295
291
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
-
299
292
versions = [(3 , 10 ), (3 , 9 ), (3 , 8 ), (3 , 7 ), (3 , 6 ), (2 , 7 )]
300
293
if args .python_version :
301
294
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():
316
309
mod , _ = os .path .splitext (name )
317
310
if mod in seen or mod .startswith ("." ):
318
311
continue
319
- add_files (files , seen , root , name , args , exclude_list )
312
+ add_files (files , seen , root , name , args )
320
313
else :
321
314
supported_versions = parse_versions (os .path .join ("stdlib" , "VERSIONS" ))
322
315
root = "stdlib"
@@ -325,7 +318,7 @@ def main():
325
318
continue
326
319
mod , _ = os .path .splitext (name )
327
320
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 )
329
322
330
323
if files :
331
324
this_code = run_mypy (args , [], major , minor , files , custom_typeshed = True )
@@ -337,7 +330,7 @@ def main():
337
330
if not is_supported (distribution , major ):
338
331
continue
339
332
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 )
341
334
code = max (code , this_code )
342
335
files_checked += checked
343
336
0 commit comments