7
7
"""
8
8
9
9
from abc import ABC , abstractmethod
10
- from typing import Any , Union
10
+ from typing import Any , Union , TYPE_CHECKING
11
11
12
- import dask .bag
12
+ if TYPE_CHECKING :
13
+ # pylint: disable=import-outside-toplevel,import-error
14
+ import dask .bag
13
15
14
16
15
17
class MultiPartUploadBase (ABC ):
@@ -18,34 +20,28 @@ class MultiPartUploadBase(ABC):
18
20
@abstractmethod
19
21
def initiate (self , ** kwargs ) -> str :
20
22
"""Initiate a multipart upload and return an identifier."""
21
- pass
22
23
23
24
@abstractmethod
24
25
def write_part (self , part : int , data : bytes ) -> dict [str , Any ]:
25
26
"""Upload a single part."""
26
- pass
27
27
28
28
@abstractmethod
29
29
def finalise (self , parts : list [dict [str , Any ]]) -> str :
30
30
"""Finalise the upload with a list of parts."""
31
- pass
32
31
33
32
@abstractmethod
34
33
def cancel (self , other : str = "" ):
35
34
"""Cancel the multipart upload."""
36
- pass
37
35
38
36
@property
39
37
@abstractmethod
40
38
def url (self ) -> str :
41
39
"""Return the URL of the upload target."""
42
- pass
43
40
44
41
@property
45
42
@abstractmethod
46
43
def started (self ) -> bool :
47
44
"""Check if the multipart upload has been initiated."""
48
- pass
49
45
50
46
@abstractmethod
51
47
def writer (self , kw : dict [str , Any ], * , client : Any = None ) -> Any :
@@ -55,7 +51,6 @@ def writer(self, kw: dict[str, Any], *, client: Any = None) -> Any:
55
51
:param kw: Additional parameters for the writer.
56
52
:param client: Dask client for distributed execution.
57
53
"""
58
- pass
59
54
60
55
@abstractmethod
61
56
def upload (
@@ -64,7 +59,7 @@ def upload(
64
59
* ,
65
60
mk_header : Any = None ,
66
61
mk_footer : Any = None ,
67
- user_kw : dict [str , Any ] = None ,
62
+ user_kw : dict [str , Any ] | None = None ,
68
63
writes_per_chunk : int = 1 ,
69
64
spill_sz : int = 20 * (1 << 20 ),
70
65
client : Any = None ,
@@ -82,4 +77,3 @@ def upload(
82
77
:param client: Dask client for distributed execution.
83
78
:return: A Dask delayed object representing the finalised upload.
84
79
"""
85
- pass
0 commit comments