parameters: (wanted_files, unwanted_files, parent_dir)
return_statement: return excludes
docstring: Returns exclude patters to exclude unwanted files but keep wanted files.
  
    - Shortens exclude list by globbing if possible.
    - Exclude patterns are relative paths from the parent directory.
docstring_summary: Returns exclude patters to exclude unwanted files but keep wanted files.
docstring_tokens: Returns exclude patters to exclude unwanted files but keep wanted files .
function: def _ComputeExcludeFilters(wanted_files, unwanted_files, parent_dir):
    """Returns exclude patters to exclude unwanted files but keep wanted files.
  
    - Shortens exclude list by globbing if possible.
    - Exclude patterns are relative paths from the parent directory.
    """
    excludes = []
    files_to_include = set(wanted_files)
    files_to_exclude = set(unwanted_files)
    while files_to_exclude:
      unwanted_file = files_to_exclude.pop()
      target_exclude = os.path.join(
          os.path.dirname(unwanted_file), '*.java')
      found_files = set(glob.glob(target_exclude))
      valid_files = found_files & files_to_include
      if valid_files:
        excludes.append(os.path.relpath(unwanted_file, parent_dir))
      else:
        excludes.append(os.path.relpath(target_exclude, parent_dir))
        files_to_exclude -= found_files
    return excludes
function_tokens: def _ComputeExcludeFilters ( wanted_files , unwanted_files , parent_dir ) : excludes = [ ] files_to_include = set ( wanted_files ) files_to_exclude = set ( unwanted_files ) while files_to_exclude : unwanted_file = files_to_exclude . pop ( ) target_exclude = os . path . join ( os . path . dirname ( unwanted_file ) , '*.java' ) found_files = set ( glob . glob ( target_exclude ) ) valid_files = found_files & files_to_include if valid_files : excludes . append ( os . path . relpath ( unwanted_file , parent_dir ) ) else : excludes . append ( os . path . relpath ( target_exclude , parent_dir ) ) files_to_exclude -= found_files return excludes