rclone-api 1.0.29__tar.gz → 1.0.31__tar.gz

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rclone-api might be problematic. Click here for more details.

Files changed (60) hide show
  1. {rclone_api-1.0.29 → rclone_api-1.0.31}/PKG-INFO +1 -1
  2. {rclone_api-1.0.29 → rclone_api-1.0.31}/pyproject.toml +1 -1
  3. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/diff.py +9 -0
  4. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/rclone.py +41 -3
  5. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/util.py +7 -5
  6. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api.egg-info/PKG-INFO +1 -1
  7. {rclone_api-1.0.29 → rclone_api-1.0.31}/.aiderignore +0 -0
  8. {rclone_api-1.0.29 → rclone_api-1.0.31}/.github/workflows/lint.yml +0 -0
  9. {rclone_api-1.0.29 → rclone_api-1.0.31}/.github/workflows/push_macos.yml +0 -0
  10. {rclone_api-1.0.29 → rclone_api-1.0.31}/.github/workflows/push_ubuntu.yml +0 -0
  11. {rclone_api-1.0.29 → rclone_api-1.0.31}/.github/workflows/push_win.yml +0 -0
  12. {rclone_api-1.0.29 → rclone_api-1.0.31}/.gitignore +0 -0
  13. {rclone_api-1.0.29 → rclone_api-1.0.31}/.pylintrc +0 -0
  14. {rclone_api-1.0.29 → rclone_api-1.0.31}/.vscode/launch.json +0 -0
  15. {rclone_api-1.0.29 → rclone_api-1.0.31}/.vscode/settings.json +0 -0
  16. {rclone_api-1.0.29 → rclone_api-1.0.31}/.vscode/tasks.json +0 -0
  17. {rclone_api-1.0.29 → rclone_api-1.0.31}/LICENSE +0 -0
  18. {rclone_api-1.0.29 → rclone_api-1.0.31}/MANIFEST.in +0 -0
  19. {rclone_api-1.0.29 → rclone_api-1.0.31}/README.md +0 -0
  20. {rclone_api-1.0.29 → rclone_api-1.0.31}/clean +0 -0
  21. {rclone_api-1.0.29 → rclone_api-1.0.31}/install +0 -0
  22. {rclone_api-1.0.29 → rclone_api-1.0.31}/lint +0 -0
  23. {rclone_api-1.0.29 → rclone_api-1.0.31}/requirements.testing.txt +0 -0
  24. {rclone_api-1.0.29 → rclone_api-1.0.31}/setup.cfg +0 -0
  25. {rclone_api-1.0.29 → rclone_api-1.0.31}/setup.py +0 -0
  26. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/__init__.py +0 -0
  27. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/assets/example.txt +0 -0
  28. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/cli.py +0 -0
  29. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/cmd/list_files.py +0 -0
  30. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/config.py +0 -0
  31. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/convert.py +0 -0
  32. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/dir.py +0 -0
  33. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/dir_listing.py +0 -0
  34. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/exec.py +0 -0
  35. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/file.py +0 -0
  36. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/filelist.py +0 -0
  37. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/process.py +0 -0
  38. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/remote.py +0 -0
  39. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/rpath.py +0 -0
  40. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api/walk.py +0 -0
  41. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api.egg-info/SOURCES.txt +0 -0
  42. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  43. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api.egg-info/entry_points.txt +0 -0
  44. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api.egg-info/requires.txt +0 -0
  45. {rclone_api-1.0.29 → rclone_api-1.0.31}/src/rclone_api.egg-info/top_level.txt +0 -0
  46. {rclone_api-1.0.29 → rclone_api-1.0.31}/test +0 -0
  47. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_cmd_list_files.py +0 -0
  48. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_copy.py +0 -0
  49. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_diff.py +0 -0
  50. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_is_synced.py +0 -0
  51. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_ls.py +0 -0
  52. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_mount.py +0 -0
  53. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_mount_s3.py +0 -0
  54. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_mount_webdav.py +0 -0
  55. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_obscure.py +0 -0
  56. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_remotes.py +0 -0
  57. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_serve_webdav.py +0 -0
  58. {rclone_api-1.0.29 → rclone_api-1.0.31}/tests/test_walk.py +0 -0
  59. {rclone_api-1.0.29 → rclone_api-1.0.31}/tox.ini +0 -0
  60. {rclone_api-1.0.29 → rclone_api-1.0.31}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.29
3
+ Version: 1.0.31
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.29"
18
+ version = "1.0.31"
19
19
 
20
20
  [tool.setuptools]
21
21
  package-dir = {"" = "src"}
@@ -32,6 +32,15 @@ class DiffItem:
32
32
  def __repr__(self) -> str:
33
33
  return f"{self.type.name} {self.path}"
34
34
 
35
+ def full_str(self) -> str:
36
+ return f"{self.type.name} {self.src_prefix}/{self.path} {self.dst_prefix}/{self.path}"
37
+
38
+ def dst_path(self) -> str:
39
+ return f"{self.dst_prefix}/{self.path}"
40
+
41
+ def src_path(self) -> str:
42
+ return f"{self.src_prefix}/{self.path}"
43
+
35
44
 
36
45
  def _classify_diff(line: str, src_slug: str, dst_slug: str) -> DiffItem | None:
37
46
  def _new(type: DiffType, path: str) -> DiffItem:
@@ -9,6 +9,7 @@ from concurrent.futures import ThreadPoolExecutor
9
9
  from enum import Enum
10
10
  from fnmatch import fnmatch
11
11
  from pathlib import Path
12
+ from tempfile import TemporaryDirectory
12
13
  from typing import Generator
13
14
 
14
15
  from rclone_api import Dir
@@ -125,7 +126,7 @@ class Rclone:
125
126
  ]
126
127
  proc = self._launch_process(cmd, capture=True)
127
128
  item: DiffItem
128
- for item in diff_stream_from_running_process(proc, src_slug=src, dst_slug=src):
129
+ for item in diff_stream_from_running_process(proc, src_slug=src, dst_slug=dst):
129
130
  if item is None:
130
131
  break
131
132
  yield item
@@ -228,8 +229,45 @@ class Rclone:
228
229
  ) -> subprocess.CompletedProcess:
229
230
  """Delete a directory"""
230
231
  payload: list[str] = convert_to_filestr_list(files)
231
- cmd_list: list[str] = ["delete"] + payload
232
- return self._run(cmd_list)
232
+
233
+ datalists: dict[str, list[str]] = {}
234
+
235
+ for f in payload:
236
+ remote, path = f.split(":", 1)
237
+ if "/" in path:
238
+ bucket, path = path.split("/", 1)
239
+ remote = f"{remote}:{bucket}"
240
+ else:
241
+ remote = f"{remote}:"
242
+ if remote not in datalists:
243
+ datalists[remote] = []
244
+ datalists[remote].append(path)
245
+
246
+ out: subprocess.CompletedProcess | None = None
247
+
248
+ for remote, files in datalists.items():
249
+ with TemporaryDirectory() as tmpdir:
250
+ include_files_txt = Path(tmpdir) / "include_files.txt"
251
+ include_files_txt.write_text("\n".join(files), encoding="utf-8")
252
+
253
+ print(include_files_txt)
254
+ cmd_list: list[str] = [
255
+ "delete",
256
+ remote,
257
+ "--files-from",
258
+ str(include_files_txt),
259
+ "--checkers",
260
+ "1000",
261
+ "--transfers",
262
+ "1000",
263
+ ]
264
+ out = self._run(cmd_list)
265
+ if out.returncode != 0:
266
+ print(out)
267
+ raise ValueError(f"Error deleting files: {out.stderr}")
268
+
269
+ assert out is not None
270
+ return out
233
271
 
234
272
  def exists(self, path: Dir | Remote | str | File) -> bool:
235
273
  """Check if a file or directory exists."""
@@ -2,6 +2,7 @@ import os
2
2
  import shutil
3
3
  import subprocess
4
4
  import time
5
+ import warnings
5
6
  from pathlib import Path
6
7
  from tempfile import TemporaryDirectory
7
8
  from typing import Any
@@ -96,16 +97,17 @@ def rclone_execute(
96
97
  cmd_str = subprocess.list2cmdline(cmd)
97
98
  print(f"Running: {cmd_str}")
98
99
  cp = subprocess.run(
99
- cmd, capture_output=True, encoding="utf-8", check=check, shell=False
100
+ cmd, capture_output=True, encoding="utf-8", check=False, shell=False
100
101
  )
101
102
  if cp.returncode != 0:
102
103
  cmd_str = subprocess.list2cmdline(cmd)
103
- print(
104
+ warnings.warn(
104
105
  f"Error running: {cmd_str}, returncode: {cp.returncode}\n{cp.stdout}\n{cp.stderr}"
105
106
  )
106
- raise subprocess.CalledProcessError(
107
- cp.returncode, cmd, cp.stdout, cp.stderr
108
- )
107
+ if check:
108
+ raise subprocess.CalledProcessError(
109
+ cp.returncode, cmd, cp.stdout, cp.stderr
110
+ )
109
111
  return cp
110
112
  finally:
111
113
  if tempdir:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.29
3
+ Version: 1.0.31
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