@@ -68,22 +68,26 @@ class EncodedSession(Session):
6868 getScaledTimestamp -- Read the next Scaled Timestamp value off the session.
6969 getScaledDate -- Read the next Scaled Date value off the session.
7070 getUUID -- Read the next UUID value off the session.
71- getValue -- Determine the datatype of the next value off the session, then call the
72- supporting function.
73- exchangeMessages -- Exchange the pending message for an optional response from the server.
71+ getValue -- Determine the datatype of the next value off the session, then
72+ call the supporting function.
73+ exchangeMessages -- Exchange the pending message for an optional response
74+ from the server.
7475 setCiphers -- Re-sets the incoming and outgoing ciphers for the session.
75- set_encryption -- Takes a value of type boolean. Setting encryption to False will result in disabling encryption after the handshake
76+ set_encryption -- Takes a value of type boolean. Setting encryption to False
77+ will result in disabling encryption after the handshake.
7678 Private Functions:
7779 __init__ -- Constructor for the EncodedSession class.
78- _peekTypeCode -- Looks at the next Type Code off the session. (Does not move inpos)
80+ _peekTypeCode -- Looks at the next Type Code off the session.
81+ (Does not move inpos)
7982 _getTypeCode -- Read the next Type Code off the session.
8083 _takeBytes -- Gets the next length of bytes off the session.
8184
8285 """
8386
8487 def __init__ (self , host , port , service = 'SQL2' , options = None , ** kwargs ):
8588 """Constructor for the EncodedSession class."""
86- super (EncodedSession , self ).__init__ (host , port = port , service = service , options = options , ** kwargs )
89+ super (EncodedSession , self ).__init__ (host , port = port , service = service ,
90+ options = options , ** kwargs )
8791 (remote_options , _ ) = self ._split_options (options )
8892 self .doConnect (attributes = remote_options )
8993
@@ -166,7 +170,7 @@ def open_database(self, db_name, parameters, cp):
166170
167171 (remote_options , _ ) = self ._split_options (parameters )
168172
169- self ._putMessageId (protocol .OPENDATABASE ).putInt (protocol .CURRENT_PROTOCOL_VERSION ).putString (db_name ).putInt (len (remote_options ))
173+ self ._putMessageId (protocol .OPENDATABASE ).putInt (protocol .CURRENT_PROTOCOL_VERSION ).putString (db_name ).putInt (len (remote_options )) # noqa: E501
170174 for (k , v ) in remote_options .items ():
171175 self .putString (k ).putString (v )
172176 self .putNull ().putString (cp .genClientKey ())
@@ -202,7 +206,7 @@ def open_database_on_secure_connection(self, db_name, parameters):
202206
203207 (remote_options , _ ) = self ._split_options (parameters )
204208
205- self ._putMessageId (protocol .OPENDATABASE ).putInt (protocol .CURRENT_PROTOCOL_VERSION ).putString (db_name ).putInt (len (remote_options ))
209+ self ._putMessageId (protocol .OPENDATABASE ).putInt (protocol .CURRENT_PROTOCOL_VERSION ).putString (db_name ).putInt (len (remote_options )) # noqa: E501
206210 for (k , v ) in remote_options .items ():
207211 self .putString (k ).putString (v )
208212
@@ -294,7 +298,7 @@ def test_connection(self):
294298 fieldValue = self .getInt ()
295299 r2 = self .getInt ()
296300
297- if ( rsHandle is None or count is None or colname is None or result is None or fieldValue is None or r2 is None ):
301+ if rsHandle is None or count is None or colname is None or result is None or fieldValue is None or r2 is None : # noqa: E501
298302 raise ProgrammingError ('Failed to connect!' )
299303
300304 # Mostly for cursors
@@ -387,8 +391,9 @@ def execute_batch_prepared_statement(self, prepared_statement, param_lists):
387391
388392 for parameters in param_lists :
389393 if prepared_statement .parameter_count != len (parameters ):
390- raise ProgrammingError ("Incorrect number of parameters specified, expected %d, got %d" %
391- (prepared_statement .parameter_count , len (parameters )))
394+ raise ProgrammingError ("Incorrect number of parameters specified, expected %d, got %d" # noqa: E501
395+ % (prepared_statement .parameter_count ,
396+ len (parameters )))
392397 self .putInt (len (parameters ))
393398 for param in parameters :
394399 self .putValue (param )
@@ -941,7 +946,8 @@ def getScaledTime(self):
941946 scale = fromByteString (self ._takeBytes (1 ))
942947 time = fromSignedByteString (self ._takeBytes (typeCode - 208 ))
943948 ticks = decimal .Decimal (str (time )) / decimal .Decimal (10 ** scale )
944- return datatype .TimeFromTicks (round (int (ticks )), int ((ticks % 1 ) * decimal .Decimal (1000000 )))
949+ return datatype .TimeFromTicks (round (int (ticks )),
950+ int ((ticks % 1 ) * decimal .Decimal (1000000 )))
945951
946952 raise DataError ('Not a scaled time' )
947953
@@ -956,7 +962,8 @@ def getScaledTimestamp(self):
956962 scale = fromByteString (self ._takeBytes (1 ))
957963 timestamp = fromSignedByteString (self ._takeBytes (typeCode - 216 ))
958964 ticks = decimal .Decimal (str (timestamp )) / decimal .Decimal (10 ** scale )
959- return datatype .TimestampFromTicks (round (int (ticks )), int ((ticks % 1 ) * decimal .Decimal (1000000 )))
965+ return datatype .TimestampFromTicks (round (int (ticks )),
966+ int ((ticks % 1 ) * decimal .Decimal (1000000 )))
960967
961968 raise DataError ('Not a scaled timestamp' )
962969
0 commit comments