importlib.abc.SourceLoader.get_code()

get_code(fullname) Concrete implementation of InspectLoader.get_code().

importlib.abc.SourceLoader.exec_module()

exec_module(module) Concrete implementation of Loader.exec_module(). New in version 3.4.

importlib.abc.SourceLoader

class importlib.abc.SourceLoader An abstract base class for implementing source (and optionally bytecode) file loading. The class inherits from both ResourceLoader and ExecutionLoader, requiring the implementation of: ResourceLoader.get_data() ExecutionLoader.get_filename() Should only return the path to the source file; sourceless loading is not supported. The abstract methods defined by this class are to add optional bytecode file support. Not implementing these optional methods

importlib.abc.ResourceLoader.get_data()

abstractmethod get_data(path) An abstract method to return the bytes for the data located at path. Loaders that have a file-like storage back-end that allows storing arbitrary data can implement this abstract method to give direct access to the data stored. OSError is to be raised if the path cannot be found. The path is expected to be constructed using a module’s __file__ attribute or an item from a package’s __path__. Changed in version 3.4: Raises OSError instead of NotImplementedError.

importlib.abc.ResourceLoader

class importlib.abc.ResourceLoader An abstract base class for a loader which implements the optional PEP 302 protocol for loading arbitrary resources from the storage back-end. abstractmethod get_data(path) An abstract method to return the bytes for the data located at path. Loaders that have a file-like storage back-end that allows storing arbitrary data can implement this abstract method to give direct access to the data stored. OSError is to be raised if the path cannot be found. The p

importlib.abc.PathEntryFinder.invalidate_caches()

invalidate_caches() An optional method which, when called, should invalidate any internal cache used by the finder. Used by PathFinder.invalidate_caches() when invalidating the caches of all cached finders.

importlib.abc.PathEntryFinder.find_spec()

find_spec(fullname, target=None) An abstract method for finding a spec for the specified module. The finder will search for the module only within the path entry to which it is assigned. If a spec cannot be found, None is returned. When passed in, target is a module object that the finder may use to make a more educated about what spec to return. New in version 3.4.

importlib.abc.PathEntryFinder.find_module()

find_module(fullname) A concrete implementation of Finder.find_module() which is equivalent to self.find_loader(fullname)[0]. Deprecated since version 3.4: Use find_spec() instead.

importlib.abc.PathEntryFinder.find_loader()

find_loader(fullname) A legacy method for finding a loader for the specified module. Returns a 2-tuple of (loader, portion) where portion is a sequence of file system locations contributing to part of a namespace package. The loader may be None while specifying portion to signify the contribution of the file system locations to a namespace package. An empty list can be used for portion to signify the loader is not part of a namespace package. If loader is None and portion is the empty list t

importlib.abc.PathEntryFinder

class importlib.abc.PathEntryFinder An abstract base class representing a path entry finder. Though it bears some similarities to MetaPathFinder, PathEntryFinder is meant for use only within the path-based import subsystem provided by PathFinder. This ABC is a subclass of Finder for compatibility reasons only. New in version 3.3. find_spec(fullname, target=None) An abstract method for finding a spec for the specified module. The finder will search for the module only within the path ent