parameters: (logical_line, tokens)
docstring: Separate inline comments by at least two spaces.
  
      An inline comment is a comment on the same line as a statement.  Inline
      comments should be separated by at least two spaces from the statement.
      They should start with a # and a single space.
  
      Okay: x = x + 1  # Increment x
      Okay: x = x + 1    # Increment x
      E261: x = x + 1 # Increment x
      E262: x = x + 1  #Increment x
      E262: x = x + 1  #  Increment x
docstring_summary: Separate inline comments by at least two spaces.
docstring_tokens: Separate inline comments by at least two spaces .
function: def whitespace_before_inline_comment(logical_line, tokens):
      """
      Separate inline comments by at least two spaces.
  
      An inline comment is a comment on the same line as a statement.  Inline
      comments should be separated by at least two spaces from the statement.
      They should start with a # and a single space.
  
      Okay: x = x + 1  # Increment x
      Okay: x = x + 1    # Increment x
      E261: x = x + 1 # Increment x
      E262: x = x + 1  #Increment x
      E262: x = x + 1  #  Increment x
      """
      prev_end = (0, 0)
      for token_type, text, start, end, line in tokens:
          if token_type == tokenize.COMMENT:
              if not line[:start[1]].strip():
                  continue
              if prev_end[0] == start[0] and start[1] < prev_end[1] + 2:
                  yield (prev_end,
                         "E261 at least two spaces before inline comment")
              symbol, sp, comment = text.partition(' ')
              if symbol not in ('#', '#:') or comment[:1].isspace():
                  yield start, "E262 inline comment should start with '# '"
          elif token_type != tokenize.NL:
              prev_end = end
function_tokens: def whitespace_before_inline_comment ( logical_line , tokens ) : prev_end = ( 0 , 0 ) for token_type , text , start , end , line in tokens : if token_type == tokenize . COMMENT : if not line [ : start [ 1 ] ] . strip ( ) : continue if prev_end [ 0 ] == start [ 0 ] and start [ 1 ] < prev_end [ 1 ] + 2 : yield ( prev_end , "E261 at least two spaces before inline comment" ) symbol , sp , comment = text . partition ( ' ' ) if symbol not in ( '#' , '#:' ) or comment [ : 1 ] . isspace ( ) : yield start , "E262 inline comment should start with '# '" elif token_type != tokenize . NL : prev_end = end