Skip to content

Commit cf9a1e6

Browse files
committed
update document comments.
1 parent db36186 commit cf9a1e6

File tree

20 files changed

+210
-270
lines changed

20 files changed

+210
-270
lines changed

alibabacloud_oss_v2/_client.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
class AddressStyle():
35-
"""_summary_
35+
"""address style information
3636
"""
3737
Virtual = 1
3838
Path = 2
@@ -62,15 +62,12 @@ def __init__(
6262
self._seekable = False
6363

6464
def is_seekable(self) -> bool:
65-
"""'_summary_
66-
67-
Returns:
68-
bool: _description_
65+
"""'is seekable
6966
"""
7067
return self._seekable
7168

7269
def mark(self) -> None:
73-
"""_summary_
70+
"""Set the current marked position in the stream.
7471
"""
7572
if self.is_seekable() is False:
7673
return
@@ -79,7 +76,7 @@ def mark(self) -> None:
7976
self._io_curr = self._body.tell()
8077

8178
def reset(self) -> None:
82-
"""_summary_
79+
"""Resets the buffer to the marked position.
8380
"""
8481
if self.is_seekable() is False:
8582
return
@@ -208,14 +205,14 @@ def verify_operation(self, op_input: OperationInput, options: _Options) -> None:
208205
raise exceptions.ObjectNameInvalidError()
209206

210207
def apply_operation(self, options: _Options, op_input: OperationInput) -> None:
211-
"""_summary_"""
208+
"""apply operation"""
212209
self._apply_operation_options(options) # pylint: disable=no-member
213210
_apply_operation_metadata(op_input, options)
214211

215212

216213
def build_request_context(self, op_input: OperationInput, options: _Options, inner: _InnerOptions
217214
) -> SigningContext:
218-
"""_summary_
215+
"""build request context
219216
"""
220217
# host & path
221218
url = _build_url(op_input, options)
@@ -273,7 +270,7 @@ def build_request_context(self, op_input: OperationInput, options: _Options, inn
273270
return context
274271

275272
def retry_max_attempts(self, options: _Options) -> int:
276-
"""_summary_"""
273+
"""retry max attempts"""
277274
if options.retry_max_attempts is not None:
278275
attempts = int(options.retry_max_attempts)
279276
elif options.retryer is not None:
@@ -284,11 +281,11 @@ def retry_max_attempts(self, options: _Options) -> int:
284281
return max(1, attempts)
285282

286283
def has_feature(self, flag: int) -> bool:
287-
"""_summary_"""
284+
"""has feature"""
288285
return (self._options.feature_flags & flag) > 0 # pylint: disable=no-member
289286

290287
def get_retry_attempts(self) -> bool:
291-
"""_summary_"""
288+
"""get retry attempts"""
292289
return self.retry_max_attempts(self._options) # pylint: disable=no-member
293290

294291
class _SyncClientImpl(_ClientImplMixIn):
@@ -303,7 +300,7 @@ def __init__(self, config: Config, **kwargs) -> None:
303300
self._inner = inner
304301

305302
def invoke_operation(self, op_input: OperationInput, **kwargs) -> OperationOutput:
306-
"""_summary_
303+
"""Common class interface invoice operation
307304
308305
Args:
309306
op_input (OperationInput): _description_

alibabacloud_oss_v2/checkpoint.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
# }
4747

4848
class DownloadCheckpoint:
49-
"""_summary_
49+
"""Download Checkpoint
5050
"""
5151
def __init__(
5252
self,
@@ -189,10 +189,7 @@ def _is_valid(self) -> bool:
189189
return False
190190

191191
def dump(self) -> bool:
192-
"""_summary_
193-
194-
Returns:
195-
_type_: _description_
192+
"""dump the checkpoint to local file
196193
"""
197194
#Calculate MD5
198195
self.cp_info["Data"]["DownloadInfo"] = {
@@ -247,7 +244,7 @@ def remove(self) -> None:
247244
# }
248245

249246
class UploadCheckpoint:
250-
"""_summary_
247+
"""Upload Checkpoint
251248
"""
252249
def __init__(
253250
self,
@@ -352,10 +349,7 @@ def _is_valid(self) -> bool:
352349
return False
353350

354351
def dump(self) -> bool:
355-
"""_summary_
356-
357-
Returns:
358-
_type_: _description_
352+
"""dump the checkpoint to local file
359353
"""
360354
#Calculate MD5
361355
self.cp_info["Data"]["UploadInfo"] = {
@@ -377,7 +371,7 @@ def dump(self) -> bool:
377371
return True
378372

379373
def remove(self) -> None:
380-
"""_summary_
374+
"""remove the checkpoint file
381375
"""
382376
try:
383377
os.remove(self.cp_filepath)

alibabacloud_oss_v2/client.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pylint: disable=line-too-long
2-
"""_summary_"""
2+
"""Client used to interact with **Alibaba Cloud Object Storage Service (OSS)**."""
33
import copy
44
from typing import Optional
55
from .config import Config
@@ -29,11 +29,11 @@
2929
from .filelike import AppendOnlyFile, ReadOnlyFile
3030

3131
class Client:
32-
"""_summary_
32+
"""Client
3333
"""
3434

3535
def __init__(self, config: Config, **kwargs) -> None:
36-
"""_summary_
36+
"""Initialize Client
3737
3838
Args:
3939
config (Config): _description_
@@ -45,7 +45,7 @@ def __repr__(self) -> str:
4545

4646
def invoke_operation(self, op_input: OperationInput, **kwargs
4747
) -> OperationOutput:
48-
"""_summary_
48+
"""invoke operation
4949
5050
Args:
5151
op_input (OperationInput): _description_
@@ -679,7 +679,7 @@ def list_multipart_uploads_paginator(self, **kwargs) -> ListMultipartUploadsPagi
679679

680680
# transfer managers
681681
def downloader(self, **kwargs) -> Downloader:
682-
"""_summary_
682+
"""downloader
683683
684684
Args:
685685
@@ -689,7 +689,7 @@ def downloader(self, **kwargs) -> Downloader:
689689
return Downloader(self, **kwargs)
690690

691691
def uploader(self, **kwargs) -> Uploader:
692-
"""_summary_
692+
"""uploader
693693
694694
Returns:
695695
Uploader: _description_
@@ -818,29 +818,29 @@ def is_bucket_exist(self, bucket: str, request_payer: Optional[str] = None, **kw
818818
return result is not None
819819

820820
def put_object_from_file(self, request: models.PutObjectRequest, filepath: str, **kwargs) -> models.PutObjectResult:
821-
"""_summary_
821+
"""put an object from file
822822
823823
Args:
824-
request (models.PutObjectRequest): _description_
825-
filepath (str): _description_
824+
request (PutObjectRequest): Request parameters for PutObject operation.
825+
filepath (str): The path of the file to upload.
826826
827827
Returns:
828-
models.PutObjectResult: _description_
828+
PutObjectResult: Response result for PutObject operation.
829829
"""
830830
with open(filepath, 'rb') as f:
831831
req = copy.copy(request)
832832
req.body = f
833833
return self.put_object(req, **kwargs)
834834

835835
def get_object_to_file(self, request: models.GetObjectRequest, filepath: str, **kwargs) -> models.GetObjectResult:
836-
"""_summary_
836+
"""get an object to file
837837
838838
Args:
839-
request (models.GetObjectRequest): _description_
840-
filepath (str): _description_
839+
request (GetObjectRequest): Request parameters for GetObject operation.
840+
filepath (str): The path of the file to download.
841841
842842
Returns:
843-
models.GetObjectResult: _description_
843+
GetObjectResult: Response result for GetObject operation.
844844
"""
845845
prog = None
846846
if request.progress_fn:

alibabacloud_oss_v2/crc.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,6 @@ def write(self, data: bytes):
225225

226226
@staticmethod
227227
def combine(crc1, crc2, size) -> int:
228-
"""_summary_
229-
230-
Args:
231-
crc1 (_type_): _description_
232-
crc2 (_type_): _description_
233-
size (_type_): _description_
234-
235-
Returns:
236-
int: _description_
228+
"""Combines two CRC64 values into one CRC64
237229
"""
238230
return _COMBINE_FUNC(crc1, crc2, size)

alibabacloud_oss_v2/crypto/aes_ctr.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _iv_to_big_int(iv: bytes) -> int:
1717
return iv_big_int
1818

1919
class IteratorEncryptor():
20-
"""_summary_
20+
"""Iterator Encryptor
2121
"""
2222

2323
def __init__(
@@ -73,7 +73,7 @@ def __next__(self):
7373
raise err
7474

7575
class IterableEncryptor():
76-
"""_summary_
76+
"""Iterable Encryptor
7777
"""
7878

7979
def __init__(
@@ -93,7 +93,7 @@ def __iter__(self):
9393
counter=self._counter)
9494

9595
class FileLikeEncryptor():
96-
"""_summary_
96+
"""File Like Encryptor
9797
"""
9898
def __init__(
9999
self,
@@ -109,7 +109,7 @@ def __init__(
109109
self._offset = offset
110110

111111
def read(self, n: int = -1) -> AnyStr:
112-
"""_summary_
112+
"""read
113113
114114
Args:
115115
n (int, optional): _description_. Defaults to -1.
@@ -131,7 +131,7 @@ def read(self, n: int = -1) -> AnyStr:
131131
return self._cipher.encrypt(self._reader.read(n))
132132

133133
def seek(self, offset: int, whence: int = 0) -> int:
134-
"""_summary_
134+
"""seek
135135
136136
Args:
137137
offset (int): _description_
@@ -149,13 +149,13 @@ def seek(self, offset: int, whence: int = 0) -> int:
149149
return offset
150150

151151
def tell(self) -> int:
152-
"""_summary_
152+
"""tell
153153
"""
154154
return self._reader.tell()
155155

156156

157157
class StreamBodyDecryptor(StreamBody):
158-
"""_summary_
158+
"""Stream Body Decryptor
159159
"""
160160
def __init__(
161161
self,
@@ -219,13 +219,7 @@ def __init__(
219219
self.no_str = False
220220

221221
def encrypt(self, src: Any) -> Any:
222-
"""_summary_
223-
224-
Args:
225-
src (Any): _description_
226-
227-
Returns:
228-
Any: _description_
222+
"""encrypt data
229223
"""
230224
if not self.no_str and isinstance(src, str):
231225
return self._get_cipher().encrypt(src.encode())
@@ -246,7 +240,7 @@ def encrypt(self, src: Any) -> Any:
246240
raise TypeError(f'src is not str/bytes/file-like/Iterable type, got {type(src)}')
247241

248242
def decrypt(self, src: Any) -> Any:
249-
"""_summary_
243+
"""decrypt data
250244
251245
Args:
252246
src (Any): _description_
@@ -268,7 +262,7 @@ def _get_cipher(self):
268262

269263
@staticmethod
270264
def random_key() -> bytes:
271-
"""_summary_
265+
"""random key
272266
273267
Returns:
274268
bytes: _description_
@@ -277,7 +271,7 @@ def random_key() -> bytes:
277271

278272
@staticmethod
279273
def random_iv() -> bytes:
280-
"""_summary_
274+
"""random iv
281275
282276
Returns:
283277
bytes: _description_

alibabacloud_oss_v2/crypto/aes_ctr_cipher.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ def __init__(
1919
self._cipher = _AesCtr(cipher_data, offset)
2020

2121
def encrypt_content(self, data: Any) -> Any:
22-
"""_summary_
22+
"""encrypt content
2323
"""
2424
return self._cipher.encrypt(data)
2525

2626
def decrypt_content(self, data: Any) -> Any:
27-
"""_summary_
27+
"""decrypt content
2828
"""
2929
reader = self._cipher.decrypt(data)
3030
return reader
3131

3232
def clone(self, **kwargs) -> ContentCipher:
33-
"""_summary_
33+
"""clone
3434
"""
3535
return _AESCtrCipher(
3636
cipher_data=self._cipher_data,
@@ -50,7 +50,7 @@ def get_align_len(self) -> int:
5050

5151

5252
class AESCtrCipherBuilder(ContentCipherBuilder):
53-
"""_summary_
53+
"""AES Ctr Cipher Builder
5454
5555
Args:
5656
ContentCipherBuilder (_type_): _description_

alibabacloud_oss_v2/crypto/cipher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Encrypter(abc.ABC):
66

77
@abc.abstractmethod
88
def encrypt(self, reader: Any) -> Any:
9-
"""_summary_
9+
"""encrypt
1010
"""
1111

1212

@@ -15,9 +15,9 @@ class Decrypter(abc.ABC):
1515

1616
@abc.abstractmethod
1717
def decrypt(self, reader: Any) -> Any:
18-
"""_summary_
18+
"""decrypt
1919
"""
2020

2121
class Cipher(Encrypter, Decrypter):
22-
"""_summary_
22+
"""Cipher
2323
"""

0 commit comments

Comments
 (0)