1
- '''
1
+ """
2
2
PyMySQL: A pure-Python MySQL client library.
3
3
4
- Copyright (c) 2010, 2013 PyMySQL contributors
4
+ Copyright (c) 2010-2016 PyMySQL contributors
5
5
6
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
of this software and associated documentation files (the "Software"), to deal
20
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
THE SOFTWARE.
23
+ """
24
+ import sys
23
25
24
- '''
25
-
26
- VERSION = (0 , 6 , 7 , None )
27
-
28
- from ._compat import text_type , JYTHON , IRONPYTHON , PY2
26
+ from ._compat import PY2
29
27
from .constants import FIELD_TYPE
30
28
from .converters import escape_dict , escape_sequence , escape_string
31
29
from .err import Warning , Error , InterfaceError , DataError , \
34
32
from .times import Date , Time , Timestamp , \
35
33
DateFromTicks , TimeFromTicks , TimestampFromTicks
36
34
37
- import sys
38
-
39
35
36
+ VERSION = (0 , 7 , 0 )
40
37
threadsafety = 1
41
38
apilevel = "2.0"
42
- paramstyle = "format "
39
+ paramstyle = "pyformat "
43
40
44
- class DBAPISet (frozenset ):
45
41
42
+ class DBAPISet (frozenset ):
46
43
47
44
def __ne__ (self , other ):
48
45
if isinstance (other , set ):
@@ -73,15 +70,15 @@ def __hash__(self):
73
70
DATETIME = TIMESTAMP
74
71
ROWID = DBAPISet ()
75
72
73
+
76
74
def Binary (x ):
77
75
"""Return x as a binary type."""
78
- if isinstance (x , text_type ) and not (JYTHON or IRONPYTHON ):
79
- x = x .encode ()
80
76
if PY2 :
81
77
return bytearray (x )
82
78
else :
83
79
return bytes (x )
84
80
81
+
85
82
def Connect (* args , ** kwargs ):
86
83
"""
87
84
Connect to the database; see connections.Connection.__init__() for
@@ -92,11 +89,10 @@ def Connect(*args, **kwargs):
92
89
93
90
from pymysql import connections as _orig_conn
94
91
if _orig_conn .Connection .__init__ .__doc__ is not None :
95
- Connect .__doc__ = _orig_conn .Connection .__init__ .__doc__ + ("""
96
- See connections.Connection.__init__() for information about defaults.
97
- """ )
92
+ Connect .__doc__ = _orig_conn .Connection .__init__ .__doc__
98
93
del _orig_conn
99
94
95
+
100
96
def get_client_info (): # for MySQLdb compatibility
101
97
return '.' .join (map (str , VERSION ))
102
98
@@ -110,7 +106,7 @@ def get_client_info(): # for MySQLdb compatibility
110
106
__version__ = get_client_info ()
111
107
112
108
def thread_safe ():
113
- return True # match MySQLdb.thread_safe()
109
+ return True # match MySQLdb.thread_safe()
114
110
115
111
def install_as_MySQLdb ():
116
112
"""
@@ -119,6 +115,7 @@ def install_as_MySQLdb():
119
115
"""
120
116
sys .modules ["MySQLdb" ] = sys .modules ["_mysql" ] = sys .modules ["pymysql" ]
121
117
118
+
122
119
__all__ = [
123
120
'BINARY' , 'Binary' , 'Connect' , 'Connection' , 'DATE' , 'Date' ,
124
121
'Time' , 'Timestamp' , 'DateFromTicks' , 'TimeFromTicks' , 'TimestampFromTicks' ,
@@ -131,6 +128,5 @@ def install_as_MySQLdb():
131
128
'paramstyle' , 'threadsafety' , 'version_info' ,
132
129
133
130
"install_as_MySQLdb" ,
134
-
135
- "NULL" ,"__version__" ,
136
- ]
131
+ "NULL" , "__version__" ,
132
+ ]
0 commit comments