(cls, where, exclude, include)
All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
All the packages found in where that pass the include filter but not the exclude filter .
def _find_packages_iter(cls, where, exclude, include):
        """
        All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
        """
        for root, dirs, files in os.walk(where, followlinks=True):
            # Copy dirs to iterate over it, then empty dirs.
            all_dirs = dirs[:]
            dirs[:] = []

            for dir in all_dirs:
                full_path = os.path.join(root, dir)
                rel_path = os.path.relpath(full_path, where)
                package = rel_path.replace(os.path.sep, '.')

                # Skip directory trees that are not valid packages
                if ('.' in dir or not cls._looks_like_package(full_path)):
                    continue

                # Should this package be included?
                if include(package) and not exclude(package):
                    yield package

                # Keep searching subdirectories, as there may be more packages
                # down there, even if the parent was excluded.
                dirs.append(dir)
def _find_packages_iter ( cls , where , exclude , include ) : for root , dirs , files in os . walk ( where , followlinks = True ) : # Copy dirs to iterate over it, then empty dirs. all_dirs = dirs [ : ] dirs [ : ] = [ ] for dir in all_dirs : full_path = os . path . join ( root , dir ) rel_path = os . path . relpath ( full_path , where ) package = rel_path . replace ( os . path . sep , '.' ) # Skip directory trees that are not valid packages if ( '.' in dir or not cls . _looks_like_package ( full_path ) ) : continue # Should this package be included? if include ( package ) and not exclude ( package ) : yield package # Keep searching subdirectories, as there may be more packages # down there, even if the parent was excluded. dirs . append ( dir )