Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdb73ecf

Browse files
add line gaps after multi-line pydocs for consistency
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent54f2b93 commitdb73ecf

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

‎src/databricks/sql/backend/types.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def from_thrift_state(
5757
- CLOSED_STATE -> CLOSED
5858
- CANCELED_STATE -> CANCELLED
5959
"""
60+
6061
ifstatein (
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
ifself.backend_type==BackendType.SEA:
132135
returnstr(self.guid)
133136
elifself.backend_type==BackendType.THRIFT:
@@ -152,6 +155,7 @@ def from_thrift_handle(
152155
Returns:
153156
A SessionId instance
154157
"""
158+
155159
ifsession_handleisNone:
156160
returnNone
157161

@@ -178,6 +182,7 @@ def from_sea_session_id(
178182
Returns:
179183
A SessionId instance
180184
"""
185+
181186
returncls(BackendType.SEA,session_id,properties=properties)
182187

183188
defto_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
ifself.backend_type!=BackendType.THRIFT:
191197
returnNone
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
ifself.backend_type!=BackendType.SEA:
209216
returnNone
210217

@@ -214,6 +221,7 @@ def get_guid(self) -> Any:
214221
"""
215222
Get the ID of the session.
216223
"""
224+
217225
returnself.guid
218226

219227
defget_hex_guid(self)->str:
@@ -223,6 +231,7 @@ def get_hex_guid(self) -> str:
223231
Returns:
224232
A hexadecimal string representation
225233
"""
234+
226235
ifisinstance(self.guid,bytes):
227236
returnguid_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
returnself.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
ifoperation_handleisNone:
311323
returnNone
312324

@@ -333,6 +345,7 @@ def from_sea_statement_id(cls, statement_id: str):
333345
Returns:
334346
A CommandId instance
335347
"""
348+
336349
returncls(BackendType.SEA,statement_id)
337350

338351
defto_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
ifself.backend_type!=BackendType.THRIFT:
346360
returnNone
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
ifself.backend_type!=BackendType.SEA:
366381
returnNone
367382

@@ -374,6 +389,7 @@ def to_hex_guid(self) -> str:
374389
Returns:
375390
A hexadecimal string representation
376391
"""
392+
377393
ifisinstance(self.guid,bytes):
378394
returnguid_to_hex_id(self.guid)
379395
else:

‎src/databricks/sql/backend/utils/guid_utils.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def guid_to_hex_id(guid: bytes) -> str:
1414
If conversion to hexadecimal fails, a string representation of the original
1515
bytes is returned
1616
"""
17+
1718
try:
1819
this_uuid=uuid.UUID(bytes=guid)
1920
exceptExceptionase:

‎src/databricks/sql/client.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ def __init__(
397397
Cursors are not isolated, i.e., any changes done to the database by a cursor are immediately
398398
visible by other cursors or connections.
399399
"""
400+
400401
self.connection=connection
401402
self.rowcount=-1# Return -1 as this is not supported
402403
self.buffer_size_bytes=result_buffer_size_bytes
@@ -755,6 +756,7 @@ def execute(
755756
756757
:returns self
757758
"""
759+
758760
logger.debug(
759761
"Cursor.execute(operation=%s, parameters=%s)",operation,parameters
760762
)
@@ -814,6 +816,7 @@ def execute_async(
814816
:param parameters:
815817
:return:
816818
"""
819+
817820
param_approach=self._determine_parameter_approach(parameters)
818821
ifparam_approach==ParameterApproach.NONE:
819822
prepared_params=NO_NATIVE_PARAMS

‎src/databricks/sql/session.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(
3131
3232
This class handles all session-related behavior and communication with the backend.
3333
"""
34+
3435
self.is_open=False
3536
self.host=server_hostname
3637
self.port=kwargs.get("_port",443)

‎src/databricks/sql/types.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def asDict(self, recursive: bool = False) -> Dict[str, Any]:
158158
>>> row.asDict(True) == {'key': 1, 'value': {'name': 'a', 'age': 2}}
159159
True
160160
"""
161+
161162
ifnothasattr(self,"__fields__"):
162163
raiseTypeError("Cannot convert a Row class into dict")
163164

@@ -186,6 +187,7 @@ def __contains__(self, item: Any) -> bool:
186187
# let object acts like class
187188
def__call__(self,*args:Any)->"Row":
188189
"""create new Row object"""
190+
189191
iflen(args)>len(self):
190192
raiseValueError(
191193
"Can not create Row with fields %s, expected %d values "
@@ -228,13 +230,15 @@ def __reduce__(
228230
self,
229231
)->Union[str,Tuple[Any, ...]]:
230232
"""Returns a tuple so Python knows how to pickle Row."""
233+
231234
ifhasattr(self,"__fields__"):
232235
return (_create_row, (self.__fields__,tuple(self)))
233236
else:
234237
returntuple.__reduce__(self)
235238

236239
def__repr__(self)->str:
237240
"""Printable representation of Row used in Python REPL."""
241+
238242
ifhasattr(self,"__fields__"):
239243
return"Row(%s)"%", ".join(
240244
"%s=%r"% (k,v)fork,vinzip(self.__fields__,tuple(self))

‎src/databricks/sql/utils.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def build_queue(
7474
Returns:
7575
ResultSetQueue
7676
"""
77+
7778
ifrow_set_type==TSparkRowSetType.ARROW_BASED_SET:
7879
arrow_table,n_valid_rows=convert_arrow_based_set_to_arrow_table(
7980
t_row_set.arrowBatches,lz4_compressed,arrow_schema_bytes
@@ -173,12 +174,14 @@ def __init__(
173174
:param n_valid_rows: The index of the last valid row in the table
174175
:param start_row_index: The first row in the table we should start fetching from
175176
"""
177+
176178
self.cur_row_index=start_row_index
177179
self.arrow_table=arrow_table
178180
self.n_valid_rows=n_valid_rows
179181

180182
defnext_n_rows(self,num_rows:int)->"pyarrow.Table":
181183
"""Get upto the next n rows of the Arrow dataframe"""
184+
182185
length=min(num_rows,self.n_valid_rows-self.cur_row_index)
183186
# Note that the table.slice API is not the same as Python's slice
184187
# The second argument should be length, not end index
@@ -216,6 +219,7 @@ def __init__(
216219
lz4_compressed (bool): Whether the files are lz4 compressed.
217220
description (List[List[Any]]): Hive table schema description.
218221
"""
222+
219223
self.schema_bytes=schema_bytes
220224
self.max_download_threads=max_download_threads
221225
self.start_row_index=start_row_offset
@@ -256,6 +260,7 @@ def next_n_rows(self, num_rows: int) -> "pyarrow.Table":
256260
Returns:
257261
pyarrow.Table
258262
"""
263+
259264
ifnotself.table:
260265
logger.debug("CloudFetchQueue: no more rows available")
261266
# Return empty pyarrow table to cause retry of fetch
@@ -285,6 +290,7 @@ def remaining_rows(self) -> "pyarrow.Table":
285290
Returns:
286291
pyarrow.Table
287292
"""
293+
288294
ifnotself.table:
289295
# Return empty pyarrow table to cause retry of fetch
290296
returnself._create_empty_table()
@@ -566,6 +572,7 @@ def transform_paramstyle(
566572
Returns:
567573
str
568574
"""
575+
569576
output=operation
570577
if (
571578
param_structure==ParameterStructure.POSITIONAL

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp