rclone-api 1.0.25__py2.py3-none-any.whl → 1.0.27__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
rclone_api/dir_listing.py CHANGED
@@ -1,8 +1,22 @@
1
1
  import json
2
+ import warnings
2
3
 
3
4
  from rclone_api.rpath import RPath
4
5
 
5
6
 
7
+ def _dedupe(items: list[RPath]) -> list[RPath]:
8
+ """Remove duplicate items from a list of RPath objects."""
9
+ seen = set()
10
+ unique_items = []
11
+ for item in items:
12
+ if item not in seen:
13
+ seen.add(item)
14
+ unique_items.append(item)
15
+ else:
16
+ warnings.warn(f"Duplicate item found: {item}, filtered out.")
17
+ return unique_items
18
+
19
+
6
20
  class DirListing:
7
21
  """Remote file dataclass."""
8
22
 
@@ -10,6 +24,8 @@ class DirListing:
10
24
  from rclone_api.dir import Dir
11
25
  from rclone_api.file import File
12
26
 
27
+ dirs_and_files = _dedupe(dirs_and_files)
28
+
13
29
  self.dirs: list[Dir] = [Dir(d) for d in dirs_and_files if d.is_dir]
14
30
  self.files: list[File] = [File(f) for f in dirs_and_files if not f.is_dir]
15
31
 
rclone_api/rclone.py CHANGED
@@ -347,13 +347,21 @@ class Rclone:
347
347
  outdir: Path,
348
348
  allow_writes=False,
349
349
  vfs_cache_mode="full",
350
- transfers: int | None = 16,
350
+ # dir-cache-time
351
+ dir_cache_time: str | None = "1h",
352
+ attribute_timeout: str | None = "1h",
353
+ # --vfs-cache-max-size
354
+ # vfs-cache-max-size
355
+ vfs_disk_space_total_size: str | None = "100M",
356
+ transfers: int | None = 128,
351
357
  modtime_strategy: (
352
358
  ModTimeStrategy | None
353
359
  ) = ModTimeStrategy.USE_SERVER_MODTIME, # speeds up S3 operations
354
360
  vfs_read_chunk_streams: int | None = 16,
355
361
  vfs_read_chunk_size: str | None = "4M",
356
362
  vfs_fast_fingerprint: bool = True,
363
+ # vfs-refresh
364
+ vfs_refresh: bool = True,
357
365
  other_cmds: list[str] | None = None,
358
366
  ) -> Process:
359
367
  """Mount a remote or directory to a local path.
@@ -366,10 +374,24 @@ class Rclone:
366
374
  if modtime_strategy is not None:
367
375
  other_cmds.append(f"--{modtime_strategy.value}")
368
376
  if (vfs_cache_mode == "full" or vfs_cache_mode == "writes") and (
369
- transfers is not None
377
+ transfers is not None and "--transfers" not in other_cmds
370
378
  ):
371
379
  other_cmds.append("--transfers")
372
380
  other_cmds.append(str(transfers))
381
+ if dir_cache_time is not None and "--dir-cache-time" not in other_cmds:
382
+ other_cmds.append("--dir-cache-time")
383
+ other_cmds.append(dir_cache_time)
384
+ if (
385
+ vfs_disk_space_total_size is not None
386
+ and "--vfs-cache-max-size" not in other_cmds
387
+ ):
388
+ other_cmds.append("--vfs-cache-max-size")
389
+ other_cmds.append(vfs_disk_space_total_size)
390
+ if vfs_refresh and "--vfs-refresh" not in other_cmds:
391
+ other_cmds.append("--vfs-refresh")
392
+ if attribute_timeout is not None and "--attr-timeout" not in other_cmds:
393
+ other_cmds.append("--attr-timeout")
394
+ other_cmds.append(attribute_timeout)
373
395
  if vfs_read_chunk_streams:
374
396
  other_cmds.append("--vfs-read-chunk-streams")
375
397
  other_cmds.append(str(vfs_read_chunk_streams))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.25
3
+ Version: 1.0.27
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
@@ -22,11 +22,11 @@ Dynamic: maintainer
22
22
  [![Ubuntu_Tests](https://github.com/zackees/rclone-api/actions/workflows/push_ubuntu.yml/badge.svg)](https://github.com/zackees/rclone-api/actions/workflows/push_ubuntu.yml)
23
23
  [![Win_Tests](https://github.com/zackees/rclone-api/actions/workflows/push_win.yml/badge.svg)](https://github.com/zackees/rclone-api/actions/workflows/push_win.yml)
24
24
 
25
- Api version of rclone. It's well tested. It's a pretty low level api without the bells and whistles of other apis, but it will get the job done.
25
+ Api version of rclone. It's a pretty low level api without the bells and whistles of other apis, but it will get the job done. Unit tests up the wazoo. S3 Mounts on windows/linux are heavily optimized.
26
26
 
27
27
  You will need to have rclone installed and on your path.
28
28
 
29
- One of the benefits of this api is that it does not use `shell=True`, which can keep `rclone` running in some instances even when try to kill the process.
29
+ One of the benefits of this api is that it does not use 'shell=True' so therefore ctrl-c will work well in gracefully shutting down
30
30
 
31
31
  # Install
32
32
 
@@ -3,21 +3,21 @@ rclone_api/cli.py,sha256=dibfAZIh0kXWsBbfp3onKLjyZXo54mTzDjUdzJlDlWo,231
3
3
  rclone_api/config.py,sha256=tP6cU9DnCCEIRc_KP9HPur1jFLLg2QGFSxNwFm6_MVw,118
4
4
  rclone_api/convert.py,sha256=Mx9Qo7zhkOedJd8LdhPvNGHp8znJzOk4f_2KWnoGc78,1012
5
5
  rclone_api/dir.py,sha256=vV-bcI2ESijmwF5rPID5WO2K7soAfZa35wv4KRh_GIo,2154
6
- rclone_api/dir_listing.py,sha256=8t5Jx9ZVOJPqGKTJbWaES6bjgogUT2bnpbPVWwK1Fcs,1124
6
+ rclone_api/dir_listing.py,sha256=9Qqf2SUswrOEkyqmaH23V51I18X6ePiXb9B1vUwRF5o,1571
7
7
  rclone_api/exec.py,sha256=9qSOpZo8YRYxv3hOvNr57ApnY2KbjxwT1QNr8OgcLM4,883
8
8
  rclone_api/file.py,sha256=D02iHJW1LhfOiM_R_yPHP8_ApnDiYrkuraVcrV8-qkw,1246
9
9
  rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
10
10
  rclone_api/process.py,sha256=iVA8_qtJFgHtg92Yb4W7xv9jnyds_7kAdKeSiGCBIZ0,3952
11
- rclone_api/rclone.py,sha256=2sxlxC9zsEG8P4ctgGtVKUPYxk2hB8uBimXbHnpqC-Q,14705
11
+ rclone_api/rclone.py,sha256=C5cbPahwJy0QuhQ3U8wH0DOY-SvKxPKKyogshXlp3P4,15755
12
12
  rclone_api/remote.py,sha256=c9hlRKBCg1BFB9MCINaQIoCg10qyAkeqiS4brl8ce-8,343
13
13
  rclone_api/rpath.py,sha256=8ZA_1wxWtskwcy0I8V2VbjKDmzPkiWd8Q2JQSvh-sYE,2586
14
14
  rclone_api/util.py,sha256=AWTImA1liCMw52wtS-Gs8Abz96diQ39x6Tx56mvbrEo,3860
15
15
  rclone_api/walk.py,sha256=kca0t1GAnF6FLclN01G8NG__Qe-ggodLtAbQSHyVPng,2968
16
16
  rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
17
17
  rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
18
- rclone_api-1.0.25.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
19
- rclone_api-1.0.25.dist-info/METADATA,sha256=1UQ5eElGnKi2Bd-rWpgy_XT9Vw_jLS-TYM1Mm95xk9o,4454
20
- rclone_api-1.0.25.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
21
- rclone_api-1.0.25.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
22
- rclone_api-1.0.25.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
23
- rclone_api-1.0.25.dist-info/RECORD,,
18
+ rclone_api-1.0.27.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
19
+ rclone_api-1.0.27.dist-info/METADATA,sha256=JD7eqEB5R3gXqqd-Moj06-uiXzpa5gOS9aff1x1Mqhc,4488
20
+ rclone_api-1.0.27.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
21
+ rclone_api-1.0.27.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
22
+ rclone_api-1.0.27.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
23
+ rclone_api-1.0.27.dist-info/RECORD,,