def set_mode(self, mode):
    if self.flags:
        self.flag_store.append(self.flags)
        self.previous_flags = self.flags
    else:
        self.previous_flags = BeautifierFlags(mode)
    self.flags = BeautifierFlags(mode)
    self.flags.apply_base(self.previous_flags, self.just_added_newline())
    self.flags.start_line_index = len(self.output_lines)
def set_mode(self, mode):
    if self.flags:
        self.flag_store.append(self.flags)
        self.previous_flags = self.flags
    else:
        self.previous_flags = BeautifierFlags(mode)
    self.flags = BeautifierFlags(mode)
    self.flags.apply_base(self.previous_flags, self.just_added_newline())
    self.flags.start_line_index = len(self.output_lines)