Skip to content

Commit 1b7c323

Browse files
make type annotation compatible with py3.8
1 parent b34717f commit 1b7c323

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

databricks/sdk/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class Config:
150150
files_ext_multipart_upload_default_part_size: int = 10 * 1024 * 1024 # 10 MiB
151151

152152
# List of multipart upload part sizes that can be automatically selected
153-
files_ext_multipart_upload_part_size_options: list[int] = [
153+
files_ext_multipart_upload_part_size_options: list = [
154154
10 * 1024 * 1024, # 10 MiB
155155
20 * 1024 * 1024, # 20 MiB
156156
50 * 1024 * 1024, # 50 MiB

tests/test_files.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ def request(
297297
else:
298298
raise FallbackToDownloadUsingFilesApi("method must be HEAD or GET")
299299

300-
def _handle_head_file(self, headers: dict[str, str], url: str) -> "MockFilesApiDownloadResponse":
300+
def _handle_head_file(self, headers: dict, url: str) -> "MockFilesApiDownloadResponse":
301301
if "If-Unmodified-Since" in headers:
302302
assert headers["If-Unmodified-Since"] == self.last_modified
303303
resp = MockFilesApiDownloadResponse(self, 0, None, MockFilesApiDownloadRequest(url))
304304
resp.content = ""
305305
return resp
306306

307-
def _handle_get_file(self, headers: dict[str, str], url: str) -> "MockFilesApiDownloadResponse":
307+
def _handle_get_file(self, headers: dict, url: str) -> "MockFilesApiDownloadResponse":
308308
offset = 0
309309
end_byte_offset = None
310310
if "Range" in headers:
@@ -2678,9 +2678,9 @@ def test_resumable_upload(config: Config, test_case: ResumableUploadTestCase) ->
26782678

26792679
@dataclass
26802680
class CreateDownloadUrlResponseTestCase:
2681-
data: dict[str, Any]
2681+
data: dict
26822682
expected_parsed_url: Optional[str] = None
2683-
expected_parsed_headers: Optional[dict[str, str]] = None
2683+
expected_parsed_headers: Optional[dict] = None
26842684
expected_exception: Optional[Type[BaseException]] = None
26852685

26862686
def run(self) -> None:

tests/test_files_utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Utils:
1616
@staticmethod
17-
def parse_range_header(range_header: str, content_length: Optional[int] = None) -> tuple[int, int]:
17+
def parse_range_header(range_header: str, content_length: Optional[int] = None) -> tuple:
1818
"""
1919
Parses a Range header string and returns the start and end byte positions.
2020
Example input: "bytes=0-499"
@@ -54,7 +54,7 @@ def read(self, size: int = -1) -> bytes:
5454
def readline(self, size: int = -1) -> bytes:
5555
return self._stream.readline(size)
5656

57-
def readlines(self, size: int = -1) -> list[bytes]:
57+
def readlines(self, size: int = -1) -> list:
5858
return self._stream.readlines(size)
5959

6060
def readable(self) -> bool:
@@ -73,7 +73,7 @@ def tell(self) -> int:
7373
class ConcatenatedInputStreamTestCase(ABC):
7474

7575
@abstractmethod
76-
def generate(self) -> tuple[bytes, BinaryIO]:
76+
def generate(self) -> tuple:
7777
pass
7878

7979

@@ -83,7 +83,7 @@ def __init__(self, head: bytes, tail: bytes, is_seekable: bool = True):
8383
self._tail = tail
8484
self._is_seekable = is_seekable
8585

86-
def generate(self) -> tuple[bytes, BinaryIO]:
86+
def generate(self) -> tuple:
8787
"""
8888
Generate a pair of:
8989
(a) implementation under test
@@ -135,7 +135,7 @@ def to_string(test_case) -> str:
135135
]
136136

137137

138-
def verify(test_case: ConcatenatedInputStreamTestCase, apply: Callable[[BinaryIO], tuple[any, bool]]):
138+
def verify(test_case: ConcatenatedInputStreamTestCase, apply: Callable[[BinaryIO], tuple]):
139139
"""
140140
This method applies given function iteratively to both implementation under test
141141
and reference implementation of the stream, and verifies the result on each step is identical.
@@ -216,7 +216,7 @@ def apply(buffer: BinaryIO):
216216
verify(test_case, apply)
217217

218218

219-
def seeks_to_string(seeks: [tuple[int, int]]):
219+
def seeks_to_string(seeks: list):
220220
", ".join(list(map(lambda seek: f"Seek: offset={seek[0]}, whence={seek[1]}", seeks)))
221221

222222

@@ -238,7 +238,7 @@ def seeks_to_string(seeks: [tuple[int, int]]):
238238
],
239239
ids=seeks_to_string,
240240
)
241-
def test_seek(config, test_case: ConcatenatedInputStreamTestCase, seeks: list[tuple[int, int]]):
241+
def test_seek(config, test_case: ConcatenatedInputStreamTestCase, seeks: list):
242242
def read_and_restore(buf: BinaryIO) -> bytes:
243243
pos = buf.tell()
244244
result = buf.read()

0 commit comments

Comments
 (0)