File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1515
1616import argparse
1717import json
18+ import sys
1819from typing import Any , Union
1920from typing_extensions import TypeAlias as _TypeAlias
2021
@@ -552,11 +553,18 @@ def convert_unbound_type(self: UnboundType) -> Json:
552553
553554
554555def main () -> None :
555- parser = argparse .ArgumentParser ()
556- parser .add_argument ("path" , nargs = "+" )
556+ parser = argparse .ArgumentParser (
557+ description = "Convert binary cache files to JSON. "
558+ "Create files in the same directory with extra .json extension."
559+ )
560+ parser .add_argument (
561+ "path" , nargs = "+" , help = "mypy cache data file to convert (.data.ff extension)"
562+ )
557563 args = parser .parse_args ()
558564 fnams : list [str ] = args .path
559565 for fnam in fnams :
566+ if not fnam .endswith (".data.ff" ):
567+ sys .exit (f"error: Expected .data.ff extension, but got { fnam } " )
560568 with open (fnam , "rb" ) as f :
561569 data = f .read ()
562570 json_data = convert_binary_cache_to_json (data )
You can’t perform that action at this time.
0 commit comments