(sub_folders, ignore_hidden, ignore_vcs)
Create a generator to return subfolders to search, removing the
    ones to not search from the original list, to avoid keep
    walking them
Create a generator to return subfolders to search, removing the
    ones to not search from the original list, to avoid keep
    walking them
Create a generator to return subfolders to search removing the ones to not search from the original list to avoid keep walking them
def filtered_subfolders(sub_folders, ignore_hidden, ignore_vcs):
    '''
    Create a generator to return subfolders to search, removing the
    ones to not search from the original list, to avoid keep
    walking them
    '''

    # Create a copy to iterate to avoid iteration problems
    for folder in copy(sub_folders):
        if ignore_hidden and folder.startswith('.'):
            sub_folders.remove(folder)
        elif ignore_vcs and folder in VCS_DIRS:
            sub_folders.remove(folder)
        else:
            yield folder
def filtered_subfolders ( sub_folders , ignore_hidden , ignore_vcs ) : # Create a copy to iterate to avoid iteration problems for folder in copy ( sub_folders ) : if ignore_hidden and folder . startswith ( '.' ) : sub_folders . remove ( folder ) elif ignore_vcs and folder in VCS_DIRS : sub_folders . remove ( folder ) else : yield folder