rclone-api 1.0.57__tar.gz → 1.0.59__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.57 → rclone_api-1.0.59}/PKG-INFO +1 -1
  2. {rclone_api-1.0.57 → rclone_api-1.0.59}/pyproject.toml +1 -1
  3. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/dir.py +2 -2
  4. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/rclone.py +33 -5
  5. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/walk.py +14 -8
  6. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api.egg-info/PKG-INFO +1 -1
  7. {rclone_api-1.0.57 → rclone_api-1.0.59}/.aiderignore +0 -0
  8. {rclone_api-1.0.57 → rclone_api-1.0.59}/.github/workflows/lint.yml +0 -0
  9. {rclone_api-1.0.57 → rclone_api-1.0.59}/.github/workflows/push_macos.yml +0 -0
  10. {rclone_api-1.0.57 → rclone_api-1.0.59}/.github/workflows/push_ubuntu.yml +0 -0
  11. {rclone_api-1.0.57 → rclone_api-1.0.59}/.github/workflows/push_win.yml +0 -0
  12. {rclone_api-1.0.57 → rclone_api-1.0.59}/.gitignore +0 -0
  13. {rclone_api-1.0.57 → rclone_api-1.0.59}/.pylintrc +0 -0
  14. {rclone_api-1.0.57 → rclone_api-1.0.59}/.vscode/launch.json +0 -0
  15. {rclone_api-1.0.57 → rclone_api-1.0.59}/.vscode/settings.json +0 -0
  16. {rclone_api-1.0.57 → rclone_api-1.0.59}/.vscode/tasks.json +0 -0
  17. {rclone_api-1.0.57 → rclone_api-1.0.59}/LICENSE +0 -0
  18. {rclone_api-1.0.57 → rclone_api-1.0.59}/MANIFEST.in +0 -0
  19. {rclone_api-1.0.57 → rclone_api-1.0.59}/README.md +0 -0
  20. {rclone_api-1.0.57 → rclone_api-1.0.59}/clean +0 -0
  21. {rclone_api-1.0.57 → rclone_api-1.0.59}/install +0 -0
  22. {rclone_api-1.0.57 → rclone_api-1.0.59}/lint +0 -0
  23. {rclone_api-1.0.57 → rclone_api-1.0.59}/requirements.testing.txt +0 -0
  24. {rclone_api-1.0.57 → rclone_api-1.0.59}/setup.cfg +0 -0
  25. {rclone_api-1.0.57 → rclone_api-1.0.59}/setup.py +0 -0
  26. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/__init__.py +0 -0
  27. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/assets/example.txt +0 -0
  28. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/cli.py +0 -0
  29. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/cmd/list_files.py +0 -0
  30. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/completed_process.py +0 -0
  31. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/config.py +0 -0
  32. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/convert.py +0 -0
  33. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/deprecated.py +0 -0
  34. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/diff.py +0 -0
  35. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/dir_listing.py +0 -0
  36. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/exec.py +0 -0
  37. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/file.py +0 -0
  38. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/filelist.py +0 -0
  39. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/group_files.py +0 -0
  40. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/process.py +0 -0
  41. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/remote.py +0 -0
  42. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/rpath.py +0 -0
  43. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api/util.py +0 -0
  44. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api.egg-info/SOURCES.txt +0 -0
  45. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  46. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api.egg-info/entry_points.txt +0 -0
  47. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api.egg-info/requires.txt +0 -0
  48. {rclone_api-1.0.57 → rclone_api-1.0.59}/src/rclone_api.egg-info/top_level.txt +0 -0
  49. {rclone_api-1.0.57 → rclone_api-1.0.59}/test +0 -0
  50. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_cmd_list_files.py +0 -0
  51. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_copy.py +0 -0
  52. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_copy_files.py +0 -0
  53. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_diff.py +0 -0
  54. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_group_files.py +0 -0
  55. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_is_synced.py +0 -0
  56. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_ls.py +0 -0
  57. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_mount.py +0 -0
  58. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_mount_s3.py +0 -0
  59. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_mount_webdav.py +0 -0
  60. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_obscure.py +0 -0
  61. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_remote_control.py +0 -0
  62. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_remotes.py +0 -0
  63. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_serve_webdav.py +0 -0
  64. {rclone_api-1.0.57 → rclone_api-1.0.59}/tests/test_walk.py +0 -0
  65. {rclone_api-1.0.57 → rclone_api-1.0.59}/tox.ini +0 -0
  66. {rclone_api-1.0.57 → rclone_api-1.0.59}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.57
3
+ Version: 1.0.59
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.57"
18
+ version = "1.0.59"
19
19
 
20
20
  [tool.setuptools]
21
21
  package-dir = {"" = "src"}
@@ -41,11 +41,11 @@ class Dir:
41
41
  # self.path.set_rclone(self.path.remote.rclone)
42
42
  assert self.path.rclone is not None
43
43
 
44
- def ls(self, max_depth: int = 0) -> DirListing:
44
+ def ls(self, max_depth: int = 0, reverse: bool = False) -> DirListing:
45
45
  """List files and directories in the given path."""
46
46
  assert self.path.rclone is not None
47
47
  dir = Dir(self.path)
48
- return self.path.rclone.ls(dir, max_depth=max_depth)
48
+ return self.path.rclone.ls(dir, max_depth=max_depth, reverse=reverse)
49
49
 
50
50
  def walk(
51
51
  self, breadth_first: bool, max_depth: int = -1
@@ -72,7 +72,7 @@ class Rclone:
72
72
 
73
73
  def launch_server(
74
74
  self,
75
- addr: str | None = None,
75
+ addr: str,
76
76
  user: str | None = None,
77
77
  password: str | None = None,
78
78
  other_args: list[str] | None = None,
@@ -122,6 +122,7 @@ class Rclone:
122
122
  path: Dir | Remote | str,
123
123
  max_depth: int | None = None,
124
124
  glob: str | None = None,
125
+ reverse: bool = False,
125
126
  ) -> DirListing:
126
127
  """List files in the given path.
127
128
 
@@ -162,6 +163,9 @@ class Rclone:
162
163
  # do we have a glob pattern?
163
164
  if glob is not None:
164
165
  paths = [p for p in paths if fnmatch(p.path, glob)]
166
+
167
+ if reverse:
168
+ paths.reverse()
165
169
  return DirListing(paths)
166
170
 
167
171
  def listremotes(self) -> list[Remote]:
@@ -175,9 +179,21 @@ class Rclone:
175
179
  out = [Remote(name=t, rclone=self) for t in tmp]
176
180
  return out
177
181
 
178
- def diff(self, src: str, dst: str) -> Generator[DiffItem, None, None]:
182
+ def diff(
183
+ self,
184
+ src: str,
185
+ dst: str,
186
+ min_size: (
187
+ str | None
188
+ ) = None, # e. g. "1MB" - see rclone documentation: https://rclone.org/commands/rclone_check/
189
+ max_size: (
190
+ str | None
191
+ ) = None, # e. g. "1GB" - see rclone documentation: https://rclone.org/commands/rclone_check/
192
+ other_args: list[str] | None = None,
193
+ ) -> Generator[DiffItem, None, None]:
179
194
  """Be extra careful with the src and dst values. If you are off by one
180
195
  parent directory, you will get a huge amount of false diffs."""
196
+ other_args = other_args or []
181
197
  cmd = [
182
198
  "check",
183
199
  src,
@@ -189,6 +205,12 @@ class Rclone:
189
205
  "--combined",
190
206
  "-",
191
207
  ]
208
+ if min_size:
209
+ cmd += ["--min-size", min_size]
210
+ if max_size:
211
+ cmd += ["--max-size", max_size]
212
+ if other_args:
213
+ cmd += other_args
192
214
  proc = self._launch_process(cmd, capture=True)
193
215
  item: DiffItem
194
216
  for item in diff_stream_from_running_process(proc, src_slug=src, dst_slug=dst):
@@ -197,7 +219,11 @@ class Rclone:
197
219
  yield item
198
220
 
199
221
  def walk(
200
- self, path: Dir | Remote | str, max_depth: int = -1, breadth_first: bool = True
222
+ self,
223
+ path: Dir | Remote | str,
224
+ max_depth: int = -1,
225
+ breadth_first: bool = True,
226
+ reverse: bool = False,
201
227
  ) -> Generator[DirListing, None, None]:
202
228
  """Walk through the given path recursively.
203
229
 
@@ -231,7 +257,9 @@ class Rclone:
231
257
  dir_obj = Dir(path) # shut up pyright
232
258
  assert f"Invalid type for path: {type(path)}"
233
259
 
234
- yield from walk(dir_obj, max_depth=max_depth, breadth_first=breadth_first)
260
+ yield from walk(
261
+ dir_obj, max_depth=max_depth, breadth_first=breadth_first, reverse=reverse
262
+ )
235
263
 
236
264
  def cleanup(
237
265
  self, path: str, other_args: list[str] | None = None
@@ -284,7 +312,7 @@ class Rclone:
284
312
  Args:
285
313
  payload: Dictionary of source and destination file paths
286
314
  """
287
- max_partition_workers = max_partition_workers or 8
315
+ max_partition_workers = max_partition_workers or 1
288
316
  low_level_retries = low_level_retries or 10
289
317
  retries = retries or 3
290
318
  other_args = other_args or []
@@ -10,14 +10,17 @@ _MAX_OUT_QUEUE_SIZE = 50
10
10
 
11
11
 
12
12
  def _walk_runner_breadth_first(
13
- dir: Dir, max_depth: int, out_queue: Queue[DirListing | None]
13
+ dir: Dir,
14
+ max_depth: int,
15
+ out_queue: Queue[DirListing | None],
16
+ reverse: bool = False,
14
17
  ) -> None:
15
18
  queue: Queue[Dir] = Queue()
16
19
  queue.put(dir)
17
20
  try:
18
21
  while not queue.empty():
19
22
  current_dir = queue.get()
20
- dirlisting = current_dir.ls()
23
+ dirlisting = current_dir.ls(max_depth=0, reverse=reverse)
21
24
  out_queue.put(dirlisting)
22
25
  dirs = dirlisting.dirs
23
26
 
@@ -38,20 +41,22 @@ def _walk_runner_breadth_first(
38
41
 
39
42
 
40
43
  def _walk_runner_depth_first(
41
- dir: Dir, max_depth: int, out_queue: Queue[DirListing | None]
44
+ dir: Dir, max_depth: int, out_queue: Queue[DirListing | None], reverse=False
42
45
  ) -> None:
43
46
  try:
44
47
  stack = [(dir, max_depth)]
45
48
  while stack:
46
49
  current_dir, depth = stack.pop()
47
50
  dirlisting = current_dir.ls()
51
+ if reverse:
52
+ dirlisting.dirs.reverse()
48
53
  if depth != 0:
49
- for subdir in reversed(
50
- dirlisting.dirs
51
- ): # Process deeper directories first
54
+ for subdir in dirlisting.dirs: # Process deeper directories first
52
55
  # stack.append((child, depth - 1 if depth > 0 else depth))
53
56
  next_depth = depth - 1 if depth > 0 else depth
54
- _walk_runner_depth_first(subdir, next_depth, out_queue)
57
+ _walk_runner_depth_first(
58
+ subdir, next_depth, out_queue, reverse=reverse
59
+ )
55
60
  out_queue.put(dirlisting)
56
61
  out_queue.put(None)
57
62
  except KeyboardInterrupt:
@@ -65,6 +70,7 @@ def walk(
65
70
  dir: Dir | Remote,
66
71
  breadth_first: bool,
67
72
  max_depth: int = -1,
73
+ reverse: bool = False,
68
74
  ) -> Generator[DirListing, None, None]:
69
75
  """Walk through the given directory recursively.
70
76
 
@@ -88,7 +94,7 @@ def walk(
88
94
  # Start worker thread
89
95
  worker = Thread(
90
96
  target=strategy,
91
- args=(dir, max_depth, out_queue),
97
+ args=(dir, max_depth, out_queue, reverse),
92
98
  daemon=True,
93
99
  )
94
100
  worker.start()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.57
3
+ Version: 1.0.59
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