@@ -57,6 +57,7 @@ def from_thrift_state(
5757 - CLOSED_STATE -> CLOSED
5858 - CANCELED_STATE -> CANCELLED
5959 """
60+
6061 if state in (
6162 ttypes .TOperationState .INITIALIZED_STATE ,
6263 ttypes .TOperationState .PENDING_STATE ,
@@ -113,6 +114,7 @@ def __init__(
113114 secret: The secret part of the identifier (only used for Thrift)
114115 properties: Additional information about the session
115116 """
117+
116118 self .backend_type = backend_type
117119 self .guid = guid
118120 self .secret = secret
@@ -128,6 +130,7 @@ def __str__(self) -> str:
128130 Returns:
129131 A string representation of the session ID
130132 """
133+
131134 if self .backend_type == BackendType .SEA :
132135 return str (self .guid )
133136 elif self .backend_type == BackendType .THRIFT :
@@ -152,6 +155,7 @@ def from_thrift_handle(
152155 Returns:
153156 A SessionId instance
154157 """
158+
155159 if session_handle is None :
156160 return None
157161
@@ -178,6 +182,7 @@ def from_sea_session_id(
178182 Returns:
179183 A SessionId instance
180184 """
185+
181186 return cls (BackendType .SEA , session_id , properties = properties )
182187
183188 def to_thrift_handle (self ):
@@ -187,6 +192,7 @@ def to_thrift_handle(self):
187192 Returns:
188193 A TSessionHandle object or None if this is not a Thrift session ID
189194 """
195+
190196 if self .backend_type != BackendType .THRIFT :
191197 return None
192198
@@ -205,6 +211,7 @@ def to_sea_session_id(self):
205211 Returns:
206212 The session ID string or None if this is not a SEA session ID
207213 """
214+
208215 if self .backend_type != BackendType .SEA :
209216 return None
210217
@@ -214,6 +221,7 @@ def get_guid(self) -> Any:
214221 """
215222 Get the ID of the session.
216223 """
224+
217225 return self .guid
218226
219227 def get_hex_guid (self ) -> str :
@@ -223,6 +231,7 @@ def get_hex_guid(self) -> str:
223231 Returns:
224232 A hexadecimal string representation
225233 """
234+
226235 if isinstance (self .guid , bytes ):
227236 return guid_to_hex_id (self .guid )
228237 else :
@@ -236,6 +245,7 @@ def get_protocol_version(self):
236245 The server protocol version or None if it does not exist
237246 It is not expected to exist for SEA sessions.
238247 """
248+
239249 return self .properties .get ("serverProtocolVersion" )
240250
241251
@@ -267,6 +277,7 @@ def __init__(
267277 has_result_set: Whether the command has a result set
268278 modified_row_count: The number of rows modified by the command
269279 """
280+
270281 self .backend_type = backend_type
271282 self .guid = guid
272283 self .secret = secret
@@ -307,6 +318,7 @@ def from_thrift_handle(cls, operation_handle):
307318 Returns:
308319 A CommandId instance
309320 """
321+
310322 if operation_handle is None :
311323 return None
312324
@@ -333,6 +345,7 @@ def from_sea_statement_id(cls, statement_id: str):
333345 Returns:
334346 A CommandId instance
335347 """
348+
336349 return cls (BackendType .SEA , statement_id )
337350
338351 def to_thrift_handle (self ):
@@ -342,6 +355,7 @@ def to_thrift_handle(self):
342355 Returns:
343356 A TOperationHandle object or None if this is not a Thrift command ID
344357 """
358+
345359 if self .backend_type != BackendType .THRIFT :
346360 return None
347361
@@ -362,6 +376,7 @@ def to_sea_statement_id(self):
362376 Returns:
363377 The statement ID string or None if this is not a SEA statement ID
364378 """
379+
365380 if self .backend_type != BackendType .SEA :
366381 return None
367382
@@ -374,6 +389,7 @@ def to_hex_guid(self) -> str:
374389 Returns:
375390 A hexadecimal string representation
376391 """
392+
377393 if isinstance (self .guid , bytes ):
378394 return guid_to_hex_id (self .guid )
379395 else :
0 commit comments