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.pathor, if defined, on path. For each path entry that is searched,sys.path_importer_cacheis 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 insys.path_importer_cache, thensys.path_hooksis searched for a finder for the path entry and, if found, is stored insys.path_importer_cachealong with being queried about the module. If no finder is ever found thenNoneis 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
Noneis returned but no value is cached insys.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 insys.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).
Please login to continue.