datalad_dataverse.remote

git-annex special remote with export capabilities

class datalad_dataverse.remote.DataverseRemote(*args)[source]

Bases: ExportRemote, DataverseRemote

Special remote to interface dataverse datasets with export-cabilities

The class extends the base implementation with a git-annex EXPORT protocol extension for special remotes.

It does not implement IMPORTTREE.

checkpresentexport(key, remote_file)[source]

Requests the remote to check if the file is present in it.

Parameters:
  • key (str) -- The key of the file to check.

  • remote_file (str) -- The remote path of the file to check.

Returns:

True if the file is present in the remote. False if the file is not present in the remote

Return type:

bool

Raises:

RemoteError -- If the the presence of the key couldn't be determined.

removeexport(key, remote_file)[source]

Requests the remote to remove content stored by transferexportstore().

Parameters:
  • key (str) -- The key of the file to check.

  • remote_file (str) -- The remote path of the file to delete.

Raises:

RemoteError -- If the the remote file couldn't be deleted.

renameexport(key, filename, new_filename)[source]

Moves an exported file.

If implemented, this is called by annex-export when a file was moved. Otherwise annex calls removeexport + transferexport_store, which does not scale well performance-wise.

transferexport_retrieve(key, local_file, remote_file)[source]

Requests the transfer of a file from the special remote to the local disk. Note that it's important that, while a file is being stored, checkpresentexport() not indicate it's present until all the data has been transferred. While the transfer is running, the remote can send any number of progress(size) messages.

Parameters:
  • key (str) -- The Key to get from the remote.

  • local_file (str) -- Path where to store the file. Note that in some cases, local_file may contain whitespace.

  • remote_file (str) -- The remote path of the file to download. It will be in the form of a relative path, and may contain path separators, whitespace, and other special characters.

Raises:

RemoteError -- If the key couldn't be stored on the remote.

transferexport_store(key, local_file, remote_file)[source]

Requests the transfer of a file on local disk to the special remote. Note that it's important that, while a file is being stored, checkpresentexport() not indicate it's present until all the data has been transferred. While the transfer is running, the remote can send any number of progress(size) messages.

Parameters:
  • key (str) -- The Key to be stored in the remote.

  • local_file (str) -- Path to the file to upload. Note that in some cases, local_file may contain whitespace.

  • remote_file (str) -- The path to the location to which the file will be uploaded. It will be in the form of a relative path, and may contain path separators, whitespace, and other special characters.

Raises:

RemoteError -- If the key couldn't be stored on the remote.

datalad_dataverse.remote.main()[source]

cmdline entry point