rclone-api 1.0.72__py2.py3-none-any.whl → 1.0.75__py2.py3-none-any.whl

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.

rclone_api/diff.py CHANGED
@@ -126,19 +126,18 @@ def _async_diff_stream_from_running_process(
126
126
  except UnicodeDecodeError:
127
127
  print("UnicodeDecodeError")
128
128
  continue
129
- output.put(None)
130
129
  except KeyboardInterrupt:
131
130
  import _thread
132
131
 
133
132
  print("KeyboardInterrupt")
134
- output.put(None)
135
133
  _thread.interrupt_main()
136
134
  except Exception as e:
137
135
  import _thread
138
136
 
139
137
  print(f"Error: {e}")
140
- output.put(None)
141
138
  _thread.interrupt_main()
139
+ finally:
140
+ output.put(None)
142
141
 
143
142
 
144
143
  def diff_stream_from_running_process(
rclone_api/dir.py CHANGED
@@ -66,7 +66,7 @@ class Dir:
66
66
  self_path = Path(self.path.path)
67
67
  other_path = Path(other.path.path)
68
68
  rel_path = self_path.relative_to(other_path)
69
- return str(rel_path)
69
+ return str(rel_path.as_posix())
70
70
 
71
71
  def walk(
72
72
  self, breadth_first: bool, max_depth: int = -1
rclone_api/rclone.py CHANGED
@@ -349,11 +349,15 @@ class Rclone:
349
349
  dst: str,
350
350
  files: list[str] | Path,
351
351
  check: bool | None = None,
352
+ max_backlog: int | None = None,
352
353
  verbose: bool | None = None,
353
354
  checkers: int | None = None,
354
355
  transfers: int | None = None,
355
356
  low_level_retries: int | None = None,
356
357
  retries: int | None = None,
358
+ retries_sleep: str | None = None,
359
+ metadata: bool | None = None,
360
+ timeout: str | None = None,
357
361
  max_partition_workers: int | None = None,
358
362
  other_args: list[str] | None = None,
359
363
  ) -> list[CompletedProcess]:
@@ -444,6 +448,14 @@ class Rclone:
444
448
  "--retries",
445
449
  str(retries),
446
450
  ]
451
+ if metadata:
452
+ cmd_list.append("--metadata")
453
+ if retries_sleep is not None:
454
+ cmd_list += ["--retries-sleep", retries_sleep]
455
+ if timeout is not None:
456
+ cmd_list += ["--timeout", timeout]
457
+ if max_backlog is not None:
458
+ cmd_list += ["--max-backlog", str(max_backlog)]
447
459
  if verbose:
448
460
  if not any(["-v" in x for x in other_args]):
449
461
  cmd_list.append("-vvvv")
@@ -13,41 +13,59 @@ from rclone_api.walk import walk_runner_depth_first
13
13
  _MAX_OUT_QUEUE_SIZE = 50
14
14
 
15
15
 
16
+ def _reorder_inplace(data: list, order: Order) -> None:
17
+ if order == Order.NORMAL:
18
+ return
19
+ elif order == Order.REVERSE:
20
+ data.reverse()
21
+ return
22
+ elif order == Order.RANDOM:
23
+ random.shuffle(data)
24
+ return
25
+ else:
26
+ raise ValueError(f"Invalid order: {order}")
27
+
28
+
16
29
  # ONLY Works from src -> dst diffing.
17
30
  def _async_diff_dir_walk_task(
18
31
  src: Dir, dst: Dir, max_depth: int, out_queue: Queue[Dir | None], order: Order
19
32
  ) -> None:
20
- curr_src, curr_dst = src, dst
33
+ can_scan_two_deep = max_depth > 1 or max_depth == -1
34
+ ls_depth = 2 if can_scan_two_deep else 1
21
35
  with ThreadPoolExecutor(max_workers=2) as executor:
22
36
  t1 = executor.submit(
23
- src.ls, listing_option=ListingOption.DIRS_ONLY, order=order
37
+ src.ls,
38
+ listing_option=ListingOption.DIRS_ONLY,
39
+ order=order,
40
+ max_depth=ls_depth,
24
41
  )
25
42
  t2 = executor.submit(
26
- dst.ls, listing_option=ListingOption.DIRS_ONLY, order=order
43
+ dst.ls,
44
+ listing_option=ListingOption.DIRS_ONLY,
45
+ order=order,
46
+ max_depth=ls_depth,
27
47
  )
28
48
  src_dir_listing: DirListing = t1.result()
29
49
  dst_dir_listing: DirListing = t2.result()
30
- next_depth = max_depth - 1 if max_depth > 0 else max_depth
31
- dst_dirs: list[str] = [d.name for d in dst_dir_listing.dirs]
32
- src_dirs: list[str] = [d.name for d in src_dir_listing.dirs]
50
+ next_depth = max_depth - ls_depth if max_depth > 0 else max_depth
51
+ dst_dirs: list[str] = [d.relative_to(src) for d in dst_dir_listing.dirs]
52
+ src_dirs: list[str] = [d.relative_to(dst) for d in src_dir_listing.dirs]
33
53
  dst_files_set: set[str] = set(dst_dirs)
34
54
  matching_dirs: list[str] = []
35
- if order == Order.REVERSE:
36
- src_dirs.reverse()
37
- dst_dirs.reverse()
38
- elif order == Order.RANDOM:
39
- random.shuffle(src_dirs)
40
- random.shuffle(dst_dirs)
41
- for file in src_dirs:
42
- if file not in dst_files_set:
55
+ _reorder_inplace(src_dirs, order)
56
+ _reorder_inplace(dst_dirs, order)
57
+ for i, src_dir in enumerate(src_dirs):
58
+ src_dir_dir = src / src_dir
59
+ if src_dir not in dst_files_set:
43
60
  queue_dir_listing: Queue[DirListing | None] = Queue()
44
61
  if next_depth > 0 or next_depth == -1:
45
62
  walk_runner_depth_first(
46
- dir=curr_src,
63
+ dir=src_dir_dir,
47
64
  out_queue=queue_dir_listing,
48
65
  order=order,
49
66
  max_depth=next_depth,
50
67
  )
68
+ out_queue.put(src)
51
69
  while dirlisting := queue_dir_listing.get():
52
70
  if dirlisting is None:
53
71
  break
@@ -55,13 +73,13 @@ def _async_diff_dir_walk_task(
55
73
  for d in dirlisting.dirs:
56
74
  out_queue.put(d)
57
75
  else:
58
- matching_dirs.append(file)
76
+ matching_dirs.append(src_dir)
59
77
 
60
78
  for matching_dir in matching_dirs:
61
79
  # print(f"matching dir: {matching_dir}")
62
80
  if next_depth > 0 or next_depth == -1:
63
- src_next = curr_src / matching_dir
64
- dst_next = curr_dst / matching_dir
81
+ src_next = src / matching_dir
82
+ dst_next = dst / matching_dir
65
83
  _async_diff_dir_walk_task(
66
84
  src=src_next,
67
85
  dst=dst_next,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.72
3
+ Version: 1.0.75
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
@@ -4,26 +4,26 @@ rclone_api/completed_process.py,sha256=Pp-hXnLgej0IGO5ee9Fmx64dGzIofbQFEUyXdFCvO
4
4
  rclone_api/config.py,sha256=tP6cU9DnCCEIRc_KP9HPur1jFLLg2QGFSxNwFm6_MVw,118
5
5
  rclone_api/convert.py,sha256=Mx9Qo7zhkOedJd8LdhPvNGHp8znJzOk4f_2KWnoGc78,1012
6
6
  rclone_api/deprecated.py,sha256=qWKpnZdYcBK7YQZKuVoWWXDwi-uqiAtbjgPcci_efow,590
7
- rclone_api/diff.py,sha256=ggdDLUZxa13jMcPzKBcwAElmPCNWMOSR89D4yhpO74M,5264
8
- rclone_api/dir.py,sha256=hL0i4zrNUbpvFWI3TvKyOyanJ2okcb1lz4r2kxlvSi4,3529
7
+ rclone_api/diff.py,sha256=tMoJMAGmLSE6Q_7QhPf6PnCzb840djxMZtDmhc2GlGQ,5227
8
+ rclone_api/dir.py,sha256=i4h7LX5hB_WmVixxDRWL_l1nifvscrdWct_8Wx7wHZc,3540
9
9
  rclone_api/dir_listing.py,sha256=9Qqf2SUswrOEkyqmaH23V51I18X6ePiXb9B1vUwRF5o,1571
10
10
  rclone_api/exec.py,sha256=1ovvaMXDEfLiT7BrYZyE85u_yFhEUwUNW3jPOzqknR8,1023
11
11
  rclone_api/file.py,sha256=YtR5Y6c0YfXTS-sReOy2UgiSnafcAeO6b2hnbojBQD4,1423
12
12
  rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
13
13
  rclone_api/group_files.py,sha256=kOHh6ysFDkxjldSwvW6KqmiADUC1yFCdrZRY57TvbGY,5328
14
14
  rclone_api/process.py,sha256=RrMfTe0bndmJ6gBK67ioqNvCstJ8aTC8RlGX1XBLlcw,4191
15
- rclone_api/rclone.py,sha256=kIamoje3fUaWboMdF_d_a4WVaSa8BfK6zDFY8U6pNbs,28820
15
+ rclone_api/rclone.py,sha256=xBcHT61JJB3uL0V4B9HtMKyPwtARM-gAxK5RxAYfcF0,29439
16
16
  rclone_api/remote.py,sha256=c9hlRKBCg1BFB9MCINaQIoCg10qyAkeqiS4brl8ce-8,343
17
17
  rclone_api/rpath.py,sha256=8ZA_1wxWtskwcy0I8V2VbjKDmzPkiWd8Q2JQSvh-sYE,2586
18
- rclone_api/scan_missing_folders.py,sha256=ke2AVIdX-MiuJUi7poJBzP8GxjzzMhCsr1Mxbg0EIu4,4217
18
+ rclone_api/scan_missing_folders.py,sha256=Kulca2Q6WZodt00ATFHkmqqInuoPvBkhTcS9703y6po,4740
19
19
  rclone_api/types.py,sha256=DcbNw1R6j2f_1zHrhqEJcpCR-8kJfFJawMY0AmPsCnM,321
20
20
  rclone_api/util.py,sha256=_cvmHcJPRl2yXw4zgZiop3z-riA_8Ek6S5NDPw8cqSY,4198
21
21
  rclone_api/walk.py,sha256=-54NVE8EJcCstwDoaC_UtHm73R2HrZwVwQmsnv55xNU,3369
22
22
  rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
23
23
  rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
24
- rclone_api-1.0.72.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
25
- rclone_api-1.0.72.dist-info/METADATA,sha256=xzlW0jfYuqOPGSCI9k8MxNvp4BpI0Duojacxq_l-C-M,4489
26
- rclone_api-1.0.72.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
27
- rclone_api-1.0.72.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
28
- rclone_api-1.0.72.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
29
- rclone_api-1.0.72.dist-info/RECORD,,
24
+ rclone_api-1.0.75.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
25
+ rclone_api-1.0.75.dist-info/METADATA,sha256=pwMsEuOJW9ab39uvbac5yoKyBsbwsO5AvFnHxjCJp3k,4489
26
+ rclone_api-1.0.75.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
27
+ rclone_api-1.0.75.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
28
+ rclone_api-1.0.75.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
29
+ rclone_api-1.0.75.dist-info/RECORD,,