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)
| 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 |
nothing calls this directly
no test coverage detected