Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_mode(self, mode):
prev = BeautifierFlags('BLOCK')
if self.flags:
self.flag_store.append(self.flags)
prev = self.flags
self.flags = BeautifierFlags(mode)
if len(self.flag_store) == 1:
self.flags.indentation_level = 0
else:
self.flags.indentation_level = prev.indentation_level
if prev.var_line and prev.var_line_reindented:
self.flags.indentation_level = self.flags.indentation_level + 1
self.flags.previous_mode = prev.mode
def set_mode(self, mode):
prev = BeautifierFlags('BLOCK')
if self.flags:
self.flag_store.append(self.flags)
prev = self.flags
self.flags = BeautifierFlags(mode)
if len(self.flag_store) == 1:
self.flags.indentation_level = 0
else:
self.flags.indentation_level = prev.indentation_level
if prev.var_line and prev.var_line_reindented:
self.flags.indentation_level = self.flags.indentation_level + 1
self.flags.previous_mode = prev.mode
def blank_state(self):
# internal flags
self.flags = BeautifierFlags('BLOCK')
self.flag_store = []
self.wanted_newline = False
self.just_added_newline = False
self.do_block_just_closed = False
if self.opts.indent_with_tabs:
self.indent_string = "\t"
else:
self.indent_string = self.opts.indent_char * self.opts.indent_size
self.preindent_string = ''
self.last_word = '' # last TK_WORD seen
self.last_type = 'TK_START_EXPR' # last token type
self.last_text = '' # last token text
self.last_last_text = '' # pre-last token text