1818
1919import collections
2020import errno
21- import imp
2221import numbers
23- import os
2422import pprint
2523import socket
2624import ssl
4846from rethinkdb .handshake import HandshakeV1_0
4947from rethinkdb .logger import default_logger
5048
51- __all__ = ['connect ' , 'set_loop_type ' , 'Connection ' , 'Cursor ' , 'DEFAULT_PORT ' ]
49+ __all__ = ['Connection ' , 'Cursor ' , 'DEFAULT_PORT ' , 'DefaultConnection ' , 'make_connection ' ]
5250
5351
5452DEFAULT_PORT = 28015
@@ -705,10 +703,11 @@ def __init__(self, *args, **kwargs):
705703 Connection .__init__ (self , ConnectionInstance , * args , ** kwargs )
706704
707705
708- connection_type = DefaultConnection
709706
710707
711- def connect (
708+
709+ def make_connection (
710+ connection_type ,
712711 host = None ,
713712 port = None ,
714713 db = None ,
@@ -734,26 +733,3 @@ def connect(
734733
735734 conn = connection_type (host , port , db , auth_key , user , password , timeout , ssl , _handshake_version , ** kwargs )
736735 return conn .reconnect (timeout = timeout )
737-
738-
739- def set_loop_type (library ):
740- global connection_type
741- import pkg_resources
742-
743- # find module file
744- manager = pkg_resources .ResourceManager ()
745- libPath = '%(library)s_net/net_%(library)s.py' % {'library' : library }
746- if not manager .resource_exists (__name__ , libPath ):
747- raise ValueError ('Unknown loop type: %r' % library )
748-
749- # load the module
750- modulePath = manager .resource_filename (__name__ , libPath )
751- moduleName = 'net_%s' % library
752- moduleFile , pathName , desc = imp .find_module (moduleName , [os .path .dirname (modulePath )])
753- module = imp .load_module ('rethinkdb.' + moduleName , moduleFile , pathName , desc )
754-
755- # set the connection type
756- connection_type = module .Connection
757-
758- # cleanup
759- manager .cleanup_resources ()
0 commit comments