(raw_source_paths, language)
return sources, language
Given a list of files and directories, return just files.
    If we are not passed a language, determine it.
    Filter out files that are not of that language

    :param list[str] raw_source_paths: file or directory paths
    :param str|None language: Input language
    :rtype: (list, str)
Given a list of files and directories, return just files.
    If we are not passed a language, determine it.
    Filter out files that are not of that language
Given a list of files and directories return just files . If we are not passed a language determine it . Filter out files that are not of that language
def get_sources_and_language(raw_source_paths, language):
    """
    Given a list of files and directories, return just files.
    If we are not passed a language, determine it.
    Filter out files that are not of that language

    :param list[str] raw_source_paths: file or directory paths
    :param str|None language: Input language
    :rtype: (list, str)
    """

    individual_files = []
    for source in sorted(raw_source_paths):
        if os.path.isfile(source):
            individual_files.append((source, True))
            continue
        for root, _, files in os.walk(source):
            for f in files:
                individual_files.append((os.path.join(root, f), False))

    if not individual_files:
        raise AssertionError("No source files found from %r" % raw_source_paths)
    logging.info("Found %d files from sources argument.", len(individual_files))

    if not language:
        language = determine_language(individual_files)

    sources = set()
    for source, explicity_added in individual_files:
        if explicity_added or source.endswith('.' + language):
            sources.add(source)
        else:
            logging.info("Skipping %r which is not a %s file. "
                         "If this is incorrect, include it explicitly.",
                         source, language)

    if not sources:
        raise AssertionError("Could not find any source files given {raw_source_paths} "
                             "and language {language}.")

    sources = sorted(list(sources))
    logging.info("Processing %d source file(s)." % (len(sources)))
    for source in sources:
        logging.info("  " + source)

    return sources, language
def get_sources_and_language ( raw_source_paths , language ) : individual_files = [ ] for source in sorted ( raw_source_paths ) : if os . path . isfile ( source ) : individual_files . append ( ( source , True ) ) continue for root , _ , files in os . walk ( source ) : for f in files : individual_files . append ( ( os . path . join ( root , f ) , False ) ) if not individual_files : raise AssertionError ( "No source files found from %r" % raw_source_paths ) logging . info ( "Found %d files from sources argument." , len ( individual_files ) ) if not language : language = determine_language ( individual_files ) sources = set ( ) for source , explicity_added in individual_files : if explicity_added or source . endswith ( '.' + language ) : sources . add ( source ) else : logging . info ( "Skipping %r which is not a %s file. " "If this is incorrect, include it explicitly." , source , language ) if not sources : raise AssertionError ( "Could not find any source files given {raw_source_paths} " "and language {language}." ) sources = sorted ( list ( sources ) ) logging . info ( "Processing %d source file(s)." % ( len ( sources ) ) ) for source in sources : logging . info ( "  " + source ) return sources , language