Skip to content

Commit 9aab55a

Browse files
committed
Format
1 parent 5a4de7a commit 9aab55a

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

databricks/sdk/mixins/files.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from enum import Enum
1212
from io import BytesIO
1313
from types import TracebackType
14-
from typing import (TYPE_CHECKING, AnyStr, BinaryIO, Generator, Iterable, Iterator, Type, Union)
15-
from typing import Dict, List, Optional
14+
from typing import (TYPE_CHECKING, AnyStr, BinaryIO, Dict, Generator, Iterable,
15+
Iterator, List, Optional, Type, Union)
1616
from urllib import parse
1717

1818
from .._property import _cached_property
@@ -724,7 +724,8 @@ def _files_multipart_upload_complete(self, file_path: str, session_token: str, e
724724
body={'etags': etags})
725725
return
726726

727-
def multipart_upload_create_part_urls(self, session_token: str, *, page_token: str, page_size: int) -> MultipartUploadCreatePartUrlsResponse:
727+
def multipart_upload_create_part_urls(self, session_token: str, *, page_token: str,
728+
page_size: int) -> MultipartUploadCreatePartUrlsResponse:
728729
"""Request a set of presigned URLs for uploading parts of a file in a multipart upload session."""
729730

730731
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
@@ -763,7 +764,11 @@ def execute_presigned_url_request(self,
763764

764765
request_headers = {**presigned_url.headers, **headers}
765766
resp_headers = {}
766-
resp = self._api.do(presigned_url.method, presigned_url.url, headers=request_headers, data=data, response_headers = resp_headers)
767+
resp = self._api.do(presigned_url.method,
768+
presigned_url.url,
769+
headers=request_headers,
770+
data=data,
771+
response_headers=resp_headers)
767772
return (resp, resp_headers)
768773

769774

tests/integration/test_files.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import pytest
99

1010
from databricks.sdk.core import DatabricksError
11-
from databricks.sdk.mixins.files import MultipartUploadCreate, MultipartUploadCreatePartUrlsResponse
11+
from databricks.sdk.mixins.files import (MultipartUploadCreate,
12+
MultipartUploadCreatePartUrlsResponse)
1213
from databricks.sdk.service.catalog import VolumeType
1314

1415

@@ -229,6 +230,7 @@ def test_files_api_upload_download(ucws, random):
229230
with w.files.download(target_file).contents as f:
230231
assert f.read() == b"some text data"
231232

233+
232234
def test_files_multipart_upload_download_baremetal(ucws, random):
233235
w = ucws
234236
schema = 'filesit-' + random()
@@ -241,24 +243,27 @@ def test_files_multipart_upload_download_baremetal(ucws, random):
241243
## Create a session, upload the file in a single part, and then finalize the session
242244
session: MultipartUploadCreate = w.files.multipart_upload_create(target_file)
243245

244-
url_page_one: MultipartUploadCreatePartUrlsResponse = w.files.multipart_upload_create_part_urls(session.session_token, page_size=1)
246+
url_page_one: MultipartUploadCreatePartUrlsResponse = w.files.multipart_upload_create_part_urls(
247+
session.session_token, page_size=1)
245248

246249
# Verify that a second page of URLs may be requested
247-
w.files.multipart_upload_create_part_urls(session.session_token, page_token=url_page_one.next_page_token, page_size=1)
248-
250+
w.files.multipart_upload_create_part_urls(session.session_token,
251+
page_token=url_page_one.next_page_token,
252+
page_size=1)
249253

250-
(part_upload_resp, part_upload_resp_headers) = w.files.execute_presigned_url_request(url_page_one.upload_part_urls[0], data=f)
254+
(part_upload_resp, part_upload_resp_headers) = w.files.execute_presigned_url_request(
255+
url_page_one.upload_part_urls[0], data=f)
251256
print(part_upload_resp)
252257
print(part_upload_resp_headers)
253258

254-
w.files.multipart_upload_complete(target_file, session.session_token, [part_upload_resp_headers["etag"]])
259+
w.files.multipart_upload_complete(target_file, session.session_token,
260+
[part_upload_resp_headers["etag"]])
255261

256262
## Download the file & assert that it's what we expect
257263
with w.files.download(target_file).contents as f:
258264
assert f.read() == b"some text data"
259265

260266

261-
262267
def test_files_api_read_twice_from_one_download(ucws, random):
263268
w = ucws
264269
schema = 'filesit-' + random()

0 commit comments

Comments
 (0)