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

Method __iter__

test/functional/test_framework/script.py:536–554  ·  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

534 yield (opcode, data, sop_idx)
535
536 def __iter__(self):
537 """'Cooked' iteration
538
539 Returns either a CScriptOP instance, an integer, or bytes, as
540 appropriate.
541
542 See raw_iter() if you need to distinguish the different possible
543 PUSHDATA encodings.
544 """
545 for (opcode, data, sop_idx) in self.raw_iter():
546 if data is not None:
547 yield data
548 else:
549 opcode = CScriptOp(opcode)
550
551 if opcode.is_small_int():
552 yield opcode.decode_op_n()
553 else:
554 yield CScriptOp(opcode)
555
556 def __repr__(self):
557 def _repr(o):

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