dandi.delete#

Functions

delete(paths[, dandi_instance, devel_debug, ...])

Delete dandisets and assets from the server.

find_local_asset(filepath)

Given a path to a local file, return the ID of the Dandiset in which it is located and the path to the file relative to the root of said Dandiset.

is_same_url(url1, url2)

Classes

Deleter(client, dandiset, deleting_dandiset, ...)

Class for registering assets & Dandisets to delete and then deleting them

class dandi.delete.Deleter(client: DandiAPIClient | None = None, dandiset: RemoteDandiset | None = None, deleting_dandiset: bool = False, skip_missing: bool = False, remote_assets: list[RemoteAsset] = <factory>)[source]#

Class for registering assets & Dandisets to delete and then deleting them

add_asset(asset: RemoteAsset) None[source]#
client: DandiAPIClient | None = None#
confirm() bool[source]#
dandiset: RemoteDandiset | None = None#
delete_dandiset() None[source]#
deleting_dandiset: bool = False#

Whether we are deleting an entire Dandiset (true) or just assets (false)

process_assets_debug() Iterator[Iterator[dict]][source]#
process_assets_pyout() Iterator[dict][source]#
register_asset(instance: DandiInstance, dandiset_id: str, version_id: str, asset_path: str) None[source]#
register_asset_folder(instance: DandiInstance, dandiset_id: str, version_id: str, folder_path: str) None[source]#
register_assets_url(url: str, parsed_url: ParsedDandiURL) None[source]#
register_dandiset(instance: DandiInstance, dandiset_id: str) None[source]#
register_local_path_equivalent(instance_name: str | DandiInstance, filepath: str) None[source]#
register_url(url: str) None[source]#
remote_assets: list[RemoteAsset]#
set_dandiset(instance: DandiInstance, dandiset_id: str) bool[source]#

Returns False if no action should be taken due to the Dandiset not existing

skip_missing: bool = False#
dandi.delete.delete(paths: Iterable[str], dandi_instance: str | DandiInstance = 'dandi', devel_debug: bool = False, jobs: int | None = None, force: bool = False, skip_missing: bool = False) None[source]#

Delete dandisets and assets from the server.

PATH could be a local path or a URL to an asset, directory, or an entire dandiset.

dandi.delete.find_local_asset(filepath: str) tuple[str, str][source]#

Given a path to a local file, return the ID of the Dandiset in which it is located and the path to the file relative to the root of said Dandiset. If the file is a directory, the path will end with a trailing slash.

dandi.delete.is_same_url(url1: str, url2: str) bool[source]#