MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

deps/inspector_protocol/convert_protocol_to_json.py:20–37  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

18
19
20def main(argv):
21 parser = argparse.ArgumentParser(description=(
22 "Converts from .pdl to .json by invoking the pdl Python module."))
23 parser.add_argument('--map_binary_to_string', type=bool,
24 help=('If set, binary in the .pdl is mapped to a '
25 'string in .json. Client code will have to '
26 'base64 decode the string to get the payload.'))
27 parser.add_argument("pdl_file", help="The .pdl input file to parse.")
28 parser.add_argument("json_file", help="The .json output file write.")
29 args = parser.parse_args(argv)
30 file_name = os.path.normpath(args.pdl_file)
31 input_file = open(file_name, "r")
32 pdl_string = input_file.read()
33 protocol = pdl.loads(pdl_string, file_name, args.map_binary_to_string)
34 input_file.close()
35 output_file = open_to_write(os.path.normpath(args.json_file))
36 json.dump(protocol, output_file, indent=4, separators=(',', ': '))
37 output_file.close()
38
39
40if __name__ == '__main__':

Callers 1

Calls 7

open_to_writeFunction · 0.70
closeMethod · 0.65
openFunction · 0.50
add_argumentMethod · 0.45
parse_argsMethod · 0.45
readMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…