Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52894fd

Browse filesBrowse files
committed
remove unused lines.
1 parent ad11930 commit 52894fd
Copy full SHA for 52894fd

File tree

Expand file treeCollapse file tree

1 file changed

+20
-21
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-21
lines changed

‎MySQLdb/connections.py

Copy file name to clipboardExpand all lines: MySQLdb/connections.py
+20-21Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def defaulterrorhandler(connection, cursor, errorclass, errorvalue):
3939

4040
def numeric_part(s):
4141
"""Returns the leading numeric part of a string.
42-
42+
4343
>>> numeric_part("20-alpha")
4444
20
4545
>>> numeric_part("foo")
4646
>>> numeric_part("16b")
4747
16
4848
"""
49-
49+
5050
m = re_numeric_part.match(s)
5151
if m:
5252
return int(m.group(1))
@@ -58,7 +58,7 @@ class Connection(_mysql.connection):
5858
"""MySQL Database Connection Object"""
5959

6060
default_cursor = cursors.Cursor
61-
61+
6262
def __init__(self, *args, **kwargs):
6363
"""
6464
@@ -68,7 +68,7 @@ def __init__(self, *args, **kwargs):
6868
6969
host
7070
string, host to connect
71-
71+
7272
user
7373
string, user to connect as
7474
@@ -125,7 +125,7 @@ class object, used to create cursors (keyword only)
125125
If supplied, the session SQL mode will be changed to this
126126
setting (MySQL-4.1 and newer). For more details and legal
127127
values, see the MySQL documentation.
128-
128+
129129
client_flag
130130
integer, flags to use or 0
131131
(see MySQL docs or constants/CLIENTS.py)
@@ -138,19 +138,17 @@ class object, used to create cursors (keyword only)
138138
139139
local_infile
140140
integer, non-zero enables LOAD LOCAL INFILE; zero disables
141-
141+
142142
There are a number of undocumented, non-standard methods. See the
143143
documentation for the MySQL C API for some hints on what they do.
144144
145145
"""
146146
from MySQLdb.constants import CLIENT, FIELD_TYPE
147147
from MySQLdb.converters import conversions
148-
from weakref import proxy, WeakValueDictionary
149-
150-
import types
148+
from weakref import proxy
151149

152150
kwargs2 = kwargs.copy()
153-
151+
154152
if 'conv' in kwargs:
155153
conv = kwargs['conv']
156154
else:
@@ -171,7 +169,7 @@ class object, used to create cursors (keyword only)
171169
use_unicode = True
172170
else:
173171
use_unicode = False
174-
172+
175173
use_unicode = kwargs2.pop('use_unicode', use_unicode)
176174
sql_mode = kwargs2.pop('sql_mode', '')
177175

@@ -181,14 +179,14 @@ class object, used to create cursors (keyword only)
181179
client_flag |= CLIENT.MULTI_STATEMENTS
182180
if client_version >= (5, 0):
183181
client_flag |= CLIENT.MULTI_RESULTS
184-
182+
185183
kwargs2['client_flag'] = client_flag
186184

187185
super(Connection, self).__init__(*args, **kwargs2)
188186
self.cursorclass = cursorclass
189187
self.encoders = dict([ (k, v) for k, v in conv.items()
190188
if type(k) is not int ])
191-
189+
192190
self._server_version = tuple([ numeric_part(n) for n in self.get_server_info().split('.')[:2] ])
193191

194192
db = proxy(self)
@@ -206,7 +204,7 @@ def _get_string_decoder():
206204
def string_decoder(s):
207205
return s.decode(string_decoder.charset)
208206
return string_decoder
209-
207+
210208
string_literal = _get_string_literal()
211209
self.unicode_literal = unicode_literal = _get_unicode_literal()
212210
self.string_decoder = string_decoder = _get_string_decoder()
@@ -230,7 +228,7 @@ def string_decoder(s):
230228
# PEP-249 requires autocommit to be initially off
231229
self.autocommit(False)
232230
self.messages = []
233-
231+
234232
def cursor(self, cursorclass=None):
235233
"""
236234
@@ -242,14 +240,15 @@ def cursor(self, cursorclass=None):
242240
"""
243241
return (cursorclass or self.cursorclass)(self)
244242

245-
def __enter__(self): return self.cursor()
246-
243+
def __enter__(self):
244+
return self.cursor()
245+
247246
def __exit__(self, exc, value, tb):
248247
if exc:
249248
self.rollback()
250249
else:
251250
self.commit()
252-
251+
253252
def literal(self, o):
254253
"""
255254
@@ -271,7 +270,7 @@ def begin(self):
271270
warn("begin() is non-standard and will be removed in 1.3",
272271
DeprecationWarning, 2)
273272
self.query("BEGIN")
274-
273+
275274
if not hasattr(_mysql.connection, 'warning_count'):
276275

277276
def warning_count(self):
@@ -311,7 +310,7 @@ def set_sql_mode(self, sql_mode):
311310
raise NotSupportedError("server is too old to set sql_mode")
312311
self.query("SET SESSION sql_mode='%s'" % sql_mode)
313312
self.store_result()
314-
313+
315314
def show_warnings(self):
316315
"""Return detailed information about warnings as a
317316
sequence of tuples of (Level, Code, Message). This
@@ -322,7 +321,7 @@ def show_warnings(self):
322321
r = self.store_result()
323322
warnings = r.fetch_row(0)
324323
return warnings
325-
324+
326325
Warning = Warning
327326
Error = Error
328327
InterfaceError = InterfaceError

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.