rclone-api 1.0.56__tar.gz → 1.0.57__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. {rclone_api-1.0.56 → rclone_api-1.0.57}/PKG-INFO +1 -1
  2. {rclone_api-1.0.56 → rclone_api-1.0.57}/pyproject.toml +1 -1
  3. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/rclone.py +111 -100
  4. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api.egg-info/PKG-INFO +1 -1
  5. {rclone_api-1.0.56 → rclone_api-1.0.57}/.aiderignore +0 -0
  6. {rclone_api-1.0.56 → rclone_api-1.0.57}/.github/workflows/lint.yml +0 -0
  7. {rclone_api-1.0.56 → rclone_api-1.0.57}/.github/workflows/push_macos.yml +0 -0
  8. {rclone_api-1.0.56 → rclone_api-1.0.57}/.github/workflows/push_ubuntu.yml +0 -0
  9. {rclone_api-1.0.56 → rclone_api-1.0.57}/.github/workflows/push_win.yml +0 -0
  10. {rclone_api-1.0.56 → rclone_api-1.0.57}/.gitignore +0 -0
  11. {rclone_api-1.0.56 → rclone_api-1.0.57}/.pylintrc +0 -0
  12. {rclone_api-1.0.56 → rclone_api-1.0.57}/.vscode/launch.json +0 -0
  13. {rclone_api-1.0.56 → rclone_api-1.0.57}/.vscode/settings.json +0 -0
  14. {rclone_api-1.0.56 → rclone_api-1.0.57}/.vscode/tasks.json +0 -0
  15. {rclone_api-1.0.56 → rclone_api-1.0.57}/LICENSE +0 -0
  16. {rclone_api-1.0.56 → rclone_api-1.0.57}/MANIFEST.in +0 -0
  17. {rclone_api-1.0.56 → rclone_api-1.0.57}/README.md +0 -0
  18. {rclone_api-1.0.56 → rclone_api-1.0.57}/clean +0 -0
  19. {rclone_api-1.0.56 → rclone_api-1.0.57}/install +0 -0
  20. {rclone_api-1.0.56 → rclone_api-1.0.57}/lint +0 -0
  21. {rclone_api-1.0.56 → rclone_api-1.0.57}/requirements.testing.txt +0 -0
  22. {rclone_api-1.0.56 → rclone_api-1.0.57}/setup.cfg +0 -0
  23. {rclone_api-1.0.56 → rclone_api-1.0.57}/setup.py +0 -0
  24. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/__init__.py +0 -0
  25. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/assets/example.txt +0 -0
  26. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/cli.py +0 -0
  27. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/cmd/list_files.py +0 -0
  28. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/completed_process.py +0 -0
  29. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/config.py +0 -0
  30. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/convert.py +0 -0
  31. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/deprecated.py +0 -0
  32. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/diff.py +0 -0
  33. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/dir.py +0 -0
  34. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/dir_listing.py +0 -0
  35. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/exec.py +0 -0
  36. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/file.py +0 -0
  37. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/filelist.py +0 -0
  38. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/group_files.py +0 -0
  39. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/process.py +0 -0
  40. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/remote.py +0 -0
  41. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/rpath.py +0 -0
  42. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/util.py +0 -0
  43. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api/walk.py +0 -0
  44. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api.egg-info/SOURCES.txt +0 -0
  45. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  46. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api.egg-info/entry_points.txt +0 -0
  47. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api.egg-info/requires.txt +0 -0
  48. {rclone_api-1.0.56 → rclone_api-1.0.57}/src/rclone_api.egg-info/top_level.txt +0 -0
  49. {rclone_api-1.0.56 → rclone_api-1.0.57}/test +0 -0
  50. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_cmd_list_files.py +0 -0
  51. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_copy.py +0 -0
  52. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_copy_files.py +0 -0
  53. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_diff.py +0 -0
  54. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_group_files.py +0 -0
  55. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_is_synced.py +0 -0
  56. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_ls.py +0 -0
  57. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_mount.py +0 -0
  58. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_mount_s3.py +0 -0
  59. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_mount_webdav.py +0 -0
  60. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_obscure.py +0 -0
  61. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_remote_control.py +0 -0
  62. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_remotes.py +0 -0
  63. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_serve_webdav.py +0 -0
  64. {rclone_api-1.0.56 → rclone_api-1.0.57}/tests/test_walk.py +0 -0
  65. {rclone_api-1.0.56 → rclone_api-1.0.57}/tox.ini +0 -0
  66. {rclone_api-1.0.56 → rclone_api-1.0.57}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.56
3
+ Version: 1.0.57
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
@@ -15,7 +15,7 @@ dependencies = [
15
15
  "python-dotenv>=1.0.0",
16
16
  ]
17
17
  # Change this with the version number bump.
18
- version = "1.0.56"
18
+ version = "1.0.57"
19
19
 
20
20
  [tool.setuptools]
21
21
  package-dir = {"" = "src"}
@@ -34,8 +34,6 @@ from rclone_api.util import (
34
34
  )
35
35
  from rclone_api.walk import walk
36
36
 
37
- EXECUTOR = ThreadPoolExecutor(16)
38
-
39
37
 
40
38
  def rclone_verbose(verbose: bool | None) -> bool:
41
39
  if verbose is not None:
@@ -276,6 +274,9 @@ class Rclone:
276
274
  verbose: bool | None = None,
277
275
  checkers: int | None = None,
278
276
  transfers: int | None = None,
277
+ low_level_retries: int | None = None,
278
+ retries: int | None = None,
279
+ max_partition_workers: int | None = None,
279
280
  other_args: list[str] | None = None,
280
281
  ) -> list[CompletedProcess]:
281
282
  """Copy multiple files from source to destination.
@@ -283,6 +284,9 @@ class Rclone:
283
284
  Args:
284
285
  payload: Dictionary of source and destination file paths
285
286
  """
287
+ max_partition_workers = max_partition_workers or 8
288
+ low_level_retries = low_level_retries or 10
289
+ retries = retries or 3
286
290
  other_args = other_args or []
287
291
  checkers = checkers or 1000
288
292
  transfers = transfers or 32
@@ -303,65 +307,69 @@ class Rclone:
303
307
 
304
308
  futures: list[Future] = []
305
309
 
306
- for common_prefix, files in datalists.items():
307
-
308
- def _task(files=files) -> subprocess.CompletedProcess:
309
-
310
- with TemporaryDirectory() as tmpdir:
311
- include_files_txt = Path(tmpdir) / "include_files.txt"
312
- include_files_txt.write_text("\n".join(files), encoding="utf-8")
313
- if common_prefix:
314
- src_path = f"{src}/{common_prefix}"
315
- dst_path = f"{dst}/{common_prefix}"
310
+ with ThreadPoolExecutor(max_workers=max_partition_workers) as executor:
311
+ for common_prefix, files in datalists.items():
312
+
313
+ def _task(files=files) -> subprocess.CompletedProcess:
314
+ with TemporaryDirectory() as tmpdir:
315
+ include_files_txt = Path(tmpdir) / "include_files.txt"
316
+ include_files_txt.write_text("\n".join(files), encoding="utf-8")
317
+ if common_prefix:
318
+ src_path = f"{src}/{common_prefix}"
319
+ dst_path = f"{dst}/{common_prefix}"
320
+ else:
321
+ src_path = src
322
+ dst_path = dst
323
+
324
+ if verbose:
325
+ nfiles = len(files)
326
+ files_fqdn = [f" {src_path}/{f}" for f in files]
327
+ print(f"Copying {nfiles} files:")
328
+ chunk_size = 100
329
+ for i in range(0, nfiles, chunk_size):
330
+ chunk = files_fqdn[i : i + chunk_size]
331
+ files_str = "\n".join(chunk)
332
+ print(f"{files_str}")
333
+ # files_str = "\n".join(files_fqdn)
334
+ # print(f"Copying {nfiles} files: \n{files_str}")
335
+
336
+ # print(include_files_txt)
337
+ cmd_list: list[str] = [
338
+ "copy",
339
+ src_path,
340
+ dst_path,
341
+ "--files-from",
342
+ str(include_files_txt),
343
+ "--checkers",
344
+ str(checkers),
345
+ "--transfers",
346
+ str(transfers),
347
+ "--low-level-retries",
348
+ str(low_level_retries),
349
+ "--retries",
350
+ str(retries),
351
+ ]
352
+ if verbose:
353
+ if not any(["-v" in x for x in other_args]):
354
+ cmd_list.append("-vvvv")
355
+ if not any(["--progress" in x for x in other_args]):
356
+ cmd_list.append("--progress")
357
+ if other_args:
358
+ cmd_list += other_args
359
+ out = self._run(cmd_list, capture=not verbose)
360
+ return out
361
+
362
+ fut: Future = executor.submit(_task)
363
+ futures.append(fut)
364
+ for fut in futures:
365
+ cp: subprocess.CompletedProcess = fut.result()
366
+ assert cp is not None
367
+ out.append(CompletedProcess.from_subprocess(cp))
368
+ if cp.returncode != 0:
369
+ if check:
370
+ raise ValueError(f"Error deleting files: {cp.stderr}")
316
371
  else:
317
- src_path = src
318
- dst_path = dst
319
-
320
- if verbose:
321
- nfiles = len(files)
322
- files_fqdn = [f" {src_path}/{f}" for f in files]
323
- print(f"Copying {nfiles} files:")
324
- chunk_size = 100
325
- for i in range(0, nfiles, chunk_size):
326
- chunk = files_fqdn[i : i + chunk_size]
327
- files_str = "\n".join(chunk)
328
- print(f"{files_str}")
329
- # files_str = "\n".join(files_fqdn)
330
- # print(f"Copying {nfiles} files: \n{files_str}")
331
-
332
- # print(include_files_txt)
333
- cmd_list: list[str] = [
334
- "copy",
335
- src_path,
336
- dst_path,
337
- "--files-from",
338
- str(include_files_txt),
339
- "--checkers",
340
- str(checkers),
341
- "--transfers",
342
- str(transfers),
343
- ]
344
- if verbose:
345
- if not any(["-v" in x for x in other_args]):
346
- cmd_list.append("-vvvv")
347
- if not any(["--progress" in x for x in other_args]):
348
- cmd_list.append("--progress")
349
- if other_args:
350
- cmd_list += other_args
351
- out = self._run(cmd_list, capture=not verbose)
352
- return out
353
-
354
- fut: Future = EXECUTOR.submit(_task)
355
- futures.append(fut)
356
- for fut in futures:
357
- cp: subprocess.CompletedProcess = fut.result()
358
- assert cp is not None
359
- out.append(CompletedProcess.from_subprocess(cp))
360
- if cp.returncode != 0:
361
- if check:
362
- raise ValueError(f"Error deleting files: {cp.stderr}")
363
- else:
364
- warnings.warn(f"Error deleting files: {cp.stderr}")
372
+ warnings.warn(f"Error deleting files: {cp.stderr}")
365
373
  return out
366
374
 
367
375
  def copy(self, src: Dir | str, dst: Dir | str) -> CompletedProcess:
@@ -393,6 +401,7 @@ class Rclone:
393
401
  check=True,
394
402
  rmdirs=False,
395
403
  verbose: bool | None = None,
404
+ max_partition_workers: int | None = None,
396
405
  other_args: list[str] | None = None,
397
406
  ) -> CompletedProcess:
398
407
  """Delete a directory"""
@@ -414,48 +423,50 @@ class Rclone:
414
423
 
415
424
  futures: list[Future] = []
416
425
 
417
- for remote, files in datalists.items():
418
-
419
- def _task(
420
- files=files, check=check, remote=remote
421
- ) -> subprocess.CompletedProcess:
422
- with TemporaryDirectory() as tmpdir:
423
- include_files_txt = Path(tmpdir) / "include_files.txt"
424
- include_files_txt.write_text("\n".join(files), encoding="utf-8")
425
-
426
- # print(include_files_txt)
427
- cmd_list: list[str] = [
428
- "delete",
429
- remote,
430
- "--files-from",
431
- str(include_files_txt),
432
- "--checkers",
433
- "1000",
434
- "--transfers",
435
- "1000",
436
- ]
437
- if verbose:
438
- cmd_list.append("-vvvv")
439
- if rmdirs:
440
- cmd_list.append("--rmdirs")
441
- if other_args:
442
- cmd_list += other_args
443
- out = self._run(cmd_list, check=check)
444
- if out.returncode != 0:
445
- if check:
446
- completed_processes.append(out)
447
- raise ValueError(f"Error deleting files: {out}")
448
- else:
449
- warnings.warn(f"Error deleting files: {out}")
450
- return out
426
+ with ThreadPoolExecutor(max_workers=max_partition_workers) as executor:
427
+
428
+ for remote, files in datalists.items():
429
+
430
+ def _task(
431
+ files=files, check=check, remote=remote
432
+ ) -> subprocess.CompletedProcess:
433
+ with TemporaryDirectory() as tmpdir:
434
+ include_files_txt = Path(tmpdir) / "include_files.txt"
435
+ include_files_txt.write_text("\n".join(files), encoding="utf-8")
436
+
437
+ # print(include_files_txt)
438
+ cmd_list: list[str] = [
439
+ "delete",
440
+ remote,
441
+ "--files-from",
442
+ str(include_files_txt),
443
+ "--checkers",
444
+ "1000",
445
+ "--transfers",
446
+ "1000",
447
+ ]
448
+ if verbose:
449
+ cmd_list.append("-vvvv")
450
+ if rmdirs:
451
+ cmd_list.append("--rmdirs")
452
+ if other_args:
453
+ cmd_list += other_args
454
+ out = self._run(cmd_list, check=check)
455
+ if out.returncode != 0:
456
+ if check:
457
+ completed_processes.append(out)
458
+ raise ValueError(f"Error deleting files: {out}")
459
+ else:
460
+ warnings.warn(f"Error deleting files: {out}")
461
+ return out
451
462
 
452
- fut: Future = EXECUTOR.submit(_task)
453
- futures.append(fut)
463
+ fut: Future = executor.submit(_task)
464
+ futures.append(fut)
454
465
 
455
- for fut in futures:
456
- out = fut.result()
457
- assert out is not None
458
- completed_processes.append(out)
466
+ for fut in futures:
467
+ out = fut.result()
468
+ assert out is not None
469
+ completed_processes.append(out)
459
470
 
460
471
  return CompletedProcess(completed_processes)
461
472
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.56
3
+ Version: 1.0.57
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes