Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# `aiida.repository`

## Package Contents

### Classes

`AbstractRepositoryBackend` |
`DiskObjectStoreRepositoryBackend` |
`File` |
`FileType` |
`Repository` |
`SandboxRepositoryBackend` |

### API

class aiida.repository.AbstractRepositoryBackend
  abstract property uuid: Optional[str]
  abstract property key_format: Optional[str]
  abstract initialise(**kwargs) → None
  abstract property is_initialised: bool
  abstract erase() → None
  static is_readable_byte_stream(handle) → bool
  put_object_from_filelike(handle: BinaryIO) → str
  abstract _put_object_from_filelike(handle: BinaryIO) → str
  put_object_from_file(filepath: Union[str, pathlib.Path]) → str
  abstract has_objects(keys: List[str]) → List[bool]
  has_object(key: str) → bool
  abstract list_objects() → Iterable[str]
  abstract get_info(detailed: bool = False, **kwargs) → dict
  abstract maintain(dry_run: bool = False, live: bool = True, **kwargs) → None
  open(key: str) → Iterator[BinaryIO]
  get_object_content(key: str) → bytes
  abstract iter_object_streams(keys: List[str]) → Iterator[Tuple[str, BinaryIO]]
  get_object_hash(key: str) → str
  abstract delete_objects(keys: List[str]) → None
  delete_object(key: str) → None

class aiida.repository.DiskObjectStoreRepositoryBackend(container: disk_objectstore.Container)

  Bases: `aiida.repository.backend.abstract.AbstractRepositoryBackend`

  Initialization

  __str__() → str
  property uuid: Optional[str]
  property key_format: Optional[str]
  initialise(**kwargs) → None
  property is_initialised: bool
  erase()
  _put_object_from_filelike(handle: BinaryIO) → str
  has_objects(keys: List[str]) → List[bool]
  open(key: str) → Iterator[BinaryIO]
  iter_object_streams(keys: List[str]) → Iterator[Tuple[str, BinaryIO]]
  delete_objects(keys: List[str]) → None
  list_objects() → Iterable[str]
  get_object_hash(key: str) → str
  maintain(dry_run: bool = False, live: bool = True, pack_loose: bool = None, do_repack: bool = None, clean_storage: bool = None, do_vacuum: bool = None) → dict
  get_info(detailed=False) → Dict[str, Union[int, str, Dict[str, int], Dict[str, float]]]

class aiida.repository.File(name: str = '', file_type: aiida.repository.common.FileType = FileType.DIRECTORY, key: Union[str, None] = None, objects: Optional[Dict[str, aiida.repository.common.File]] = None)

  Initialization

  classmethod from_serialized(serialized: dict, name='') → aiida.repository.common.File
  serialize() → dict
  property name: str
  property file_type: aiida.repository.common.FileType
  is_file() → bool
  is_dir() → bool
  property key: Union[str, None]
  property objects: Dict[str, aiida.repository.common.File]
  __eq__(other) → bool
  __repr__()

class aiida.repository.FileType(*args, **kwds)

  Bases: `enum.Enum`

  Initialization

  DIRECTORY = 0
  FILE = 1

class aiida.repository.Repository(backend: Optional[aiida.repository.backend.AbstractRepositoryBackend] = None)

  Initialization

  _file_cls = None
  __str__() → str
  property uuid: Optional[str]
  property is_initialised: bool
  classmethod from_serialized(backend: aiida.repository.backend.AbstractRepositoryBackend, serialized: Dict[str, Any]) → aiida.repository.repository.Repository
  reset() → None
  serialize() → Dict[str, Any]
  classmethod flatten(serialized=Optional[Dict[str, Any]], delimiter: str = '/') → Dict[str, Optional[str]]
  hash() → str
  static _pre_process_path(path: Optional[aiida.repository.repository.FilePath] = None) → pathlib.PurePosixPath
  property backend: aiida.repository.backend.AbstractRepositoryBackend
  set_backend(backend: aiida.repository.backend.AbstractRepositoryBackend) → None
  _insert_file(path: pathlib.PurePosixPath, key: str) → None
  create_directory(path: aiida.repository.repository.FilePath) → aiida.repository.common.File
  get_file_keys() → List[str]
  get_object(path: Optional[aiida.repository.repository.FilePath] = None) → aiida.repository.common.File
  get_directory(path: Optional[aiida.repository.repository.FilePath] = None) → aiida.repository.common.File
  get_file(path: aiida.repository.repository.FilePath) → aiida.repository.common.File
  list_objects(path: Optional[aiida.repository.repository.FilePath] = None) → List[aiida.repository.common.File]
  list_object_names(path: Optional[aiida.repository.repository.FilePath] = None) → List[str]
  put_object_from_filelike(handle: BinaryIO, path: aiida.repository.repository.FilePath) → None
  put_object_from_file(filepath: aiida.repository.repository.FilePath, path: aiida.repository.repository.FilePath) → None
  put_object_from_tree(filepath: aiida.repository.repository.FilePath, path: Optional[aiida.repository.repository.FilePath] = None) → None
  is_empty() → bool
  has_object(path: aiida.repository.repository.FilePath) → bool
  open(path: aiida.repository.repository.FilePath) → Iterator[BinaryIO]
  get_object_content(path: aiida.repository.repository.FilePath) → bytes
  delete_object(path: aiida.repository.repository.FilePath, hard_delete: bool = False) → None
  erase() → None
  clone(source: aiida.repository.repository.Repository) → None
  walk(path: Optional[aiida.repository.repository.FilePath] = None) → Iterable[Tuple[pathlib.PurePosixPath, List[str], List[str]]]
  copy_tree(target: Union[str, pathlib.Path], path: Optional[aiida.repository.repository.FilePath] = None) → None
  initialise(**kwargs: Any) → None
  delete() → None

class aiida.repository.SandboxRepositoryBackend(filepath: str | None = None)

  Bases: `aiida.repository.backend.abstract.AbstractRepositoryBackend`

  Initialization

  __str__() → str
  __del__()
  property uuid: str | None
  property key_format: str | None
  initialise(**kwargs) → None
  property is_initialised: bool
  property sandbox
  erase()
  _put_object_from_filelike(handle: BinaryIO) → str
  has_objects(keys: list[str]) → list[bool]
  open(key: str) → Iterator[BinaryIO]
  iter_object_streams(keys: list[str]) → Iterator[tuple[str, BinaryIO]]
  delete_objects(keys: list[str]) → None
  list_objects() → Iterable[str]
  abstract maintain(dry_run: bool = False, live: bool = True, **kwargs) → None
  abstract get_info(detailed: bool = False, **kwargs) → dict