##// END OF EJS Templates
demandimport: handling new relative imports...
Ali Gholami Rudi -
r5929:e160f231 default
parent child Browse files
Show More
@@ -77,7 +77,7 b' class _demandmod(object):'
77 self._load()
77 self._load()
78 setattr(self._module, attr, val)
78 setattr(self._module, attr, val)
79
79
80 def _demandimport(name, globals=None, locals=None, fromlist=None):
80 def _demandimport(name, globals=None, locals=None, fromlist=None, level=None):
81 if not locals or name in ignore or fromlist == ('*',):
81 if not locals or name in ignore or fromlist == ('*',):
82 # these cases we can't really delay
82 # these cases we can't really delay
83 return _origimport(name, globals, locals, fromlist)
83 return _origimport(name, globals, locals, fromlist)
@@ -95,6 +95,9 b' def _demandimport(name, globals=None, lo'
95 return locals[base]
95 return locals[base]
96 return _demandmod(name, globals, locals)
96 return _demandmod(name, globals, locals)
97 else:
97 else:
98 if level is not None:
99 # from . import b,c,d or from .a import b,c,d
100 return _origimport(name, globals, locals, fromlist, level)
98 # from a import b,c,d
101 # from a import b,c,d
99 mod = _origimport(name, globals, locals)
102 mod = _origimport(name, globals, locals)
100 # recurse down the module chain
103 # recurse down the module chain
General Comments 0
You need to be logged in to leave comments. Login now