Show More
@@ -45,12 +45,18 class _demandmod(object): | |||
|
45 | 45 | head, globals, locals, after = self._data |
|
46 | 46 | mod = _origimport(head, globals, locals) |
|
47 | 47 | # load submodules |
|
48 | def subload(mod, p): | |
|
49 | h, t = p, None | |
|
50 | if '.' in p: | |
|
51 | h, t = p.split('.', 1) | |
|
52 | if not hasattr(mod, h): | |
|
53 | setattr(mod, h, _demandmod(p, mod.__dict__, mod.__dict__)) | |
|
54 | else: | |
|
55 | subload(getattr(mod, h), t) | |
|
56 | ||
|
48 | 57 | for x in after: |
|
49 |
|
|
|
50 | if '.' in x: | |
|
51 | hx = x.split('.')[0] | |
|
52 | if not hasattr(mod, hx): | |
|
53 | setattr(mod, hx, _demandmod(x, mod.__dict__, mod.__dict__)) | |
|
58 | subload(mod, x) | |
|
59 | ||
|
54 | 60 | # are we in the locals dictionary still? |
|
55 | 61 | if locals and locals.get(head) == self: |
|
56 | 62 | locals[head] = mod |
General Comments 0
You need to be logged in to leave comments.
Login now