rclone-api 1.5.23__py3-none-any.whl → 1.5.25__py3-none-any.whl
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.
- rclone_api/fs.py +16 -8
- {rclone_api-1.5.23.dist-info → rclone_api-1.5.25.dist-info}/METADATA +1 -1
- {rclone_api-1.5.23.dist-info → rclone_api-1.5.25.dist-info}/RECORD +7 -7
- {rclone_api-1.5.23.dist-info → rclone_api-1.5.25.dist-info}/WHEEL +0 -0
- {rclone_api-1.5.23.dist-info → rclone_api-1.5.25.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.5.23.dist-info → rclone_api-1.5.25.dist-info}/licenses/LICENSE +0 -0
- {rclone_api-1.5.23.dist-info → rclone_api-1.5.25.dist-info}/top_level.txt +0 -0
rclone_api/fs.py
CHANGED
@@ -106,7 +106,7 @@ class RemoteFS(FS):
|
|
106
106
|
self.shutdown = False
|
107
107
|
|
108
108
|
def root(self) -> "FSPath":
|
109
|
-
return FSPath(self,
|
109
|
+
return FSPath(self, self.src)
|
110
110
|
|
111
111
|
def cwd(self) -> "FSPath":
|
112
112
|
return self.root()
|
@@ -116,9 +116,12 @@ class RemoteFS(FS):
|
|
116
116
|
return path.as_posix()
|
117
117
|
return path
|
118
118
|
|
119
|
+
def _to_remote_path(self, path: str | Path) -> str:
|
120
|
+
return Path(path).relative_to(self.src).as_posix()
|
121
|
+
|
119
122
|
def copy(self, src: Path | str, dest: Path | str) -> None:
|
120
123
|
src = self._to_str(src)
|
121
|
-
dest = self.
|
124
|
+
dest = self._to_remote_path(dest)
|
122
125
|
self.rclone.copy(src, dest)
|
123
126
|
|
124
127
|
def read_bytes(self, path: Path | str) -> bytes:
|
@@ -134,7 +137,8 @@ class RemoteFS(FS):
|
|
134
137
|
|
135
138
|
def exists(self, path: Path | str) -> bool:
|
136
139
|
path = self._to_str(path)
|
137
|
-
|
140
|
+
dst_rel = self._to_remote_path(path)
|
141
|
+
return self.server.exists(dst_rel)
|
138
142
|
|
139
143
|
def mkdir(self, path: str, parents=True, exist_ok=True) -> None:
|
140
144
|
# Ignore mkdir for remote backend, it will be made when file is written.
|
@@ -144,18 +148,18 @@ class RemoteFS(FS):
|
|
144
148
|
return None
|
145
149
|
|
146
150
|
def is_dir(self, path: Path | str) -> bool:
|
147
|
-
path = self.
|
151
|
+
path = self._to_remote_path(path)
|
148
152
|
err = self.server.list(path)
|
149
153
|
return isinstance(err, list)
|
150
154
|
|
151
155
|
def is_file(self, path: Path | str) -> bool:
|
152
|
-
path = self.
|
156
|
+
path = self._to_remote_path(path)
|
153
157
|
err = self.server.list(path)
|
154
158
|
# Make faster.
|
155
159
|
return isinstance(err, Exception) and self.exists(path)
|
156
160
|
|
157
161
|
def ls(self, path: Path | str) -> list[str]:
|
158
|
-
path = self.
|
162
|
+
path = self._to_remote_path(path)
|
159
163
|
err = self.server.list(path)
|
160
164
|
if isinstance(err, Exception):
|
161
165
|
raise FileNotFoundError(f"File not found: {path}, because of {err}")
|
@@ -217,10 +221,14 @@ class FSPath:
|
|
217
221
|
assert isinstance(self.fs, RealFS)
|
218
222
|
shutil.rmtree(self.path, ignore_errors=ignore_errors)
|
219
223
|
|
220
|
-
def
|
221
|
-
names: list[str] = self.
|
224
|
+
def lspaths(self) -> "list[FSPath]":
|
225
|
+
names: list[str] = self.ls()
|
222
226
|
return [self / name for name in names]
|
223
227
|
|
228
|
+
def ls(self) -> list[str]:
|
229
|
+
names: list[str] = self.fs.ls(self.path)
|
230
|
+
return names
|
231
|
+
|
224
232
|
@property
|
225
233
|
def name(self) -> str:
|
226
234
|
return Path(self.path).name
|
@@ -13,7 +13,7 @@ rclone_api/file_item.py,sha256=cH-AQYsxedhNPp4c8NHY1ad4Z7St4yf_VGbmiGD59no,1770
|
|
13
13
|
rclone_api/file_part.py,sha256=i6ByS5_sae8Eba-4imBVTxd-xKC8ExWy7NR8QGr0ors,6155
|
14
14
|
rclone_api/file_stream.py,sha256=_W3qnwCuigqA0hzXl2q5pAxSZDRaUSwet4BkT0lpnzs,1431
|
15
15
|
rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
|
16
|
-
rclone_api/fs.py,sha256=
|
16
|
+
rclone_api/fs.py,sha256=judqhucGuhlsqUCoxa0cELZ-cjVDymlJirrjPzIrJ84,7219
|
17
17
|
rclone_api/group_files.py,sha256=H92xPW9lQnbNw5KbtZCl00bD6iRh9yRbCuxku4j_3dg,8036
|
18
18
|
rclone_api/http_server.py,sha256=ZdL-rGaq0zIjcaIiRIbPBQ4OIWZ7dCu71aq0nRlKtY4,11686
|
19
19
|
rclone_api/install.py,sha256=Xb1BRn8rQcSpSd4dzmvIOELP2zM2DytUeIZ6jzv738A,2893
|
@@ -54,9 +54,9 @@ rclone_api/s3/multipart/upload_parts_inline.py,sha256=V7syKjFyVIe4U9Ahl5XgqVTzt9
|
|
54
54
|
rclone_api/s3/multipart/upload_parts_resumable.py,sha256=6-nlMclS8jyVvMvFbQDcZOX9MY1WbCcKA_s9bwuYxnk,9793
|
55
55
|
rclone_api/s3/multipart/upload_parts_server_side_merge.py,sha256=Fp2pdrs5dONQI9LkfNolgAGj1-Z2V1SsRd0r0sreuXI,18040
|
56
56
|
rclone_api/s3/multipart/upload_state.py,sha256=f-Aq2NqtAaMUMhYitlICSNIxCKurWAl2gDEUVizLIqw,6019
|
57
|
-
rclone_api-1.5.
|
58
|
-
rclone_api-1.5.
|
59
|
-
rclone_api-1.5.
|
60
|
-
rclone_api-1.5.
|
61
|
-
rclone_api-1.5.
|
62
|
-
rclone_api-1.5.
|
57
|
+
rclone_api-1.5.25.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
58
|
+
rclone_api-1.5.25.dist-info/METADATA,sha256=VWQEhDMCtvkYAf_Ts_fiVaTKuy-KRD8k7R9zoVpQqww,37155
|
59
|
+
rclone_api-1.5.25.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
60
|
+
rclone_api-1.5.25.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
|
61
|
+
rclone_api-1.5.25.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
62
|
+
rclone_api-1.5.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|