Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f9f8e3

Browse files
committed
Make functionality more closely the same as what's implemented by default.
1 parent 501d0bb commit 4f9f8e3

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

Lib/knee.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,22 @@ def load_tail(q, tail):
6363
raise ImportError, "No module named " + mname
6464
return m
6565

66-
def ensure_fromlist(m, fromlist):
66+
def ensure_fromlist(m, fromlist, recursive=0):
6767
for sub in fromlist:
68+
if sub == "*":
69+
if not recursive:
70+
try:
71+
all = m.__all__
72+
except AttributeError:
73+
pass
74+
else:
75+
ensure_fromlist(m, all, 1)
76+
continue
6877
if sub != "*" and not hasattr(m, sub):
6978
subname = "%s.%s" % (m.__name__, sub)
7079
submod = import_module(sub, subname, m)
71-
## if not submod:
72-
## raise ImportError, "No module named " + subname
80+
if not submod:
81+
raise ImportError, "No module named " + subname
7382

7483
def import_module(partname, fqname, parent):
7584
try:
@@ -108,8 +117,3 @@ def reload_hook(module):
108117
# Now install our hooks
109118
__builtin__.__import__ = import_hook
110119
__builtin__.reload = reload_hook
111-
112-
# pretend we're ni, too
113-
sys.modules['ni'] = sys.modules[__name__]
114-
def ni(): pass
115-
def install(): pass

0 commit comments

Comments
 (0)