MCPcopy
hub / github.com/rocky/python-uncompyle6 / remove_mid_line_ifs

Method remove_mid_line_ifs

uncompyle6/scanner.py:572–592  ·  view source on GitHub ↗

Go through passed offsets, filtering ifs located somewhere mid-line.

(self, ifs)

Source from the content-addressed store, hash-verified

570 return new_instructions
571
572 def remove_mid_line_ifs(self, ifs):
573 """
574 Go through passed offsets, filtering ifs
575 located somewhere mid-line.
576 """
577
578 # FIXME: this doesn't work for Python 3.6+
579
580 filtered = []
581 for i in ifs:
582 # For each offset, if line number of current and next op
583 # is the same
584 if self.lines[i].l_no == self.lines[i + 3].l_no:
585 # Skip last op on line if it is some sort of POP_JUMP.
586 if self.code[self.prev[self.lines[i].next]] in (
587 self.opc.PJIT,
588 self.opc.PJIF,
589 ):
590 continue
591 filtered.append(i)
592 return filtered
593
594 def resetTokenClass(self):
595 return self.setTokenClass(Token)

Callers 3

detect_control_flowMethod · 0.80
detect_control_flowMethod · 0.80
detect_control_flowMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected