rclone-api 1.0.30__tar.gz → 1.0.32__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.30 → rclone_api-1.0.32}/PKG-INFO +1 -1
  2. {rclone_api-1.0.30 → rclone_api-1.0.32}/pyproject.toml +1 -1
  3. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/rclone.py +47 -2
  4. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/util.py +7 -5
  5. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/PKG-INFO +1 -1
  6. {rclone_api-1.0.30 → rclone_api-1.0.32}/.aiderignore +0 -0
  7. {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/lint.yml +0 -0
  8. {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/push_macos.yml +0 -0
  9. {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/push_ubuntu.yml +0 -0
  10. {rclone_api-1.0.30 → rclone_api-1.0.32}/.github/workflows/push_win.yml +0 -0
  11. {rclone_api-1.0.30 → rclone_api-1.0.32}/.gitignore +0 -0
  12. {rclone_api-1.0.30 → rclone_api-1.0.32}/.pylintrc +0 -0
  13. {rclone_api-1.0.30 → rclone_api-1.0.32}/.vscode/launch.json +0 -0
  14. {rclone_api-1.0.30 → rclone_api-1.0.32}/.vscode/settings.json +0 -0
  15. {rclone_api-1.0.30 → rclone_api-1.0.32}/.vscode/tasks.json +0 -0
  16. {rclone_api-1.0.30 → rclone_api-1.0.32}/LICENSE +0 -0
  17. {rclone_api-1.0.30 → rclone_api-1.0.32}/MANIFEST.in +0 -0
  18. {rclone_api-1.0.30 → rclone_api-1.0.32}/README.md +0 -0
  19. {rclone_api-1.0.30 → rclone_api-1.0.32}/clean +0 -0
  20. {rclone_api-1.0.30 → rclone_api-1.0.32}/install +0 -0
  21. {rclone_api-1.0.30 → rclone_api-1.0.32}/lint +0 -0
  22. {rclone_api-1.0.30 → rclone_api-1.0.32}/requirements.testing.txt +0 -0
  23. {rclone_api-1.0.30 → rclone_api-1.0.32}/setup.cfg +0 -0
  24. {rclone_api-1.0.30 → rclone_api-1.0.32}/setup.py +0 -0
  25. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/__init__.py +0 -0
  26. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/assets/example.txt +0 -0
  27. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/cli.py +0 -0
  28. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/cmd/list_files.py +0 -0
  29. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/config.py +0 -0
  30. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/convert.py +0 -0
  31. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/diff.py +0 -0
  32. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/dir.py +0 -0
  33. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/dir_listing.py +0 -0
  34. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/exec.py +0 -0
  35. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/file.py +0 -0
  36. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/filelist.py +0 -0
  37. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/process.py +0 -0
  38. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/remote.py +0 -0
  39. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/rpath.py +0 -0
  40. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api/walk.py +0 -0
  41. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/SOURCES.txt +0 -0
  42. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  43. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/entry_points.txt +0 -0
  44. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/requires.txt +0 -0
  45. {rclone_api-1.0.30 → rclone_api-1.0.32}/src/rclone_api.egg-info/top_level.txt +0 -0
  46. {rclone_api-1.0.30 → rclone_api-1.0.32}/test +0 -0
  47. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_cmd_list_files.py +0 -0
  48. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_copy.py +0 -0
  49. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_diff.py +0 -0
  50. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_is_synced.py +0 -0
  51. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_ls.py +0 -0
  52. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_mount.py +0 -0
  53. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_mount_s3.py +0 -0
  54. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_mount_webdav.py +0 -0
  55. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_obscure.py +0 -0
  56. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_remotes.py +0 -0
  57. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_serve_webdav.py +0 -0
  58. {rclone_api-1.0.30 → rclone_api-1.0.32}/tests/test_walk.py +0 -0
  59. {rclone_api-1.0.30 → rclone_api-1.0.32}/tox.ini +0 -0
  60. {rclone_api-1.0.30 → rclone_api-1.0.32}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.30
3
+ Version: 1.0.32
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.30"
18
+ version = "1.0.32"
19
19
 
20
20
  [tool.setuptools]
21
21
  package-dir = {"" = "src"}
@@ -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
@@ -228,8 +229,52 @@ 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
+ if len(payload) == 0:
233
+ return subprocess.CompletedProcess(
234
+ args=["rclone", "delete", "--files-from", "[]"],
235
+ returncode=0,
236
+ stdout="",
237
+ stderr="",
238
+ )
239
+
240
+ datalists: dict[str, list[str]] = {}
241
+
242
+ for f in payload:
243
+ remote, path = f.split(":", 1)
244
+ if "/" in path:
245
+ bucket, path = path.split("/", 1)
246
+ remote = f"{remote}:{bucket}"
247
+ else:
248
+ remote = f"{remote}:"
249
+ if remote not in datalists:
250
+ datalists[remote] = []
251
+ datalists[remote].append(path)
252
+
253
+ out: subprocess.CompletedProcess | None = None
254
+
255
+ for remote, files in datalists.items():
256
+ with TemporaryDirectory() as tmpdir:
257
+ include_files_txt = Path(tmpdir) / "include_files.txt"
258
+ include_files_txt.write_text("\n".join(files), encoding="utf-8")
259
+
260
+ print(include_files_txt)
261
+ cmd_list: list[str] = [
262
+ "delete",
263
+ remote,
264
+ "--files-from",
265
+ str(include_files_txt),
266
+ "--checkers",
267
+ "1000",
268
+ "--transfers",
269
+ "1000",
270
+ ]
271
+ out = self._run(cmd_list)
272
+ if out.returncode != 0:
273
+ print(out)
274
+ raise ValueError(f"Error deleting files: {out.stderr}")
275
+
276
+ assert out is not None
277
+ return out
233
278
 
234
279
  def exists(self, path: Dir | Remote | str | File) -> bool:
235
280
  """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.30
3
+ Version: 1.0.32
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