MCPcopy
hub / github.com/danielgtaylor/python-betterproto / dump_request

Function dump_request

src/betterproto/plugin/main.py:40–48  ·  view source on GitHub ↗

For developers: Supports running plugin.py standalone so its possible to debug it. Run protoc (or generate.py) with BETTERPROTO_DUMP="yourfile.bin" to write the request to a file. Then run plugin.py from your IDE in debugging mode, and redirect stdin to the file.

(dump_file: str, request: CodeGeneratorRequest)

Source from the content-addressed store, hash-verified

38
39
40def dump_request(dump_file: str, request: CodeGeneratorRequest) -> None:
41 """
42 For developers: Supports running plugin.py standalone so its possible to debug it.
43 Run protoc (or generate.py) with BETTERPROTO_DUMP="yourfile.bin" to write the request to a file.
44 Then run plugin.py from your IDE in debugging mode, and redirect stdin to the file.
45 """
46 with open(str(dump_file), "wb") as fh:
47 sys.stderr.write(f"\033[31mWriting input from protoc to: {dump_file}\033[0m\n")
48 fh.write(request.SerializeToString())
49
50
51if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls 1

SerializeToStringMethod · 0.80

Tested by

no test coverage detected