MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / __iter__

Method __iter__

bitcoin/core/script.py:612–632  ·  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

610 yield (opcode, data, sop_idx)
611
612 def __iter__(self):
613 """'Cooked' iteration
614
615 Returns either a CScriptOP instance, an integer, or bytes, as
616 appropriate.
617
618 See raw_iter() if you need to distinguish the different possible
619 PUSHDATA encodings.
620 """
621 for (opcode, data, sop_idx) in self.raw_iter():
622 if opcode == 0:
623 yield 0
624 elif data is not None:
625 yield data
626 else:
627 opcode = CScriptOp(opcode)
628
629 if opcode.is_small_int():
630 yield opcode.decode_op_n()
631 else:
632 yield CScriptOp(opcode)
633
634 def __repr__(self):
635 # 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