-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy file on backend #181
Copy file on backend #181
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
|
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
Co-authored-by: Hagen Wierstorf <[email protected]>
Mhh, interesting question. I guess it depends on the backend. E.g. on |
Actually, it not only depends on the Backend but also the Interface. E.g. with |
The case that it might fail is covered by the |
I was expecting so, but turns out it does not :) This is because import audeer
import audbackend
with tempfile.TemporaryDirectory() as tmp:
path = audeer.touch(tmp, 'file.txt')
backend = audbackend.backend.FileSystem(tmp, 'repo')
backend.put_file(path, '/sub/file.txt')
path = audeer.touch(tmp, 'file2.txt')
backend.put_file(path, '/sub')
backend.ls()
|
But I suggest we discuss this in a separate issue, as it is not directly related to this PR. |
OK, I created #184. |
* audbackend.Base: add copy_file() * audbackend.interface.[Unversioned,Versioned]: add copy_file() * backend.[FileSystem,Artifactory]: add copy_file() * backend.FileSystem: fix copy file * backend.Artifactory: create destination directory if it does not exist * TST: update * TST: fix long line * TST: test errors * DOC: add docstring examples * DOC: update usage section * TST: exclude Base._copy_file() from Windows coverage * DOC: update developer section * Update audbackend/core/backend/base.py Co-authored-by: Hagen Wierstorf <[email protected]> * Update audbackend/core/interface/unversioned.py Co-authored-by: Hagen Wierstorf <[email protected]> * Update audbackend/core/interface/versioned.py Co-authored-by: Hagen Wierstorf <[email protected]> * Update docs/usage.rst Co-authored-by: Hagen Wierstorf <[email protected]> * DOC: fix typo --------- Co-authored-by: Hagen Wierstorf <[email protected]>
* audbackend.Base: add copy_file() * audbackend.interface.[Unversioned,Versioned]: add copy_file() * backend.[FileSystem,Artifactory]: add copy_file() * backend.FileSystem: fix copy file * backend.Artifactory: create destination directory if it does not exist * TST: update * TST: fix long line * TST: test errors * DOC: add docstring examples * DOC: update usage section * TST: exclude Base._copy_file() from Windows coverage * DOC: update developer section * Update audbackend/core/backend/base.py Co-authored-by: Hagen Wierstorf <[email protected]> * Update audbackend/core/interface/unversioned.py Co-authored-by: Hagen Wierstorf <[email protected]> * Update audbackend/core/interface/versioned.py Co-authored-by: Hagen Wierstorf <[email protected]> * Update docs/usage.rst Co-authored-by: Hagen Wierstorf <[email protected]> * DOC: fix typo --------- Co-authored-by: Hagen Wierstorf <[email protected]>
Relates to #177
Adds
backend.Base.copy_file()
to copy a file on the backend. A default implementation is provided, which downloads the files to a temporary directory and afterward uploads it to the new location. The behavior can be overwritten by implementing a custom_copy_file()
method. In case of a versioned interface, all versions of file are copied unless a specific version is selected.Documentation
API
backend.Base / backend.Artifactory / backend.FileSystem
interface.Unversioned
interface.Versioned
Usage
...
Developer