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.
code: def _find_iter(
      cls, where: _Path, exclude: _Filter, include: _Filter
  ) -> StrIter:
      """
      All the packages found in 'where' that pass the 'include' filter, but
      not the 'exclude' filter.
      """
      for root, dirs, files in os.walk(str(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, package
              ):
                  continue
  
              # Should this package be included?
              if include(package) and not exclude(package):
                  yield package
  
              # Early pruning if there is nothing else to be scanned
              if f"{package}*" in exclude or f"{package}.*" in exclude:
                  continue
  
              # Keep searching subdirectories, as there may be more packages
              # down there, even if the parent was excluded.
              dirs.append(dir)
  
imports: import itertools
  import os
  from fnmatch import fnmatchcase
  from glob import glob
  from pathlib import Path
  from typing import TYPE_CHECKING, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Union
  import _distutils_hack.override
  from distutils import log
  from distutils.util import convert_path
label_desc: Use image node_id 1 for calling the PackageFinder obj's underlying member method code with example usage: obj._find_iter(cls, where, exclude, include) without return types