MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / main

Function main

tools/trim_lines.py:61–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59
60
61def main() -> int:
62 parser = argparse.ArgumentParser()
63 parser.add_argument("paths", nargs="*", default=["."], help="Files/directories to scan")
64 parser.add_argument("--line-length", type=int, default=88)
65 parser.add_argument("--check", action="store_true", help="Dry run; only show affected files")
66 args = parser.parse_args()
67
68 files = unique_e501_files(args.paths)
69 if not files:
70 print("No E501 files found. Nothing to do.")
71 return 0
72
73 print(f"Found {len(files)} file(s) with E501.")
74 for f in files:
75 print(" -", f)
76
77 if args.check:
78 return 0
79
80 for batch in chunked(files, 50):
81 run(
82 [
83 "autopep8",
84 "--in-place",
85 "--aggressive",
86 f"--max-line-length={args.line_length}",
87 "--select=E501,W291,W292,W391",
88 *batch,
89 ]
90 )
91
92 run(["ruff", "check", *batch, "--fix", "--unsafe-fixes"], check=False)
93 run(["ruff", "format", *batch], check=False)
94
95 after = len(unique_e501_files(args.paths))
96 print(f"Remaining files with E501: {after}")
97 return 0
98
99
100if __name__ == "__main__":

Callers 1

trim_lines.pyFile · 0.70

Calls 3

unique_e501_filesFunction · 0.85
chunkedFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected