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[u'id'].lower() == u'e901') for result in results))
 for r in results:
  issue_id = r[u'id'].lower()
  if (r[u'line'] in non_docstring_string_line_numbers):
   if issue_id.startswith((u'e1', u'e501', u'w191')):
    continue
  if (r[u'line'] in all_string_line_numbers):
   if (issue_id in [u'e501']):
    continue
  if ((not aggressive) and ((r[u'line'] + 1) in all_string_line_numbers)):
   if issue_id.startswith((u'w29', u'w39')):
    continue
  if (aggressive <= 0):
   if issue_id.startswith((u'e711', u'w6')):
    continue
  if (aggressive <= 1):
   if issue_id.startswith((u'e712', u'e713')):
    continue
  if (r[u'line'] in commented_out_code_line_numbers):
   if issue_id.startswith((u'e26', u'e501')):
    continue
  if has_e901:
   if issue_id.startswith((u'e1', u'e7')):
    continue
  (yield r)

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 [ u'id' ] . lower ( ) == u'e901' ) for result in results ) ) for r in results : issue_id = r [ u'id' ] . lower ( ) if ( r [ u'line' ] in non_docstring_string_line_numbers ) : if issue_id . startswith ( ( u'e1' , u'e501' , u'w191' ) ) : continue if ( r [ u'line' ] in all_string_line_numbers ) : if ( issue_id in [ u'e501' ] ) : continue if ( ( not aggressive ) and ( ( r [ u'line' ] + 1 ) in all_string_line_numbers ) ) : if issue_id . startswith ( ( u'w29' , u'w39' ) ) : continue if ( aggressive <= 0 ) : if issue_id . startswith ( ( u'e711' , u'w6' ) ) : continue if ( aggressive <= 1 ) : if issue_id . startswith ( ( u'e712' , u'e713' ) ) : continue if ( r [ u'line' ] in commented_out_code_line_numbers ) : if issue_id . startswith ( ( u'e26' , u'e501' ) ) : continue if has_e901 : if issue_id . startswith ( ( u'e1' , u'e7' ) ) : continue ( yield r )
filters results for such ones that are unique across file changes .