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

Function main

scripts/update_lib/cmd_migrate.py:121–145  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

119
120
121def main(argv: list[str] | None = None) -> int:
122 parser = argparse.ArgumentParser(
123 description=__doc__,
124 formatter_class=argparse.RawDescriptionHelpFormatter,
125 )
126 parser.add_argument(
127 "path",
128 type=pathlib.Path,
129 help="Source path containing /Lib/ (file or directory)",
130 )
131
132 args = parser.parse_args(argv)
133
134 try:
135 if args.path.is_dir():
136 patch_directory(args.path)
137 else:
138 patch_file(args.path)
139 return 0
140 except ValueError as e:
141 print(f"Error: {e}", file=sys.stderr)
142 return 1
143 except FileNotFoundError as e:
144 print(f"Error: {e}", file=sys.stderr)
145 return 1
146
147
148if __name__ == "__main__":

Callers 1

cmd_migrate.pyFile · 0.70

Calls 6

parse_argsMethod · 0.95
patch_directoryFunction · 0.85
patch_fileFunction · 0.85
printFunction · 0.50
add_argumentMethod · 0.45
is_dirMethod · 0.45

Tested by

no test coverage detected