File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -252,3 +252,14 @@ repos:
252
252
/(__init__\.py)|(api\.py)|(_version\.py)|(testing\.py)|(conftest\.py)$
253
253
|/tests/
254
254
|/_testing/
255
+ - id : autotyping
256
+ name : autotyping
257
+ entry : python -m scripts.run_autotyping
258
+ types_or : [python, pyi]
259
+ files : ^pandas
260
+ exclude : ^(pandas/tests|pandas/_version.py|pandas/io/clipboard)
261
+ language : python
262
+ additional_dependencies :
263
+ - autotyping==22.9.0
264
+ - black==22.6.0
265
+ - libcst==0.4.7
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