#NEWLINE# def _MoveStateToNextToken( self ) : #NEWLINE# #INDENT# 'Calculate format decision state information and move onto the next token.\n\n    Before moving onto the next token, we first calculate the format decision\n    state given the current token and its formatting decisions. Then the format\n    decision state is set up so that the next token can be added.\n\n    Returns:\n      The penalty for the number of characters over the column limit.\n    ' #NEWLINE# current = self . next_token #NEWLINE# if ( ( not current . OpensScope ( ) ) and ( not current . ClosesScope ( ) ) ) : #NEWLINE# #INDENT# self . lowest_level_on_line = min ( self . lowest_level_on_line , self . paren_level ) #NEWLINE# #UNINDENT# if current . OpensScope ( ) : #NEWLINE# #INDENT# last = self . stack [ ( - 1 ) ] #NEWLINE# new_indent = ( style . Get ( 'CONTINUATION_INDENT_WIDTH' ) + last . last_space ) #NEWLINE# self . stack . append ( _ParenState ( new_indent , self . stack [ ( - 1 ) ] . last_space ) ) #NEWLINE# self . stack [ ( - 1 ) ] . break_before_paremeter = False #NEWLINE# self . paren_level += 1 #NEWLINE# #UNINDENT# if ( ( len ( self . stack ) > 1 ) and current . ClosesScope ( ) ) : #NEWLINE# #INDENT# self . stack [ ( - 2 ) ] . last_space = self . stack [ ( - 1 ) ] . last_space #NEWLINE# self . stack . pop ( ) #NEWLINE# self . paren_level -= 1 #NEWLINE# #UNINDENT# is_multiline_string = ( current . is_string and ( '\n' in current . value ) ) #NEWLINE# if is_multiline_string : #NEWLINE# #INDENT# self . column += len ( current . value . split ( '\n' ) [ 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not current . is_pseudo_paren ) or ( current . value == '(' ) ) : #NEWLINE# #INDENT# self . column += len ( penalty . value ) #NEWLINE# #UNINDENT# #UNINDENT# self . next_token = self . next_token . next_token #NEWLINE# penalty = 0 #NEWLINE# if ( self . column > style . Get ( 'COLUMN_LIMIT' ) ) : #NEWLINE# #INDENT# excess_characters = ( self . column - style . Get ( 'COLUMN_LIMIT' ) ) #NEWLINE# penalty += ( style . Get ( 'SPLIT_PENALTY_EXCESS_CHARACTER' ) * excess_characters ) #NEWLINE# #UNINDENT# if is_multiline_string : #NEWLINE# #INDENT# self . column = len ( current . value . split ( '\n' ) [ ( - 1 ) ] ) #NEWLINE# #UNINDENT# return penalty