summaryrefslogtreecommitdiffstats
path: root/Lib/knee.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-09 20:39:58 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-09 20:39:58 (GMT)
commit4f9f8e35997d868ab240556c71a8aebb845e774d (patch)
tree2f3e184b496d298a4b20091feba8aae3af47a63f /Lib/knee.py
parent501d0bb7adcc4ce825ff03658dabd5042f6c47d8 (diff)
downloadcpython-4f9f8e35997d868ab240556c71a8aebb845e774d.zip
cpython-4f9f8e35997d868ab240556c71a8aebb845e774d.tar.gz
cpython-4f9f8e35997d868ab240556c71a8aebb845e774d.tar.bz2
Make functionality more closely the same as what's implemented by default.
Diffstat (limited to 'Lib/knee.py')
-rw-r--r--Lib/knee.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/knee.py b/Lib/knee.py
index 47f65cb..f88d78f 100644
--- a/Lib/knee.py
+++ b/Lib/knee.py
@@ -63,13 +63,22 @@ def load_tail(q, tail):
raise ImportError, "No module named " + mname
return m
-def ensure_fromlist(m, fromlist):
+def ensure_fromlist(m, fromlist, recursive=0):
for sub in fromlist:
+ if sub == "*":
+ if not recursive:
+ try:
+ all = m.__all__
+ except AttributeError:
+ pass
+ else:
+ ensure_fromlist(m, all, 1)
+ continue
if sub != "*" and not hasattr(m, sub):
subname = "%s.%s" % (m.__name__, sub)
submod = import_module(sub, subname, m)
-## if not submod:
-## raise ImportError, "No module named " + subname
+ if not submod:
+ raise ImportError, "No module named " + subname
def import_module(partname, fqname, parent):
try:
@@ -108,8 +117,3 @@ original_reload = __builtin__.reload
# Now install our hooks
__builtin__.__import__ = import_hook
__builtin__.reload = reload_hook
-
-# pretend we're ni, too
-sys.modules['ni'] = sys.modules[__name__]
-def ni(): pass
-def install(): pass