diff options
author | Barry Warsaw <barry@python.org> | 2012-07-29 20:36:17 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2012-07-29 20:36:17 (GMT) |
commit | d7d2194ea16005a2a58f8070bbfc2a24e068cb65 (patch) | |
tree | 7e5b45fad256b2ac9c38489db02b1ca14a5950f1 /Lib/importlib | |
parent | 96d97ec9c08a95201e9d7f0b7819ca6328002693 (diff) | |
download | cpython-d7d2194ea16005a2a58f8070bbfc2a24e068cb65.zip cpython-d7d2194ea16005a2a58f8070bbfc2a24e068cb65.tar.gz cpython-d7d2194ea16005a2a58f8070bbfc2a24e068cb65.tar.bz2 |
Integration of importdocs from the features/pep-420 repo.
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/abc.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py index 8d65907..f5ac01d 100644 --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -33,16 +33,33 @@ class Loader(metaclass=abc.ABCMeta): The fullname is a str.""" raise NotImplementedError + @abs.abstractmethod + def module_repr(self, module): + """Abstract method which when implemented calculates and returns the + given module's repr.""" + raise NotImplementedError + class Finder(metaclass=abc.ABCMeta): """Abstract base class for import finders.""" + @abs.abstractmethod + def find_loader(self, fullname): + """Abstract method which when implemented returns a module loader. + The fullname is a str. Returns a 2-tuple of (Loader, portion) where + portion is a sequence of file system locations contributing to part of + a namespace package. The sequence may be empty. When present, + `find_loader()` is preferred over `find_module()`. + """ + raise NotImplementedError + @abc.abstractmethod def find_module(self, fullname, path=None): """Abstract method which when implemented should find a module. The fullname is a str and the optional path is a str or None. - Returns a Loader object. + Returns a Loader object. This method is only called if + `find_loader()` is not present. """ raise NotImplementedError |