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