rclone-api 1.3.14__tar.gz → 1.3.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. {rclone_api-1.3.14 → rclone_api-1.3.17}/PKG-INFO +2 -2
  2. {rclone_api-1.3.14 → rclone_api-1.3.17}/README.md +1 -1
  3. {rclone_api-1.3.14 → rclone_api-1.3.17}/pyproject.toml +1 -1
  4. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/db/db.py +2 -2
  5. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/file.py +52 -2
  6. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/rclone.py +1408 -1418
  7. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api.egg-info/PKG-INFO +2 -2
  8. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api.egg-info/SOURCES.txt +1 -0
  9. rclone_api-1.3.17/tests/test_file_item.py +37 -0
  10. {rclone_api-1.3.14 → rclone_api-1.3.17}/.aiderignore +0 -0
  11. {rclone_api-1.3.14 → rclone_api-1.3.17}/.github/workflows/lint.yml +0 -0
  12. {rclone_api-1.3.14 → rclone_api-1.3.17}/.github/workflows/push_macos.yml +0 -0
  13. {rclone_api-1.3.14 → rclone_api-1.3.17}/.github/workflows/push_ubuntu.yml +0 -0
  14. {rclone_api-1.3.14 → rclone_api-1.3.17}/.github/workflows/push_win.yml +0 -0
  15. {rclone_api-1.3.14 → rclone_api-1.3.17}/.gitignore +0 -0
  16. {rclone_api-1.3.14 → rclone_api-1.3.17}/.pylintrc +0 -0
  17. {rclone_api-1.3.14 → rclone_api-1.3.17}/.vscode/launch.json +0 -0
  18. {rclone_api-1.3.14 → rclone_api-1.3.17}/.vscode/settings.json +0 -0
  19. {rclone_api-1.3.14 → rclone_api-1.3.17}/.vscode/tasks.json +0 -0
  20. {rclone_api-1.3.14 → rclone_api-1.3.17}/LICENSE +0 -0
  21. {rclone_api-1.3.14 → rclone_api-1.3.17}/MANIFEST.in +0 -0
  22. {rclone_api-1.3.14 → rclone_api-1.3.17}/clean +0 -0
  23. {rclone_api-1.3.14 → rclone_api-1.3.17}/install +0 -0
  24. {rclone_api-1.3.14 → rclone_api-1.3.17}/lint +0 -0
  25. {rclone_api-1.3.14 → rclone_api-1.3.17}/requirements.testing.txt +0 -0
  26. {rclone_api-1.3.14 → rclone_api-1.3.17}/setup.cfg +0 -0
  27. {rclone_api-1.3.14 → rclone_api-1.3.17}/setup.py +0 -0
  28. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/__init__.py +0 -0
  29. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/assets/example.txt +0 -0
  30. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/cli.py +0 -0
  31. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/cmd/analyze.py +0 -0
  32. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/cmd/copy_large_s3.py +0 -0
  33. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/cmd/list_files.py +0 -0
  34. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/cmd/save_to_db.py +0 -0
  35. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/completed_process.py +0 -0
  36. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/config.py +0 -0
  37. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/convert.py +0 -0
  38. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/db/__init__.py +0 -0
  39. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/db/models.py +0 -0
  40. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/deprecated.py +0 -0
  41. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/diff.py +0 -0
  42. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/dir.py +0 -0
  43. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/dir_listing.py +0 -0
  44. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/exec.py +0 -0
  45. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/experimental/flags.py +0 -0
  46. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/experimental/flags_base.py +0 -0
  47. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/file_item.py +0 -0
  48. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/filelist.py +0 -0
  49. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/group_files.py +0 -0
  50. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/log.py +0 -0
  51. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/mount.py +0 -0
  52. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/mount_read_chunker.py +0 -0
  53. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/process.py +0 -0
  54. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/profile/mount_copy_bytes.py +0 -0
  55. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/remote.py +0 -0
  56. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/rpath.py +0 -0
  57. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/api.py +0 -0
  58. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/basic_ops.py +0 -0
  59. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/chunk_task.py +0 -0
  60. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/chunk_types.py +0 -0
  61. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/create.py +0 -0
  62. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/types.py +0 -0
  63. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/s3/upload_file_multipart.py +0 -0
  64. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/scan_missing_folders.py +0 -0
  65. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/types.py +0 -0
  66. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/util.py +0 -0
  67. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api/walk.py +0 -0
  68. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api.egg-info/dependency_links.txt +0 -0
  69. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api.egg-info/entry_points.txt +0 -0
  70. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api.egg-info/requires.txt +0 -0
  71. {rclone_api-1.3.14 → rclone_api-1.3.17}/src/rclone_api.egg-info/top_level.txt +0 -0
  72. {rclone_api-1.3.14 → rclone_api-1.3.17}/test +0 -0
  73. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/archive/test_paramiko.py.disabled +0 -0
  74. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_cmd_list_files.py +0 -0
  75. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_copy.py +0 -0
  76. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_copy_bytes.py +0 -0
  77. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_copy_file_resumable_s3.py +0 -0
  78. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_copy_files.py +0 -0
  79. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_db.py +0 -0
  80. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_diff.py +0 -0
  81. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_group_files.py +0 -0
  82. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_is_synced.py +0 -0
  83. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_ls.py +0 -0
  84. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_ls_stream_files.py +0 -0
  85. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_mount.py +0 -0
  86. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_mount_s3.py +0 -0
  87. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_obscure.py +0 -0
  88. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_rclone_config.py +0 -0
  89. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_remote_control.py +0 -0
  90. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_remotes.py +0 -0
  91. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_s3.py +0 -0
  92. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_scan_missing_folders.py +0 -0
  93. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_size_files.py +0 -0
  94. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_size_suffix.py +0 -0
  95. {rclone_api-1.3.14 → rclone_api-1.3.17}/tests/test_walk.py +0 -0
  96. {rclone_api-1.3.14 → rclone_api-1.3.17}/tox.ini +0 -0
  97. {rclone_api-1.3.14 → rclone_api-1.3.17}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.3.14
3
+ Version: 1.3.17
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -25,7 +25,7 @@ Dynamic: home-page
25
25
  [![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)
26
26
  [![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)
27
27
 
28
- 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.
28
+ Started off as just python bindings to rclone, but this project is now adding features to fill in the gaps of the rclone app. The big features is streaming file diffs, stream file listings.
29
29
 
30
30
  You will need to have rclone installed and on your path.
31
31
 
@@ -5,7 +5,7 @@
5
5
  [![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)
6
6
  [![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)
7
7
 
8
- 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.
8
+ Started off as just python bindings to rclone, but this project is now adding features to fill in the gaps of the rclone app. The big features is streaming file diffs, stream file listings.
9
9
 
10
10
  You will need to have rclone installed and on your path.
11
11
 
@@ -24,7 +24,7 @@ dependencies = [
24
24
  ]
25
25
 
26
26
  # Change this with the version number bump.
27
- version = "1.3.14"
27
+ version = "1.3.17"
28
28
 
29
29
  [tool.setuptools]
30
30
  package-dir = {"" = "src"}
@@ -178,7 +178,7 @@ class DBRepo:
178
178
  "size": file.size,
179
179
  "mime_type": file.mime_type,
180
180
  "mod_time": file.mod_time,
181
- "suffix": file.suffix,
181
+ "suffix": file.real_suffix,
182
182
  }
183
183
  for file in is_new
184
184
  ]
@@ -213,7 +213,7 @@ class DBRepo:
213
213
  "size": file.size,
214
214
  "mime_type": file.mime_type,
215
215
  "mod_time": file.mod_time,
216
- "suffix": file.suffix,
216
+ "suffix": file.real_suffix,
217
217
  }
218
218
  )
219
219
  if update_values:
@@ -12,6 +12,56 @@ def _intern(s: str) -> str:
12
12
  return _STRING_INTERNER.setdefault(s, s)
13
13
 
14
14
 
15
+ _SUFFIX_LARGEST_SIZE = len("torrents") + 2
16
+
17
+
18
+ def _suffix_clean_bad_parts(suffix: list[str]) -> list[str]:
19
+ """Remove any bad parts from the suffix list."""
20
+ out = []
21
+ for part in suffix:
22
+ if part in ["", ""]:
23
+ continue
24
+ if " " in part:
25
+ # split on spaces
26
+ continue
27
+ if "--" in part:
28
+ # split on --
29
+ parts = part.split("--")
30
+ parts = [x.strip() for x in parts if x.strip()]
31
+ out.extend(parts)
32
+ out.append(part)
33
+
34
+ out, tmp = [], out
35
+ for part in tmp:
36
+ if len(part) > _SUFFIX_LARGEST_SIZE:
37
+ continue
38
+ out.append(part)
39
+ return out
40
+
41
+
42
+ def _get_suffix(name: str, chop_compressed_suffixes: bool = True) -> str:
43
+ # name.sql.gz -> sql.gz
44
+ try:
45
+ parts = name.split(".")
46
+ if len(parts) == 1:
47
+ return ""
48
+ parts = _suffix_clean_bad_parts(parts)
49
+ last_part = parts[-1]
50
+ if chop_compressed_suffixes:
51
+ if last_part == "gz" and len(parts) > 2:
52
+ parts = parts[:-1]
53
+ if len(parts) > 2:
54
+ # grab the last two parts
55
+ return ".".join(parts[-2:])
56
+ return ".".join(parts[1:])
57
+ except IndexError:
58
+ warnings.warn(f"Invalid name: {name} for normal suffix extraction")
59
+ suffix = Path(name).suffix
60
+ if suffix.startswith("."):
61
+ return suffix[1:]
62
+ return suffix
63
+
64
+
15
65
  # File is too complex, this is a simple dataclass that can be streamed out.
16
66
  @dataclass
17
67
  class FileItem:
@@ -40,14 +90,14 @@ class FileItem:
40
90
  return f"{self.parent}/{self.name}"
41
91
 
42
92
  @property
43
- def suffix(self) -> str:
93
+ def real_suffix(self) -> str:
44
94
  return self._suffix
45
95
 
46
96
  def __post_init__(self):
47
97
  self.parent = _intern(self.parent)
48
98
  self.mime_type = _intern(self.mime_type)
49
99
  self.remote = _intern(self.remote)
50
- self._suffix = _intern(Path(self.name).suffix)
100
+ self._suffix = _intern(_get_suffix(self.name))
51
101
 
52
102
  @staticmethod
53
103
  def from_json(remote: str, data: dict) -> "FileItem | None":