Fix some glitches.

This commit is contained in:
Georg Brandl 2007-08-28 10:48:18 +00:00
parent 99cafb99ed
commit 23b8ddc110
1 changed files with 20 additions and 19 deletions

View File

@ -3,15 +3,15 @@
===================================================== =====================================================
.. module:: imputil .. module:: imputil
:synopsis: Manage and augment the import process :synopsis: Manage and augment the import process.
.. index:: statement: import .. index:: statement: import
This module provides a very handy and useful mechanism for custom This module provides a very handy and useful mechanism for custom
:keyword:`import` hooks. Compared to the standard library's ihooks.py, :keyword:`import` hooks. Compared to the older :mod:`ihooks` module,
imputil.py takes a dramatically simpler and more straight-forward approach :mod:`imputil` takes a dramatically simpler and more straight-forward
to custom :keyword:`import` functions. approach to custom :keyword:`import` functions.
.. class:: ImportManager([fs_imp]) .. class:: ImportManager([fs_imp])
@ -43,20 +43,20 @@ to custom :keyword:`import` functions.
Find and retrieve the code for the given module. Find and retrieve the code for the given module.
parent specifies a parent module to define a context for importing. It *parent* specifies a parent module to define a context for importing.
may be None, indicating no particular context for the search. It may be ``None``, indicating no particular context for the search.
modname specifies a single module (not dotted) within the parent. *modname* specifies a single module (not dotted) within the parent.
fqname specifies the fully-qualified module name. This is a *fqname* specifies the fully-qualified module name. This is a
(potentially) dotted name from the "root" of the module namespace (potentially) dotted name from the "root" of the module namespace
down to the modname. down to the modname.
If there is no parent, then modname==fqname. If there is no parent, then modname==fqname.
This method should return None, or a 3-tuple. This method should return ``None``, or a 3-tuple.
* If the module was not found, then None should be returned. * If the module was not found, then ``None`` should be returned.
* The first item of the 2- or 3-tuple should be the integer 0 or 1, * The first item of the 2- or 3-tuple should be the integer 0 or 1,
specifying whether the module that was found is a package or not. specifying whether the module that was found is a package or not.
@ -76,7 +76,7 @@ to custom :keyword:`import` functions.
.. class:: BuiltinImporter() .. class:: BuiltinImporter()
Emulate the import mechanism for builtin and frozen modules. This is a Emulate the import mechanism for builtin and frozen modules. This is a
sub-class of the Importer module. sub-class of the :class:`Importer` class.
.. method:: BuiltinImporter.get_code(parent, modname, fqname) .. method:: BuiltinImporter.get_code(parent, modname, fqname)
@ -106,6 +106,7 @@ This code is intended to be read, not executed. However, it does work
(The name is a pun on the klunkier predecessor of this module, "ni".) (The name is a pun on the klunkier predecessor of this module, "ni".)
::
import sys, imp, __builtin__ import sys, imp, __builtin__