dvc-objects 0.23.1__tar.gz → 1.0.0__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.
- {dvc-objects-0.23.1/src/dvc_objects.egg-info → dvc-objects-1.0.0}/PKG-INFO +1 -1
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/base.py +7 -3
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/generic.py +35 -9
- {dvc-objects-0.23.1 → dvc-objects-1.0.0/src/dvc_objects.egg-info}/PKG-INFO +1 -1
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.cruft.json +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.gitattributes +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.github/dependabot.yml +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.github/workflows/release.yml +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.github/workflows/tests.yml +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.github/workflows/update-template.yaml +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.gitignore +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/.pre-commit-config.yaml +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/CODE_OF_CONDUCT.rst +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/CONTRIBUTING.rst +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/LICENSE +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/README.rst +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/noxfile.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/pyproject.toml +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/setup.cfg +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/__init__.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/_tqdm.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/db.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/errors.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/executors.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/__init__.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/callbacks.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/errors.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/local.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/memory.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/path.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/scheme.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/system.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/fs/utils.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/obj.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/py.typed +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects/transfer.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects.egg-info/SOURCES.txt +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects.egg-info/dependency_links.txt +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects.egg-info/not-zip-safe +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects.egg-info/requires.txt +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/src/dvc_objects.egg-info/top_level.txt +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/__init__.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/conftest.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/fs/__init__.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/fs/test_callbacks.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/fs/test_localfs.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/fs/test_system.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/fs/test_utils.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/test_odb.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/test_reflink.py +0 -0
- {dvc-objects-0.23.1 → dvc-objects-1.0.0}/tests/test_transfer.py +0 -0
|
@@ -107,11 +107,15 @@ class FileSystem:
|
|
|
107
107
|
self.jobs = kwargs.get("jobs") or self._JOBS
|
|
108
108
|
self.hash_jobs = kwargs.get("checksum_jobs") or self.HASH_JOBS
|
|
109
109
|
self._config = kwargs
|
|
110
|
-
self.fs_args: Dict[str, Any] = {"skip_instance_cache": True}
|
|
111
|
-
self.fs_args.update(self._prepare_credentials(**kwargs))
|
|
112
110
|
if fs:
|
|
113
111
|
self.fs = fs
|
|
114
112
|
|
|
113
|
+
@cached_property
|
|
114
|
+
def fs_args(self) -> Dict[str, Any]:
|
|
115
|
+
ret = {"skip_instance_cache": True}
|
|
116
|
+
ret.update(self._prepare_credentials(**self._config))
|
|
117
|
+
return ret
|
|
118
|
+
|
|
115
119
|
@property
|
|
116
120
|
def config(self) -> Dict[str, Any]:
|
|
117
121
|
return self._config
|
|
@@ -142,7 +146,7 @@ class FileSystem:
|
|
|
142
146
|
|
|
143
147
|
@cached_property
|
|
144
148
|
def version_aware(self) -> bool:
|
|
145
|
-
return self.
|
|
149
|
+
return self._config.get("version_aware", False)
|
|
146
150
|
|
|
147
151
|
@staticmethod
|
|
148
152
|
def _get_kwargs_from_urls(urlpath: str) -> "Dict[str, Any]":
|
|
@@ -99,13 +99,19 @@ def copy(
|
|
|
99
99
|
on_error=on_error,
|
|
100
100
|
)
|
|
101
101
|
|
|
102
|
+
jobs = batch_size or to_fs.jobs
|
|
102
103
|
put_file = callback.wrap_and_branch(to_fs.put_file)
|
|
104
|
+
put_file_kwargs = {}
|
|
105
|
+
if hasattr(to_fs.fs, "max_concurrency"):
|
|
106
|
+
put_file_kwargs["max_concurrency"] = jobs if len(from_path) == 1 else 1
|
|
103
107
|
|
|
104
108
|
def _copy_one(from_p: "AnyFSPath", to_p: "AnyFSPath"):
|
|
105
109
|
try:
|
|
106
110
|
with from_fs.open(from_p, mode="rb") as fobj:
|
|
107
111
|
size = from_fs.size(from_p)
|
|
108
|
-
return put_file(
|
|
112
|
+
return put_file(
|
|
113
|
+
fobj, to_p, size=size, callback=callback, **put_file_kwargs
|
|
114
|
+
)
|
|
109
115
|
except Exception as exc: # pylint: disable=broad-except
|
|
110
116
|
if on_error is not None:
|
|
111
117
|
on_error(from_p, to_p, exc)
|
|
@@ -115,7 +121,6 @@ def copy(
|
|
|
115
121
|
if len(from_path) == 1:
|
|
116
122
|
return _copy_one(from_path[0], to_path[0])
|
|
117
123
|
|
|
118
|
-
jobs = batch_size or to_fs.jobs
|
|
119
124
|
executor = ThreadPoolExecutor(max_workers=jobs, cancel_on_error=True)
|
|
120
125
|
with executor:
|
|
121
126
|
list(executor.imap_unordered(_copy_one, from_path, to_path))
|
|
@@ -129,11 +134,15 @@ def _put(
|
|
|
129
134
|
batch_size: Optional[int] = None,
|
|
130
135
|
on_error: Optional[TransferErrorHandler] = None,
|
|
131
136
|
) -> None:
|
|
137
|
+
jobs = batch_size or to_fs.jobs
|
|
132
138
|
put_file = callback.wrap_and_branch(to_fs.put_file)
|
|
139
|
+
put_file_kwargs = {}
|
|
140
|
+
if hasattr(to_fs.fs, "max_concurrency"):
|
|
141
|
+
put_file_kwargs["max_concurrency"] = jobs if len(from_paths) == 1 else 1
|
|
133
142
|
|
|
134
143
|
def _put_one(from_path: "AnyFSPath", to_path: "AnyFSPath"):
|
|
135
144
|
try:
|
|
136
|
-
return put_file(from_path, to_path, callback=callback)
|
|
145
|
+
return put_file(from_path, to_path, callback=callback, **put_file_kwargs)
|
|
137
146
|
except Exception as exc: # pylint: disable=broad-except
|
|
138
147
|
if on_error is not None:
|
|
139
148
|
on_error(from_path, to_path, exc)
|
|
@@ -143,7 +152,6 @@ def _put(
|
|
|
143
152
|
if len(from_paths) == 1:
|
|
144
153
|
return _put_one(from_paths[0], to_paths[0])
|
|
145
154
|
|
|
146
|
-
jobs = batch_size or to_fs.jobs
|
|
147
155
|
if to_fs.fs.async_impl:
|
|
148
156
|
put_coro = callback.wrap_and_branch_coro(
|
|
149
157
|
to_fs.fs._put_file # pylint: disable=protected-access
|
|
@@ -152,7 +160,7 @@ def _put(
|
|
|
152
160
|
fut = asyncio.run_coroutine_threadsafe(
|
|
153
161
|
batch_coros(
|
|
154
162
|
[
|
|
155
|
-
put_coro(from_path, to_path, callback=callback)
|
|
163
|
+
put_coro(from_path, to_path, callback=callback, **put_file_kwargs)
|
|
156
164
|
for from_path, to_path in zip(from_paths, to_paths)
|
|
157
165
|
],
|
|
158
166
|
batch_size=jobs,
|
|
@@ -181,12 +189,18 @@ def _get(
|
|
|
181
189
|
batch_size: Optional[int] = None,
|
|
182
190
|
on_error: Optional[TransferErrorHandler] = None,
|
|
183
191
|
) -> None:
|
|
192
|
+
jobs = batch_size or from_fs.jobs
|
|
184
193
|
get_file = callback.wrap_and_branch(from_fs.get_file)
|
|
194
|
+
get_file_kwargs = {}
|
|
195
|
+
if hasattr(from_fs.fs, "max_concurrency"):
|
|
196
|
+
get_file_kwargs["max_concurrency"] = jobs if len(from_paths) == 1 else 1
|
|
185
197
|
|
|
186
198
|
def _get_one(from_path: "AnyFSPath", to_path: "AnyFSPath"):
|
|
187
199
|
with as_atomic(localfs, to_path, create_parents=True) as tmp_file:
|
|
188
200
|
try:
|
|
189
|
-
return get_file(
|
|
201
|
+
return get_file(
|
|
202
|
+
from_path, tmp_file, callback=callback, **get_file_kwargs
|
|
203
|
+
)
|
|
190
204
|
except Exception as exc: # pylint: disable=broad-except
|
|
191
205
|
if on_error is not None:
|
|
192
206
|
on_error(from_path, to_path, exc)
|
|
@@ -196,7 +210,6 @@ def _get(
|
|
|
196
210
|
if len(from_paths) == 1:
|
|
197
211
|
return _get_one(from_paths[0], to_paths[0])
|
|
198
212
|
|
|
199
|
-
jobs = batch_size or from_fs.jobs
|
|
200
213
|
if from_fs.fs.async_impl:
|
|
201
214
|
|
|
202
215
|
async def _get_one_coro(from_path: "AnyFSPath", to_path: "AnyFSPath"):
|
|
@@ -204,7 +217,9 @@ def _get(
|
|
|
204
217
|
from_fs.fs._get_file # pylint: disable=protected-access
|
|
205
218
|
)
|
|
206
219
|
with as_atomic(localfs, to_path, create_parents=True) as tmp_file:
|
|
207
|
-
return await get_coro(
|
|
220
|
+
return await get_coro(
|
|
221
|
+
from_path, tmp_file, callback=callback, **get_file_kwargs
|
|
222
|
+
)
|
|
208
223
|
|
|
209
224
|
loop = get_loop()
|
|
210
225
|
fut = asyncio.run_coroutine_threadsafe(
|
|
@@ -238,13 +253,21 @@ def _try_links(
|
|
|
238
253
|
to_fs: "FileSystem",
|
|
239
254
|
to_path: "AnyFSPath",
|
|
240
255
|
callback: "Callback" = DEFAULT_CALLBACK,
|
|
256
|
+
batch_size: Optional[int] = None,
|
|
241
257
|
) -> None:
|
|
242
258
|
error = None
|
|
243
259
|
while links:
|
|
244
260
|
link = links[0]
|
|
245
261
|
|
|
246
262
|
if link == "copy":
|
|
247
|
-
return copy(
|
|
263
|
+
return copy(
|
|
264
|
+
from_fs,
|
|
265
|
+
from_path,
|
|
266
|
+
to_fs,
|
|
267
|
+
to_path,
|
|
268
|
+
callback=callback,
|
|
269
|
+
batch_size=batch_size,
|
|
270
|
+
)
|
|
248
271
|
|
|
249
272
|
try:
|
|
250
273
|
_link(link, from_fs, from_path, to_fs, to_path)
|
|
@@ -256,6 +279,8 @@ def _try_links(
|
|
|
256
279
|
errno.ENOTSUP,
|
|
257
280
|
errno.EXDEV,
|
|
258
281
|
errno.ENOTTY,
|
|
282
|
+
errno.ENOSYS,
|
|
283
|
+
errno.EINVAL,
|
|
259
284
|
):
|
|
260
285
|
raise
|
|
261
286
|
error = exc
|
|
@@ -310,6 +335,7 @@ def transfer(
|
|
|
310
335
|
to_fs,
|
|
311
336
|
to_p,
|
|
312
337
|
callback=callback,
|
|
338
|
+
batch_size=batch_size,
|
|
313
339
|
)
|
|
314
340
|
except OSError as exc:
|
|
315
341
|
# If the target file already exists, we are going to simply
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|