rclone-api 1.1.21__py2.py3-none-any.whl → 1.1.22__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -205,6 +205,8 @@ class UploadState:
205
205
  return num_chunks - count
206
206
 
207
207
  def add_finished(self, part: FinishedPiece | None) -> None:
208
+ if part is None:
209
+ return
208
210
  with self.lock:
209
211
  self.parts.append(part)
210
212
  self._save_no_lock()
@@ -1,5 +1,6 @@
1
1
  import _thread
2
2
  import os
3
+ import traceback
3
4
  import warnings
4
5
  from concurrent.futures import ThreadPoolExecutor
5
6
  from pathlib import Path
@@ -50,18 +51,24 @@ def upload_task(
50
51
 
51
52
  def handle_upload(
52
53
  upload_info: UploadInfo, file_chunk: FileChunk | None
53
- ) -> FinishedPiece | None:
54
+ ) -> FinishedPiece | Exception | None:
54
55
  if file_chunk is None:
55
56
  return None
56
57
  chunk, part_number = file_chunk.data, file_chunk.part_number
57
- part: FinishedPiece = upload_task(
58
- info=upload_info,
59
- chunk=chunk,
60
- part_number=part_number,
61
- retries=upload_info.retries,
62
- )
63
- file_chunk.close()
64
- return part
58
+ try:
59
+ part: FinishedPiece = upload_task(
60
+ info=upload_info,
61
+ chunk=chunk,
62
+ part_number=part_number,
63
+ retries=upload_info.retries,
64
+ )
65
+ file_chunk.close()
66
+ return part
67
+ except Exception as e:
68
+ stacktrace = traceback.format_exc()
69
+ msg = f"Error uploading part {part_number}: {e}\n{stacktrace}"
70
+ warnings.warn(msg)
71
+ return e
65
72
 
66
73
 
67
74
  def prepare_upload_file_multipart(
@@ -227,16 +234,15 @@ def upload_file_multipart(
227
234
  break
228
235
 
229
236
  def task(upload_info=upload_info, file_chunk=file_chunk):
230
- try:
231
- return handle_upload(upload_info, file_chunk)
232
- except Exception:
233
- _thread.interrupt_main()
234
- raise
237
+ return handle_upload(upload_info, file_chunk)
235
238
 
236
239
  fut = executor.submit(task)
237
240
 
238
241
  def done_cb(fut=fut):
239
242
  result = fut.result()
243
+ if isinstance(result, Exception):
244
+ warnings.warn(f"Error uploading part: {result}, skipping")
245
+ return
240
246
  # upload_state.finished_parts.put(result)
241
247
  upload_state.add_finished(result)
242
248
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.1.21
3
+ Version: 1.1.22
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: pyright>=1.1.393
13
13
  Requires-Dist: python-dotenv>=1.0.0
14
+ Requires-Dist: certifi>=2025.1.31
14
15
  Requires-Dist: boto3<=1.35.99,>=1.20.1
15
16
  Dynamic: home-page
16
17
 
@@ -28,13 +28,13 @@ rclone_api/experimental/flags_base.py,sha256=ajU_czkTcAxXYU-SlmiCfHY7aCQGHvpCLqJ
28
28
  rclone_api/s3/api.py,sha256=VstlaEnBjO2JDQuCRLdTfUGvQLbfshlXXhAzimFv4Vc,3763
29
29
  rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,2104
30
30
  rclone_api/s3/chunk_file.py,sha256=YELR-EzR7RHpzCDGpYdzlwu21NZW5wttIDvLoONI4aU,3477
31
- rclone_api/s3/chunk_types.py,sha256=mIlbHmxMJxmHVN4yuQ0MdzpCQfwq2a4YsHX0Q18ri2Q,10272
32
- rclone_api/s3/chunk_uploader.py,sha256=7Qumc2emQ-SpbnTL8PBN4ElpghnFWJfozVHPhm6LrQ4,9683
31
+ rclone_api/s3/chunk_types.py,sha256=LbXayXY1KgVU1LkdbASD_BQ7TpVpwVnzMjtz--8LBaE,10316
32
+ rclone_api/s3/chunk_uploader.py,sha256=1jQAdk35Fa9Tcq36bS65262cs7AcNG2DAFQ-NdYlWSw,9961
33
33
  rclone_api/s3/create.py,sha256=CN-wdH2boszcN0HiCHoJjiNnhJ0UoJ-QLAA5xbsfU-Q,3151
34
34
  rclone_api/s3/types.py,sha256=yBnJ38Tjk6RlydJ-sqZ7DSfyFloy8KDYJ0mv3vlOzLE,1388
35
- rclone_api-1.1.21.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
36
- rclone_api-1.1.21.dist-info/METADATA,sha256=nE9TudtYvF26phpj75IFdSlf-subt1zfg2jk4v_jnGQ,4479
37
- rclone_api-1.1.21.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
38
- rclone_api-1.1.21.dist-info/entry_points.txt,sha256=6eNqTRXKhVf8CpWNjXiOa_0Du9tHiW_HD2iQSXRsUg8,132
39
- rclone_api-1.1.21.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
40
- rclone_api-1.1.21.dist-info/RECORD,,
35
+ rclone_api-1.1.22.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
36
+ rclone_api-1.1.22.dist-info/METADATA,sha256=RV2Zt9LIzAjvYfIfkCMaZz3t2PlWcv0R6v46-P_FNrM,4514
37
+ rclone_api-1.1.22.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
38
+ rclone_api-1.1.22.dist-info/entry_points.txt,sha256=6eNqTRXKhVf8CpWNjXiOa_0Du9tHiW_HD2iQSXRsUg8,132
39
+ rclone_api-1.1.22.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
40
+ rclone_api-1.1.22.dist-info/RECORD,,