MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / parse_output

Function parse_output

test/functional/tool_utils.py:120–129  ·  view source on GitHub ↗

Parse the output according to specified format. Raise an error if the output can't be parsed.

(a, fmt)

Source from the content-addressed store, hash-verified

118
119
120def parse_output(a, fmt):
121 """Parse the output according to specified format.
122
123 Raise an error if the output can't be parsed."""
124 if fmt == 'json': # json: compare parsed data
125 return json.loads(a)
126 elif fmt == 'hex': # hex: parse and compare binary data
127 return bytes.fromhex(a.strip())
128 else:
129 raise NotImplementedError("Don't know how to compare %s" % fmt)
130
131
132if __name__ == "__main__":

Callers 1

test_oneMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_oneMethod · 0.68