Skip to content

Commit 76e1a6f

Browse files
committed
cchore: forgor git add
1 parent 941dea1 commit 76e1a6f

File tree

5 files changed

+777
-0
lines changed

5 files changed

+777
-0
lines changed

oneliner.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from os import makedirs
2+
from pathlib import Path
3+
from libcst import parse_module
4+
5+
from transformers import StatementTransformer
6+
7+
8+
target = "nextcord_submodule/nextcord"
9+
write = "nextcord_test"
10+
11+
12+
def parse_file(path: Path) -> None:
13+
print(path)
14+
cst = parse_module(path.read_text())
15+
cst = cst.visit(StatementTransformer())
16+
17+
path = Path(str(path).replace(target, write))
18+
makedirs(Path(*path.parts[:-1]), exist_ok=True)
19+
with open(path, "w") as f:
20+
f.write(cst.code)
21+
22+
23+
def parse_directory(directory: Path) -> None:
24+
for file in directory.glob("**/*.py"):
25+
parse_file(file)
26+
27+
28+
def main() -> None:
29+
parse_directory(Path(target))
30+
31+
32+
if __name__ == "__main__":
33+
main()

0 commit comments

Comments
 (0)