Commit 1b799186 authored by Brett Cannon's avatar Brett Cannon

Issue #15640: Document importlib.abc.Finder as deprecated.

The code for the class itself isn't deprecated for
backwards-compatibility reasons, but the class shouldn't be directly
inherited by anyone anymore as the API is no longer as widely valid as
it used to be.
parent 7385adc8
...@@ -124,7 +124,7 @@ are also provided to help in implementing the core ABCs. ...@@ -124,7 +124,7 @@ are also provided to help in implementing the core ABCs.
ABC hierarchy:: ABC hierarchy::
object object
+-- Finder +-- Finder (deprecated)
| +-- MetaPathFinder | +-- MetaPathFinder
| +-- PathEntryFinder | +-- PathEntryFinder
+-- Loader +-- Loader
...@@ -133,15 +133,16 @@ ABC hierarchy:: ...@@ -133,15 +133,16 @@ ABC hierarchy::
+-- ExecutionLoader --+ +-- ExecutionLoader --+
+-- FileLoader +-- FileLoader
+-- SourceLoader +-- SourceLoader
+-- PyLoader +-- PyLoader (deprecated)
+-- PyPycLoader +-- PyPycLoader (deprecated)
.. class:: Finder .. class:: Finder
An abstract base class representing a :term:`finder`. Finder An abstract base class representing a :term:`finder`.
implementations should derive from (or register with) the more specific
:class:`MetaPathFinder` or :class:`PathEntryFinder` ABCs. .. deprecated:: 3.3
Use :class:`MetaPathFinder` or :class:`PathEntryFinder` instead.
.. method:: find_module(fullname, path=None) .. method:: find_module(fullname, path=None)
...@@ -656,30 +657,30 @@ find and load modules. ...@@ -656,30 +657,30 @@ find and load modules.
.. class:: PathFinder .. class:: PathFinder
:term:`Finder` for :data:`sys.path` and package ``__path__`` attributes. A :term:`Finder` for :data:`sys.path` and package ``__path__`` attributes.
This class implements the :class:`importlib.abc.MetaPathFinder` ABC. This class implements the :class:`importlib.abc.MetaPathFinder` ABC.
Only class methods are defined by this class to alleviate the need for Only class methods are defined by this class to alleviate the need for
instantiation. instantiation.
.. classmethod:: find_module(fullname, path=None) .. classmethod:: find_module(fullname, path=None)
Class method that attempts to find a :term:`loader` for the module Class method that attempts to find a :term:`loader` for the module
specified by *fullname* on :data:`sys.path` or, if defined, on specified by *fullname* on :data:`sys.path` or, if defined, on
*path*. For each path entry that is searched, *path*. For each path entry that is searched,
:data:`sys.path_importer_cache` is checked. If a non-false object is :data:`sys.path_importer_cache` is checked. If a non-false object is
found then it is used as the :term:`finder` to look for the module found then it is used as the :term:`finder` to look for the module
being searched for. If no entry is found in being searched for. If no entry is found in
:data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is
searched for a finder for the path entry and, if found, is stored in searched for a finder for the path entry and, if found, is stored in
:data:`sys.path_importer_cache` along with being queried about the :data:`sys.path_importer_cache` along with being queried about the
module. If no finder is ever found then ``None`` is both stored in module. If no finder is ever found then ``None`` is both stored in
the cache and returned. the cache and returned.
.. classmethod:: invalidate_caches() .. classmethod:: invalidate_caches()
Call :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all
finders stored in :attr:`sys.path_importer_cache`. finders stored in :attr:`sys.path_importer_cache`.
.. class:: FileFinder(path, \*loader_details) .. class:: FileFinder(path, \*loader_details)
......
...@@ -41,6 +41,8 @@ Tools/Demos ...@@ -41,6 +41,8 @@ Tools/Demos
Documentation Documentation
------------- -------------
- Issue #15640: Document importlib.abc.Finder as deprecated.
- Issue #15630: Add an example for "continue" stmt in the tutorial. Patch by - Issue #15630: Add an example for "continue" stmt in the tutorial. Patch by
Daniel Ellis. Daniel Ellis.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment