<s> """<STR_LIT>""" <EOL> import sys <EOL> class ExtensionImporter ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , namespace , alias , sys ) : <EOL> self . namespace = namespace <EOL> self . prefix = namespace + '<STR_LIT:.>' <EOL> self . alias = alias <EOL> self . sys = sys <EOL> def find_module ( self , fullname , path = None ) : <EOL> if fullname . startswith ( self . prefix ) : <EOL> return self <EOL> def load_module ( self , fullname ) : <EOL> try : <EOL> return self . sys . modules [ fullname ] <EOL> except KeyError : <EOL> pass <EOL> subname = fullname [ len ( self . prefix ) : ] <EOL> actual = self . alias . format ( subname ) <EOL> try : <EOL> __import__ ( actual ) <EOL> except ImportError : <EOL> raise ImportError ( '<STR_LIT>' + repr ( fullname ) ) <EOL> module = self . sys . modules [ actual ] <EOL> self . sys . modules [ fullname ] = module <EOL> if '<STR_LIT:.>' not in subname : <EOL> setattr ( self . sys . modules [ self . namespace ] , subname , module ) <EOL> return module <EOL> importer = ExtensionImporter ( __name__ , '<STR_LIT>' , sys ) <EOL> sys . meta_path . append ( importer ) <EOL> del sys , importer , ExtensionImporter </s>
