mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Update pkgutil docs to reference appropriate finder and loader object documentation.
Initial patch contributed by Jaysinh shukla.
This commit is contained in:
parent
6d999803a0
commit
4672060d86
2 changed files with 18 additions and 18 deletions
|
@ -46,10 +46,10 @@ support.
|
||||||
|
|
||||||
.. class:: ImpImporter(dirname=None)
|
.. class:: ImpImporter(dirname=None)
|
||||||
|
|
||||||
:pep:`302` Importer that wraps Python's "classic" import algorithm.
|
:pep:`302` Finder that wraps Python's "classic" import algorithm.
|
||||||
|
|
||||||
If *dirname* is a string, a :pep:`302` importer is created that searches that
|
If *dirname* is a string, a :pep:`302` finder is created that searches that
|
||||||
directory. If *dirname* is ``None``, a :pep:`302` importer is created that
|
directory. If *dirname* is ``None``, a :pep:`302` finder is created that
|
||||||
searches the current :data:`sys.path`, plus any modules that are frozen or
|
searches the current :data:`sys.path`, plus any modules that are frozen or
|
||||||
built-in.
|
built-in.
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ support.
|
||||||
|
|
||||||
.. class:: ImpLoader(fullname, file, filename, etc)
|
.. class:: ImpLoader(fullname, file, filename, etc)
|
||||||
|
|
||||||
:pep:`302` Loader that wraps Python's "classic" import algorithm.
|
:term:`Loader` that wraps Python's "classic" import algorithm.
|
||||||
|
|
||||||
.. deprecated:: 3.3
|
.. deprecated:: 3.3
|
||||||
This emulation is no longer needed, as the standard import mechanism
|
This emulation is no longer needed, as the standard import mechanism
|
||||||
|
@ -72,7 +72,7 @@ support.
|
||||||
|
|
||||||
.. function:: find_loader(fullname)
|
.. function:: find_loader(fullname)
|
||||||
|
|
||||||
Retrieve a :pep:`302` module loader for the given *fullname*.
|
Retrieve a module :term:`loader` for the given *fullname*.
|
||||||
|
|
||||||
This is a backwards compatibility wrapper around
|
This is a backwards compatibility wrapper around
|
||||||
:func:`importlib.util.find_spec` that converts most failures to
|
:func:`importlib.util.find_spec` that converts most failures to
|
||||||
|
@ -88,9 +88,9 @@ support.
|
||||||
|
|
||||||
.. function:: get_importer(path_item)
|
.. function:: get_importer(path_item)
|
||||||
|
|
||||||
Retrieve a :pep:`302` importer for the given *path_item*.
|
Retrieve a :term:`finder` for the given *path_item*.
|
||||||
|
|
||||||
The returned importer is cached in :data:`sys.path_importer_cache` if it was
|
The returned finder is cached in :data:`sys.path_importer_cache` if it was
|
||||||
newly created by a path hook.
|
newly created by a path hook.
|
||||||
|
|
||||||
The cache (or part of it) can be cleared manually if a rescan of
|
The cache (or part of it) can be cleared manually if a rescan of
|
||||||
|
@ -103,7 +103,7 @@ support.
|
||||||
|
|
||||||
.. function:: get_loader(module_or_name)
|
.. function:: get_loader(module_or_name)
|
||||||
|
|
||||||
Get a :pep:`302` "loader" object for *module_or_name*.
|
Get a :term:`loader` object for *module_or_name*.
|
||||||
|
|
||||||
If the module or package is accessible via the normal import mechanism, a
|
If the module or package is accessible via the normal import mechanism, a
|
||||||
wrapper around the relevant part of that machinery is returned. Returns
|
wrapper around the relevant part of that machinery is returned. Returns
|
||||||
|
@ -121,16 +121,16 @@ support.
|
||||||
|
|
||||||
.. function:: iter_importers(fullname='')
|
.. function:: iter_importers(fullname='')
|
||||||
|
|
||||||
Yield :pep:`302` importers for the given module name.
|
Yield :term:`finder` objects for the given module name.
|
||||||
|
|
||||||
If fullname contains a '.', the importers will be for the package
|
If fullname contains a '.', the finders will be for the package
|
||||||
containing fullname, otherwise they will be all registered top level
|
containing fullname, otherwise they will be all registered top level
|
||||||
importers (i.e. those on both sys.meta_path and sys.path_hooks).
|
finders (i.e. those on both sys.meta_path and sys.path_hooks).
|
||||||
|
|
||||||
If the named module is in a package, that package is imported as a side
|
If the named module is in a package, that package is imported as a side
|
||||||
effect of invoking this function.
|
effect of invoking this function.
|
||||||
|
|
||||||
If no module name is specified, all top level importers are produced.
|
If no module name is specified, all top level finders are produced.
|
||||||
|
|
||||||
.. versionchanged:: 3.3
|
.. versionchanged:: 3.3
|
||||||
Updated to be based directly on :mod:`importlib` rather than relying
|
Updated to be based directly on :mod:`importlib` rather than relying
|
||||||
|
@ -201,7 +201,7 @@ support.
|
||||||
|
|
||||||
Get a resource from a package.
|
Get a resource from a package.
|
||||||
|
|
||||||
This is a wrapper for the :pep:`302` loader :func:`get_data` API. The
|
This is a wrapper for the :term:`loader` :func:`get_data` API. The
|
||||||
*package* argument should be the name of a package, in standard module format
|
*package* argument should be the name of a package, in standard module format
|
||||||
(``foo.bar``). The *resource* argument should be in the form of a relative
|
(``foo.bar``). The *resource* argument should be in the form of a relative
|
||||||
filename, using ``/`` as the path separator. The parent directory name
|
filename, using ``/`` as the path separator. The parent directory name
|
||||||
|
@ -216,5 +216,5 @@ support.
|
||||||
d = os.path.dirname(sys.modules[package].__file__)
|
d = os.path.dirname(sys.modules[package].__file__)
|
||||||
data = open(os.path.join(d, resource), 'rb').read()
|
data = open(os.path.join(d, resource), 'rb').read()
|
||||||
|
|
||||||
If the package cannot be located or loaded, or it uses a :pep:`302` loader
|
If the package cannot be located or loaded, or it uses a :term:`loader`
|
||||||
which does not support :func:`get_data`, then ``None`` is returned.
|
which does not support :func:`get_data`, then ``None`` is returned.
|
||||||
|
|
|
@ -395,7 +395,7 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
def get_importer(path_item):
|
def get_importer(path_item):
|
||||||
"""Retrieve a PEP 302 importer for the given path item
|
"""Retrieve a finder for the given path item
|
||||||
|
|
||||||
The returned importer is cached in sys.path_importer_cache
|
The returned importer is cached in sys.path_importer_cache
|
||||||
if it was newly created by a path hook.
|
if it was newly created by a path hook.
|
||||||
|
@ -419,7 +419,7 @@ def get_importer(path_item):
|
||||||
|
|
||||||
|
|
||||||
def iter_importers(fullname=""):
|
def iter_importers(fullname=""):
|
||||||
"""Yield PEP 302 importers for the given module name
|
"""Yield finders for the given module name
|
||||||
|
|
||||||
If fullname contains a '.', the importers will be for the package
|
If fullname contains a '.', the importers will be for the package
|
||||||
containing fullname, otherwise they will be all registered top level
|
containing fullname, otherwise they will be all registered top level
|
||||||
|
@ -448,7 +448,7 @@ def iter_importers(fullname=""):
|
||||||
|
|
||||||
|
|
||||||
def get_loader(module_or_name):
|
def get_loader(module_or_name):
|
||||||
"""Get a PEP 302 "loader" object for module_or_name
|
"""Get a "loader" object for module_or_name
|
||||||
|
|
||||||
Returns None if the module cannot be found or imported.
|
Returns None if the module cannot be found or imported.
|
||||||
If the named module is not already imported, its containing package
|
If the named module is not already imported, its containing package
|
||||||
|
@ -472,7 +472,7 @@ def get_loader(module_or_name):
|
||||||
|
|
||||||
|
|
||||||
def find_loader(fullname):
|
def find_loader(fullname):
|
||||||
"""Find a PEP 302 "loader" object for fullname
|
"""Find a "loader" object for fullname
|
||||||
|
|
||||||
This is a backwards compatibility wrapper around
|
This is a backwards compatibility wrapper around
|
||||||
importlib.util.find_spec that converts most failures to ImportError
|
importlib.util.find_spec that converts most failures to ImportError
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue