@@ -50,32 +50,38 @@ def __init__(self):
50
50
self ._index_rebuild = _index_rebuild
51
51
self ._restore = _restore
52
52
53
+ # Re-export internal modules for backward compatibility
54
+ self .ast = ast
55
+ self .errors = errors
56
+ self .net = net
57
+ self .query = query
58
+
53
59
net .Connection ._r = self
54
60
55
- for module in (net , query , ast , errors ):
61
+ for module in (self . net , self . query , self . ast , self . errors ):
56
62
for function_name in module .__all__ :
57
63
setattr (self , function_name , getattr (module , function_name ))
58
64
59
65
self .set_loop_type (None )
60
66
61
67
def set_loop_type (self , library = None ):
62
68
if library is None :
63
- self .connection_type = net .DefaultConnection
69
+ self .connection_type = self . net .DefaultConnection
64
70
return
65
71
66
72
# find module file
67
73
manager = pkg_resources .ResourceManager ()
68
- libPath = "%(library)s_net/net_%(library)s.py" % {"library" : library }
69
- if not manager .resource_exists (__name__ , libPath ):
74
+ lib_path = "%(library)s_net/net_%(library)s.py" % {"library" : library }
75
+ if not manager .resource_exists (__name__ , lib_path ):
70
76
raise ValueError ("Unknown loop type: %r" % library )
71
77
72
78
# load the module
73
- modulePath = manager .resource_filename (__name__ , libPath )
74
- moduleName = "net_%s" % library
75
- moduleFile , pathName , desc = imp .find_module (
76
- moduleName , [os .path .dirname (modulePath )]
79
+ module_path = manager .resource_filename (__name__ , lib_path )
80
+ module_name = "net_%s" % library
81
+ module_file , pathName , desc = imp .find_module (
82
+ module_name , [os .path .dirname (module_path )]
77
83
)
78
- module = imp .load_module ("rethinkdb." + moduleName , moduleFile , pathName , desc )
84
+ module = imp .load_module ("rethinkdb." + module_name , module_file , pathName , desc )
79
85
80
86
# set the connection type
81
87
self .connection_type = module .Connection
0 commit comments