##// END OF EJS Templates
Don't import mirror for `__spec__` until requested...
Min RK -
Show More
@@ -3,7 +3,6
3 3 # Copyright (c) IPython Development Team.
4 4 # Distributed under the terms of the Modified BSD License.
5 5
6 import sys
7 6 import types
8 7
9 8 class ShimModule(types.ModuleType):
@@ -11,8 +10,11 class ShimModule(types.ModuleType):
11 10 def __init__(self, *args, **kwargs):
12 11 self._mirror = kwargs.pop("mirror")
13 12 super(ShimModule, self).__init__(*args, **kwargs)
14 if sys.version_info >= (3,4):
15 self.__spec__ = __import__(self._mirror).__spec__
13
14 @property
15 def __spec__(self):
16 """Don't produce __spec__ until requested"""
17 return __import__(self._mirror).__spec__
16 18
17 19 def __getattr__(self, key):
18 20 # Use the equivalent of import_item(name), see below
General Comments 0
You need to be logged in to leave comments. Login now