def beautify(self, s, opts = None ):

        if opts != None:
            self.opts = opts

        if self.opts.brace_style not in ['expand', 'collapse', 'end-expand']:
            raise(Exception('opts.brace_style must be "expand", "collapse" or "end-expand".'))

        self.blank_state()

        while s and s[0] in [' ', '\t']:
            self.preindent_string += s[0]
            s = s[1:]

        self.input = self.unpack(s, self.opts.eval_code)

        self.parser_pos = 0
        handlers = {
            'TK_START_EXPR': self.handle_start_expr,
            'TK_END_EXPR': self.handle_end_expr,
            'TK_START_BLOCK': self.handle_start_block,
            'TK_END_BLOCK': self.handle_end_block,
            'TK_WORD': self.handle_word,
            'TK_SEMICOLON': self.handle_semicolon,
            'TK_STRING': self.handle_string,
            'TK_EQUALS': self.handle_equals,
            'TK_OPERATOR': self.handle_operator,
            'TK_COMMA': self.handle_comma,
            'TK_BLOCK_COMMENT': self.handle_block_comment,
            'TK_INLINE_COMMENT': self.handle_inline_comment,
            'TK_COMMENT': self.handle_comment,
            'TK_DOT': self.handle_dot,
            'TK_UNKNOWN': self.handle_unknown,
        }

        while True:
            self.token_text, token_type = self.get_next_token()

            #print (token_text, token_type, self.flags.mode)
            if token_type == 'TK_EOF':
                break

            keep_whitespace = self.opts.keep_array_indentation and self.is_array(self.flags.mode)
            self.input_wanted_newline = self.n_newlines > 0

            if keep_whitespace:
                 for i in range(self.n_newlines):
                        self.append_newline(i > 0)
            else: # not keep_whitespace
                if self.opts.max_preserve_newlines != 0 and self.n_newlines > self.opts.max_preserve_newlines:
                    self.n_newlines = self.opts.max_preserve_newlines

                if self.opts.preserve_newlines and self.n_newlines > 1:

                    for i in range(self.n_newlines):
                        self.append_newline(i != 0)

            handlers[token_type](self.token_text)

            # The cleanest handling of inline comments is to treat them as though they aren't there.
            # Just continue formatting and the behavior should be logical.
            if token_type != 'TK_INLINE_COMMENT' and token_type != 'TK_COMMENT' and token_type != 'TK_BLOCK_COMMENT' and token_type != 'TK_UNKNOWN':
                self.last_last_text = self.flags.last_text
                self.last_type = token_type
                self.flags.last_text = self.token_text
            self.flags.had_comment = token_type in ['TK_COMMENT', 'TK_INLINE_COMMENT', 'TK_BLOCK_COMMENT']

        sweet_code = ''.join(self.output_lines[0].text)
        if 1 > len(self.output_lines):
            for line_index in range(1, len(self.output_lines)):
                sweet_code += '\n' + ''.join(self.output_lines[line_index].text);

        sweet_code = re.sub('[\n ]+$', '', sweet_code)
        return sweet_code
dataset/ETHPy150Open Masood-M/yalih/jsbeautifier/build/lib.linux-i686-2.7/jsbeautifier/__init__.py/Beautifier.beautify/swapped operands of `>`