MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / __iter__

Method __iter__

qa/rpc-tests/test_framework/script.py:755–773  ·  view source on GitHub ↗

Cooked' iteration Returns either a CScriptOP instance, an integer, or bytes, as appropriate. See raw_iter() if you need to distinguish the different possible PUSHDATA encodings.

(self)

Source from the content-addressed store, hash-verified

753 yield (opcode, data, sop_idx)
754
755 def __iter__(self):
756 """'Cooked' iteration
757
758 Returns either a CScriptOP instance, an integer, or bytes, as
759 appropriate.
760
761 See raw_iter() if you need to distinguish the different possible
762 PUSHDATA encodings.
763 """
764 for (opcode, data, sop_idx) in self.raw_iter():
765 if data is not None:
766 yield data
767 else:
768 opcode = CScriptOp(opcode)
769
770 if opcode.is_small_int():
771 yield opcode.decode_op_n()
772 else:
773 yield CScriptOp(opcode)
774
775 def __repr__(self):
776 # For Python3 compatibility add b before strings so testcases don't

Callers

nothing calls this directly

Calls 4

raw_iterMethod · 0.95
is_small_intMethod · 0.95
decode_op_nMethod · 0.95
CScriptOpClass · 0.85

Tested by

no test coverage detected