#NEWLINE# def load_module( self ) : #NEWLINE# #INDENT# if ( self . _name in sys . modules ) : #NEWLINE# #INDENT# mod = sys . modules [ self . _name ] #NEWLINE# return mod #NEWLINE# #UNINDENT# _src = self . get_source ( ) #NEWLINE# if self . _filepath . endswith ( '.js' ) : #NEWLINE# #INDENT# mod = JSObject ( import_js_module ( _src , self . _filepath , self . _name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . _filepath . endswith ( '.py' ) : #NEWLINE# #INDENT# mod = JSObject ( import_py_module ( _src , self . _filepath , self . _name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . _filepath . endswith ( '.pyj' ) : #NEWLINE# #INDENT# mod = JSObject ( import_pyj_module ( _src , self . _filepath , self . _name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ImportError ( ( 'Invalid Module: %s' % self . _filepath ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# mod . __file__ = self . _filepath #NEWLINE# mod . __name__ = self . _name #NEWLINE# mod . __path__ = os . path . abspath ( self . _filepath ) #NEWLINE# mod . __loader__ = self #NEWLINE# mod . __package__ = '.' . join ( self . _name . split ( '.' ) [ : ( - 1 ) ] ) #NEWLINE# if self . is_package ( ) : #NEWLINE# #INDENT# print ( 'adding path for package' ) #NEWLINE# mod . __path__ = [ self . path_entry ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'imported as regular module' ) #NEWLINE# #UNINDENT# print ( ( 'creating a new module object for "%s"' % self . _name ) ) #NEWLINE# sys . modules . setdefault ( self . _name , mod ) #NEWLINE# JSObject ( __BRYTHON__ . imported ) [ self . _name ] = mod #NEWLINE# return mod