MCPcopy Create free account
hub / github.com/LUX-Core/lux / __repr__

Method __repr__

test/functional/test_framework/script.py:787–814  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

785 yield CScriptOp(opcode)
786
787 def __repr__(self):
788 # For Python3 compatibility add b before strings so testcases don't
789 # need to change
790 def _repr(o):
791 if isinstance(o, bytes):
792 return b"x('%s')" % hexlify(o).decode('ascii')
793 else:
794 return repr(o)
795
796 ops = []
797 i = iter(self)
798 while True:
799 op = None
800 try:
801 op = _repr(next(i))
802 except CScriptTruncatedPushDataError as err:
803 op = '%s...<ERROR: %s>' % (_repr(err.data), err)
804 break
805 except CScriptInvalidError as err:
806 op = '<ERROR: %s>' % err
807 break
808 except StopIteration:
809 break
810 finally:
811 if op is not None:
812 ops.append(op)
813
814 return "CScript([%s])" % ', '.join(ops)
815
816 def GetSigOpCount(self, fAccurate):
817 """Get the SigOp count.

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected