summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-03-15 00:53:05 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-03-15 00:53:05 (GMT)
commit7aa21f75c1d9ac36f1ab7e00aa9d0048ef61476d (patch)
treee36acc35af6673af7f7a867bf444524c7ffeba38 /Lib/importlib/_bootstrap.py
parent0e0d8a63b15b83942dba2ef1ddc33fa2f4534e21 (diff)
downloadcpython-7aa21f75c1d9ac36f1ab7e00aa9d0048ef61476d.zip
cpython-7aa21f75c1d9ac36f1ab7e00aa9d0048ef61476d.tar.gz
cpython-7aa21f75c1d9ac36f1ab7e00aa9d0048ef61476d.tar.bz2
A few more docstring/API cleanups for importlib.
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index cae12ed..e94c1d2 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -183,16 +183,16 @@ def _suffix_list(suffix_type):
class BuiltinImporter:
- """Meta path loader for built-in modules.
+ """Meta path import for built-in modules.
- All methods are either class or static methods, allowing direct use of the
- class.
+ All methods are either class or static methods to avoid the need to
+ instantiate the class.
"""
@classmethod
def find_module(cls, fullname, path=None):
- """Try to find the built-in module.
+ """Find the built-in module.
If 'path' is ever specified then the search is considered a failure.
@@ -219,10 +219,10 @@ class BuiltinImporter:
class FrozenImporter:
- """Meta path class for importing frozen modules.
+ """Meta path import for frozen modules.
- All methods are either class or static method to allow direct use of the
- class.
+ All methods are either class or static methods to avoid the need to
+ instantiate the class.
"""
@@ -249,10 +249,13 @@ class FrozenImporter:
class PyLoader:
- """Loader base class for Python source.
+ """Loader base class for Python source code.
- Requires implementing the optional PEP 302 protocols as well as
- source_path.
+ Subclasses need to implement the methods:
+
+ - source_path
+ - get_data
+ - is_package
"""
@@ -595,7 +598,8 @@ class PathFinder:
@classmethod
def find_module(cls, fullname, path=None):
- """Find the module on sys.path or 'path'."""
+ """Find the module on sys.path or 'path' based on sys.path_hooks and
+ sys.path_importer_cache."""
if not path:
path = sys.path
for entry in path:
@@ -857,7 +861,7 @@ def _gcd_import(name, package=None, level=0):
return module
-def _import(name, globals={}, locals={}, fromlist=[], level=0):
+def __import__(name, globals={}, locals={}, fromlist=[], level=0):
"""Import a module.
The 'globals' argument is used to infer where the import is occuring from