importlib.machinery.PathFinder

class importlib.machinery.PathFinder

A Finder for sys.path and package __path__ attributes. This class implements the importlib.abc.MetaPathFinder ABC.

Only class methods are defined by this class to alleviate the need for instantiation.

classmethod find_spec(fullname, path=None, target=None)

Class method that attempts to find a spec for the module specified by fullname on sys.path or, if defined, on path. For each path entry that is searched, sys.path_importer_cache is checked. If a non-false object is found then it is used as the path entry finder to look for the module being searched for. If no entry is found in sys.path_importer_cache, then sys.path_hooks is searched for a finder for the path entry and, if found, is stored in sys.path_importer_cache along with being queried about the module. If no finder is ever found then None is both stored in the cache and returned.

New in version 3.4.

Changed in version 3.5: If the current working directory – represented by an empty string – is no longer valid then None is returned but no value is cached in sys.path_importer_cache.

classmethod find_module(fullname, path=None)

A legacy wrapper around find_spec().

Deprecated since version 3.4: Use find_spec() instead.

classmethod invalidate_caches()

Calls importlib.abc.PathEntryFinder.invalidate_caches() on all finders stored in sys.path_importer_cache.

Changed in version 3.4: Calls objects in sys.path_hooks with the current working directory for '' (i.e. the empty string).

doc_python
2016-10-07 17:34:47
Comments
Leave a Comment

Please login to continue.