Esempio n. 1
0
def files_by_ext(directory,
                 include_exts=None,
                 exclude_exts=None,
                 exclude_dirs=BASE_BLACKLIST):
    """return a list of files in a directory matching (or not) some
    extensions: you should either give the `include_exts` argument (and
    only files ending with one of the listed extensions will be
    considered) or the `exclude_exts` argument (and only files not
    ending by one of the listed extensions will be considered).
    Subdirectories are processed recursivly.

    :type directory: str
    :param directory: directory where files should be searched

    :type include_exts: list or tuple or None
    :param include_exts: list of file extensions to consider
    
    :type exclude_exts: list or tuple or None
    :param exclude_exts: list of file extensions to ignore

    :type exclude_dirs: list or tuple or None
    :param exclude_dirs: list of directory where we should not recurse

    :rtype: list
    :return: the list of files matching input criteria
    """
    assert not (include_exts and exclude_exts)
    warn("files_by_ext is deprecated, use shellutils.find instead",
         DeprecationWarning,
         stacklevel=2)
    if include_exts:
        return find(directory, include_exts, blacklist=exclude_dirs)
    return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)
Esempio n. 2
0
def files_by_ext(directory, include_exts=None, exclude_exts=None,
                 exclude_dirs=BASE_BLACKLIST):
    """return a list of files in a directory matching (or not) some
    extensions: you should either give the `include_exts` argument (and
    only files ending with one of the listed extensions will be
    considered) or the `exclude_exts` argument (and only files not
    ending by one of the listed extensions will be considered).
    Subdirectories are processed recursivly.

    :type directory: str
    :param directory: directory where files should be searched

    :type include_exts: list or tuple or None
    :param include_exts: list of file extensions to consider
    
    :type exclude_exts: list or tuple or None
    :param exclude_exts: list of file extensions to ignore

    :type exclude_dirs: list or tuple or None
    :param exclude_dirs: list of directory where we should not recurse

    :rtype: list
    :return: the list of files matching input criteria
    """
    assert not (include_exts and exclude_exts)
    warn("files_by_ext is deprecated, use shellutils.find instead" ,
         DeprecationWarning, stacklevel=2)
    if include_exts:
        return find(directory, include_exts, blacklist=exclude_dirs)
    return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)
Esempio n. 3
0
def exclude_files_by_ext(directory, exclude_exts, exclude_dirs=BASE_BLACKLIST):
    """return a list of files in a directory not matching some extensions

    :type directory: str
    :param directory: directory where files should be searched

    :type exclude_exts: list or tuple or None
    :param exclude_exts: list of file extensions to ignore

    :type exclude_dirs: list or tuple or None
    :param exclude_dirs: list of directory where we should not recurse

    :rtype: list
    :return: the list of files matching input criterias
    """
    warn("exclude_files_by_ext is deprecated, use shellutils.find instead" ,
         DeprecationWarning, stacklevel=2)
    return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)
Esempio n. 4
0
def exclude_files_by_ext(directory, exclude_exts, exclude_dirs=BASE_BLACKLIST):
    """return a list of files in a directory not matching some extensions

    :type directory: str
    :param directory: directory where files should be searched

    :type exclude_exts: list or tuple or None
    :param exclude_exts: list of file extensions to ignore

    :type exclude_dirs: list or tuple or None
    :param exclude_dirs: list of directory where we should not recurse

    :rtype: list
    :return: the list of files matching input criterias
    """
    warn("exclude_files_by_ext is deprecated, use shellutils.find instead",
         DeprecationWarning,
         stacklevel=2)
    return find(directory, exclude_exts, exclude=True, blacklist=exclude_dirs)