class_docstr: Generate a list of all Python packages found within a directory
class_docstr_tok: ["Generate","a","list","of","all","Python","packages","found","within","a","directory"]
docstr: All the packages found in 'where' that pass the 'include' filter, but
  not the 'exclude' filter.
docstr_tok: ["All","the","packages","found","in","'where","'","that","pass","the","'include","'","filter",",","but","not","the","'exclude","'","filter","."]
code: 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)
  
imports: import os
  import sys
  import functools
  import distutils.core
  import distutils.filelist
  import re
  from distutils.errors import DistutilsOptionError
  from distutils.util import convert_path
  from fnmatch import fnmatchcase
  from ._deprecation_warning import SetuptoolsDeprecationWarning
  from setuptools.extern.six import PY3, string_types
  from setuptools.extern.six.moves import filter, map
  import setuptools.version
  from setuptools.extension import Extension
  from setuptools.dist import Distribution, Feature
  from setuptools.depends import Require
  from .None import monkey
label_desc: Use image node_id 2 for calling the PackageFinder obj's underlying member method code with example usage: obj._find_packages_iter(cls, where, exclude, include) without return types