parameters: (source, results, aggressive)
docstring: Filter out spurious reports from pycodestyle.
  
      If aggressive is True, we allow possibly unsafe fixes (E711, E712).
docstring_summary: Filter out spurious reports from pycodestyle.
docstring_tokens: Filter out spurious reports from pycodestyle .
function: def filter_results(source, results, aggressive):
      """Filter out spurious reports from pycodestyle.
  
      If aggressive is True, we allow possibly unsafe fixes (E711, E712).
  
      """
      non_docstring_string_line_numbers = multiline_string_lines(
          source, include_docstrings=False)
      all_string_line_numbers = multiline_string_lines(
          source, include_docstrings=True)
  
      commented_out_code_line_numbers = commented_out_code_lines(source)
  
      has_e901 = any(result['id'].lower() == 'e901' for result in results)
  
      for r in results:
          issue_id = r['id'].lower()
  
          if r['line'] in non_docstring_string_line_numbers:
              if issue_id.startswith(('e1', 'e501', 'w191')):
                  continue
  
          if r['line'] in all_string_line_numbers:
              if issue_id in ['e501']:
                  continue
  
          # We must offset by 1 for lines that contain the trailing contents of
          # multiline strings.
          if not aggressive and (r['line'] + 1) in all_string_line_numbers:
              # Do not modify multiline strings in non-aggressive mode. Remove
              # trailing whitespace could break doctests.
              if issue_id.startswith(('w29', 'w39')):
                  continue
  
          if aggressive <= 0:
              if issue_id.startswith(('e711', 'e72', 'w6')):
                  continue
  
          if aggressive <= 1:
              if issue_id.startswith(('e712', 'e713', 'e714', 'w5')):
                  continue
  
          if aggressive <= 2:
              if issue_id.startswith(('e704', 'w5')):
                  continue
  
          if r['line'] in commented_out_code_line_numbers:
              if issue_id.startswith(('e26', 'e501')):
                  continue
  
          # Do not touch indentation if there is a token error caused by
          # incomplete multi-line statement. Otherwise, we risk screwing up the
          # indentation.
          if has_e901:
              if issue_id.startswith(('e1', 'e7')):
                  continue
  
          yield r
function_tokens: def filter_results ( source , results , aggressive ) : non_docstring_string_line_numbers = multiline_string_lines ( source , include_docstrings = False ) all_string_line_numbers = multiline_string_lines ( source , include_docstrings = True ) commented_out_code_line_numbers = commented_out_code_lines ( source ) has_e901 = any ( result [ 'id' ] . lower ( ) == 'e901' for result in results ) for r in results : issue_id = r [ 'id' ] . lower ( ) if r [ 'line' ] in non_docstring_string_line_numbers : if issue_id . startswith ( ( 'e1' , 'e501' , 'w191' ) ) : continue if r [ 'line' ] in all_string_line_numbers : if issue_id in [ 'e501' ] : continue # We must offset by 1 for lines that contain the trailing contents of # multiline strings. if not aggressive and ( r [ 'line' ] + 1 ) in all_string_line_numbers : # Do not modify multiline strings in non-aggressive mode. Remove # trailing whitespace could break doctests. if issue_id . startswith ( ( 'w29' , 'w39' ) ) : continue if aggressive <= 0 : if issue_id . startswith ( ( 'e711' , 'e72' , 'w6' ) ) : continue if aggressive <= 1 : if issue_id . startswith ( ( 'e712' , 'e713' , 'e714' , 'w5' ) ) : continue if aggressive <= 2 : if issue_id . startswith ( ( 'e704' , 'w5' ) ) : continue if r [ 'line' ] in commented_out_code_line_numbers : if issue_id . startswith ( ( 'e26' , 'e501' ) ) : continue # Do not touch indentation if there is a token error caused by # incomplete multi-line statement. Otherwise, we risk screwing up the # indentation. if has_e901 : if issue_id . startswith ( ( 'e1' , 'e7' ) ) : continue yield r