MCPcopy Index your code
hub / github.com/jimmysong/programmingbitcoin / __repr__

Method __repr__

code-ch08/script.py:41–52  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

39 self.cmds = cmds
40
41 def __repr__(self):
42 result = []
43 for cmd in self.cmds:
44 if type(cmd) == int:
45 if OP_CODE_NAMES.get(cmd):
46 name = OP_CODE_NAMES.get(cmd)
47 else:
48 name = 'OP_[{}]'.format(cmd)
49 result.append(name)
50 else:
51 result.append(cmd.hex())
52 return ' '.join(result)
53
54 def __add__(self, other):
55 return Script(self.cmds + other.cmds)

Callers

nothing calls this directly

Calls 1

hexMethod · 0.45

Tested by

no test coverage detected