File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ repos:
268
268
|/_testing/
269
269
- id : autotyping
270
270
name : autotyping
271
- entry : python -m libcst.tool codemod autotyping.AutotypeCommand --aggressive
271
+ entry : python -m scripts.run_autotyping
272
272
types_or : [python, pyi]
273
273
files : ^pandas
274
274
exclude : ^(pandas/tests|pandas/_version.py|pandas/io/clipboard)
Original file line number Diff line number Diff line change
1
+ """
2
+ Script to run ``autotyping``, to get around the fact that
3
+ pre-commit puts ``args`` before the list of files, whereas
4
+ ``autotyping`` wants the files to come after, see
5
+ https://github.com/pandas-dev/pandas/issues/48808#issuecomment-1259711679.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import argparse
10
+ import subprocess
11
+ import sys
12
+ from typing import Sequence
13
+
14
+
15
+ def main (argv : Sequence [str ] | None = None ) -> None :
16
+ parser = argparse .ArgumentParser ()
17
+ parser .add_argument ("paths" , nargs = "*" )
18
+ args = parser .parse_args (argv )
19
+ if not args .paths :
20
+ sys .exit (0 )
21
+ output = subprocess .run (
22
+ [
23
+ "python" ,
24
+ "-m" ,
25
+ "libcst.tool" ,
26
+ "codemod" ,
27
+ "autotyping.AutotypeCommand" ,
28
+ * args .paths ,
29
+ "--aggressive" ,
30
+ ],
31
+ )
32
+ sys .exit (output .returncode )
33
+
34
+
35
+ if __name__ == "__main__" :
36
+ main ()
You can’t perform that action at this time.
0 commit comments