147 """Process an imported symbol in the import statement. |
147 """Process an imported symbol in the import statement. |
148 |
148 |
149 If the symbol doesn't exist in the parent module, it must be a |
149 If the symbol doesn't exist in the parent module, it must be a |
150 module. We set missing modules up as _demandmod instances. |
150 module. We set missing modules up as _demandmod instances. |
151 """ |
151 """ |
152 if getattr(mod, attr, nothing) is nothing: |
152 symbol = getattr(mod, attr, nothing) |
153 setattr(mod, attr, |
153 if symbol is nothing: |
154 _demandmod(attr, mod.__dict__, locals, **kwargs)) |
154 symbol = _demandmod(attr, mod.__dict__, locals, **kwargs) |
|
155 setattr(mod, attr, symbol) |
155 |
156 |
156 if level >= 0: |
157 if level >= 0: |
157 # Mercurial's enforced import style does not use |
158 # Mercurial's enforced import style does not use |
158 # "from a import b,c,d" or "from .a import b,c,d" syntax. In |
159 # "from a import b,c,d" or "from .a import b,c,d" syntax. In |
159 # addition, this appears to be giving errors with some modules |
160 # addition, this appears to be giving errors with some modules |