@@ -57,22 +57,27 @@ def _encode_params(self, args):
5757 elif isinstance (arg , Decimal ):
5858 type_data += bytes ([FIELD_TYPE .STRING , 0 ])
5959 data = str (arg ).encode ('utf-8' )
60- value_data += self ._get_encoded_integer_on_length (len (data )) + data
60+ value_data += \
61+ self ._get_encoded_integer_on_length (len (data )) + data
6162 elif isinstance (arg , bytes ):
6263 type_data += bytes ([FIELD_TYPE .STRING , 0 ])
63- value_data += self ._get_encoded_integer_on_length (len (arg )) + arg
64+ value_data += \
65+ self ._get_encoded_integer_on_length (len (arg )) + arg
6466 elif isinstance (arg , str ):
6567 type_data += bytes ([FIELD_TYPE .STRING , 0 ])
6668 data = arg .encode ("utf-8" )
67- value_data += self ._get_encoded_integer_on_length (len (data )) + data
69+ value_data += \
70+ self ._get_encoded_integer_on_length (len (data )) + data
6871 elif isinstance (arg , (datetime .date , datetime .datetime )):
6972 type_data += bytes ([FIELD_TYPE .STRING , 0 ])
7073 data = arg .strftime ("%Y-%m-%d %H:%M:%S.%f" ).encode ('utf-8' )
71- value_data += self ._get_encoded_integer_on_length (len (data )) + data
74+ value_data += \
75+ self ._get_encoded_integer_on_length (len (data )) + data
7276 continue
7377 else :
7478 raise Error ("unsupported type " + str (type (arg )))
75- return bytes (null_bitmap ) + new_params_bound_flag + type_data + value_data
79+ return (
80+ bytes (null_bitmap ) + new_params_bound_flag + type_data + value_data )
7681
7782 async def fetchone (self ):
7883 if self ._rows is None :
@@ -113,7 +118,8 @@ async def _read_result(self):
113118 # read column definitions
114119 for _ in range (columns_num ):
115120 # noinspection PyProtectedMember
116- columns .append (await self .connection ._read_packet (FieldDescriptorPacket ))
121+ columns .append (
122+ await self .connection ._read_packet (FieldDescriptorPacket ))
117123 # noinspection PyProtectedMember
118124 packet = await self .connection ._read_packet ()
119125 if not packet .is_eof_packet ():
@@ -149,9 +155,10 @@ def _get_encoded_integer_on_length(self, size):
149155
150156
151157_string_types = {
152- FIELD_TYPE .STRING , FIELD_TYPE .VARCHAR , FIELD_TYPE .VAR_STRING , FIELD_TYPE .ENUM ,
153- FIELD_TYPE .SET , FIELD_TYPE .LONG_BLOB , FIELD_TYPE .MEDIUM_BLOB , FIELD_TYPE .BLOB ,
154- FIELD_TYPE .TINY_BLOB , FIELD_TYPE .GEOMETRY , FIELD_TYPE .BIT , FIELD_TYPE .DECIMAL ,
158+ FIELD_TYPE .STRING , FIELD_TYPE .VARCHAR , FIELD_TYPE .VAR_STRING ,
159+ FIELD_TYPE .ENUM , FIELD_TYPE .SET , FIELD_TYPE .LONG_BLOB ,
160+ FIELD_TYPE .MEDIUM_BLOB , FIELD_TYPE .BLOB , FIELD_TYPE .TINY_BLOB ,
161+ FIELD_TYPE .GEOMETRY , FIELD_TYPE .BIT , FIELD_TYPE .DECIMAL ,
155162 FIELD_TYPE .NEWDECIMAL , FIELD_TYPE .JSON ,
156163}
157164_date_types = {
@@ -229,13 +236,15 @@ def get_result(self):
229236 second = self .read_uint8 ()
230237 if n == 7 :
231238 result .append (
232- datetime .datetime (year , month , day , hour , minute , second ))
239+ datetime .datetime (
240+ year , month , day , hour , minute , second ))
233241 continue
234242 microsecond = self .read_uint32 ()
235243 if n == 11 :
236244 result .append (
237245 datetime .datetime (
238- year , month , day , hour , minute , second , microsecond ))
246+ year , month , day , hour , minute , second , microsecond
247+ ))
239248 continue
240249 if c .type_code == FIELD_TYPE .TIME :
241250 n = self .read_uint8 ()
@@ -250,11 +259,13 @@ def get_result(self):
250259 minute = self .read_uint8 ()
251260 second = self .read_uint8 ()
252261 time_delta = datetime .timedelta (
253- days = days , seconds = second , minutes = minute , hours = hour ) * negate
262+ days = days , seconds = second , minutes = minute , hours = hour
263+ ) * negate
254264 if n == 8 :
255265 result .append (time_delta )
256266 continue
257- time_delta += datetime .timedelta (microseconds = self .read_uint32 ())
267+ time_delta += \
268+ datetime .timedelta (microseconds = self .read_uint32 ())
258269 result .append (time_delta )
259270 continue
260271
0 commit comments