(self, pos, afterpos, length, deleteable, beyond)
Update line number dictionary after deleting lines.
Update line number dictionary after deleting lines.
Update line number dictionary after deleting lines .
def update_line_dict(self, pos, afterpos, length, deleteable, beyond):
        """Update line number dictionary after deleting lines."""
        # subtract length of line we replaced
        length -= afterpos - pos
        addr = (self.code_start + 1) + afterpos
        self.bytecode.seek(afterpos + length + 1)  # pass \x00
        while True:
            next_addr = self.bytecode.read(2)
            if len(next_addr) < 2 or next_addr == b'\0\0':
                break
            next_addr, = struct.unpack('<H', next_addr)
            self.bytecode.seek(-2, 1)
            self.bytecode.write(struct.pack('<H', next_addr + length))
            self.bytecode.read(next_addr - addr - 2)
            addr = next_addr
        # update line number dict
        for key in deleteable:
            del self.line_numbers[key]
        for key in beyond:
            self.line_numbers[key] += length
def update_line_dict ( self , pos , afterpos , length , deleteable , beyond ) : # subtract length of line we replaced length -= afterpos - pos addr = ( self . code_start + 1 ) + afterpos self . bytecode . seek ( afterpos + length + 1 ) # pass \x00 while True : next_addr = self . bytecode . read ( 2 ) if len ( next_addr ) < 2 or next_addr == b'\0\0' : break next_addr , = struct . unpack ( '<H' , next_addr ) self . bytecode . seek ( - 2 , 1 ) self . bytecode . write ( struct . pack ( '<H' , next_addr + length ) ) self . bytecode . read ( next_addr - addr - 2 ) addr = next_addr # update line number dict for key in deleteable : del self . line_numbers [ key ] for key in beyond : self . line_numbers [ key ] += length