@@ -125,32 +125,49 @@ are also provided to help in implementing the core ABCs.
125125
126126.. class :: Finder
127127
128- An abstract base class representing a :term: `finder `.
129- See :pep: `302 ` for the exact definition for a finder.
128+ An abstract base class representing a :term: `finder `. Finder
129+ implementations should derive from (or register with) the more specific
130+ :class: `MetaPathFinder ` or :class: `PathEntryFinder ` ABCs.
130131
131- .. method :: find_loader(self, fullname):
132+ .. method :: invalidate_caches()
132133
133- An abstract method for finding a :term: `loader ` for the specified
134- module. Returns a 2-tuple of ``(loader, portion) `` where portion is a
135- sequence of file system locations contributing to part of a namespace
136- package. The sequence may be empty. When present, `find_loader() ` is
137- preferred over `find_module() `.
134+ An optional method which, when called, should invalidate any internal
135+ cache used by the finder. Used by :func: `invalidate_caches() ` when
136+ invalidating the caches of all cached finders.
138137
139- .. versionadded: 3.3
138+ .. versionchanged :: 3.3
139+ The API signatures for meta path finders and path entry finders
140+ were separated by PEP 420. Accordingly, the Finder ABC no
141+ longer requires implementation of a ``find_module() `` method.
140142
141- .. method :: find_module(fullname, path=None)
142143
143- An abstract method for finding a :term: `loader ` for the specified
144- module. If the :term: `finder ` is found on :data: `sys.meta_path ` and the
145- module to be searched for is a subpackage or module then *path * will
146- be the value of :attr: `__path__ ` from the parent package. If a loader
147- cannot be found, ``None `` is returned.
144+ .. class :: MetaPathFinder(Finder)
148145
149- .. method :: invalidate_caches()
146+ An abstract base class representing a :term: `meta path finder `.
147+
148+ .. versionadded :: 3.3
149+
150+ .. method :: find_module(fullname, path)
151+
152+ An abstract method for finding a :term: `loader ` for the specified
153+ module. If this is a top-level import, *path * will be ``None ``.
154+ Otheriwse, this is a search for a subpackage or module and *path *
155+ will be the value of :attr: `__path__ ` from the parent
156+ package. If a loader cannot be found, ``None `` is returned.
157+
158+
159+ .. class :: PathEntryFinder(Finder)
160+
161+ An abstract base class representing a :term: `path entry finder `.
162+
163+ .. versionadded :: 3.3
164+
165+ .. method :: find_loader(self, fullname):
150166
151- An optional method which, when called, should invalidate any internal
152- cache used by the finder. Used by :func: `invalidate_caches() ` when
153- invalidating the caches of all cached finders.
167+ An abstract method for finding a :term: `loader ` for the specified
168+ module. Returns a 2-tuple of ``(loader, portion) `` where portion is a
169+ sequence of file system locations contributing to part of a namespace
170+ package. The sequence may be empty.
154171
155172
156173.. class :: Loader
@@ -569,8 +586,8 @@ find and load modules.
569586
570587 An :term: `importer ` for built-in modules. All known built-in modules are
571588 listed in :data: `sys.builtin_module_names `. This class implements the
572- :class: `importlib.abc.Finder ` and :class: ` importlib.abc.InspectLoader `
573- ABCs.
589+ :class: `importlib.abc.MetaPathFinder ` and
590+ :class: ` importlib.abc.InspectLoader ` ABCs.
574591
575592 Only class methods are defined by this class to alleviate the need for
576593 instantiation.
@@ -579,8 +596,8 @@ find and load modules.
579596.. class :: FrozenImporter
580597
581598 An :term: `importer ` for frozen modules. This class implements the
582- :class: `importlib.abc.Finder ` and :class: ` importlib.abc.InspectLoader `
583- ABCs.
599+ :class: `importlib.abc.MetaPathFinder ` and
600+ :class: ` importlib.abc.InspectLoader ` ABCs.
584601
585602 Only class methods are defined by this class to alleviate the need for
586603 instantiation.
@@ -589,7 +606,7 @@ find and load modules.
589606.. class :: PathFinder
590607
591608 :term: `Finder ` for :data: `sys.path `. This class implements the
592- :class: `importlib.abc.Finder ` ABC.
609+ :class: `importlib.abc.MetaPathFinder ` ABC.
593610
594611 This class does not perfectly mirror the semantics of :keyword: `import ` in
595612 terms of :data: `sys.path `. No implicit path hooks are assumed for
@@ -616,8 +633,8 @@ find and load modules.
616633
617634.. class :: FileFinder(path, \*loader_details)
618635
619- A concrete implementation of :class: `importlib.abc.Finder ` which caches
620- results from the file system.
636+ A concrete implementation of :class: `importlib.abc.PathEntryFinder ` which
637+ caches results from the file system.
621638
622639 The *path * argument is the directory for which the finder is in charge of
623640 searching.
0 commit comments