File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -52,25 +52,25 @@ def visit_ClassDef(self, node):
5252 self .visit (child )
5353
5454
55- with tempfile .NamedTemporaryFile ("wt" , delete = False ) as f :
56- for path in mpl .glob ("**/*.py" ):
57- v = Visitor (path , f )
58- tree = ast .parse (path .read_text ())
55+ with tempfile .TemporaryDirectory () as d :
56+ p = pathlib .Path (d ) / "allowlist.txt"
57+ with p .open ("wt" ) as f :
58+ for path in mpl .glob ("**/*.py" ):
59+ v = Visitor (path , f )
60+ tree = ast .parse (path .read_text ())
5961
60- # Assign parents to tree so they can be backtraced
61- for node in ast .walk (tree ):
62- for child in ast .iter_child_nodes (node ):
63- child .parent = node
62+ # Assign parents to tree so they can be backtraced
63+ for node in ast .walk (tree ):
64+ for child in ast .iter_child_nodes (node ):
65+ child .parent = node
6466
65- v .visit (tree )
66- f .flush ()
67- f .close ()
67+ v .visit (tree )
6868 proc = subprocess .run (
6969 [
7070 "stubtest" ,
7171 "--mypy-config-file=pyproject.toml" ,
7272 "--allowlist=ci/mypy-stubtest-allowlist.txt" ,
73- f"--allowlist={ f . name } " ,
73+ f"--allowlist={ p } " ,
7474 "matplotlib" ,
7575 ],
7676 cwd = root ,
You can’t perform that action at this time.
0 commit comments