scitacean.datablock.OrigDatablock#

class scitacean.datablock.OrigDatablock(checksum_algorithm=None, init_files=None, _access_groups=None, _created_at=None, _created_by=None, _id=None, _is_published=None, _updated_at=None, _updated_by=None)[source]#

Dataclass for an orig datablock.

Instances of this class are mutable as opposed to scitacean.model.OrigDatablock. They are used for building datasets and get converted to/from pydantic models for communication with a server.

Constructors

__init__([checksum_algorithm, init_files, ...])

Methods

add_files(*files)

Append files to the datablock.

from_download_model(orig_datablock_model)

Construct a new OrigDatablock from pydantic models.

make_upload_model()

Build a new pydantic model to upload this datablock.

Attributes

access_groups

Access groups for this datablock.

checksum_algorithm

created_at

Creation time of this orig datablock.

created_by

User who created this orig datablock.

datablock_id

ID of this datablock.

files

Iterator over all files.

init_files

is_published

Return whether the datablock is public on SciCat.

size

Total size of all files.

updated_at

Last update time of this orig datablock.

updated_by

User who last updated this datablock.

__init__(checksum_algorithm=None, init_files=None, _access_groups=None, _created_at=None, _created_by=None, _id=None, _is_published=None, _updated_at=None, _updated_by=None)#
property access_groups: list[str] | None#

Access groups for this datablock.

add_files(*files)[source]#

Append files to the datablock.

Parameters:

files (File) – File objects to add.

Return type:

None

property created_at: datetime | None#

Creation time of this orig datablock.

property created_by: str | None#

User who created this orig datablock.

property datablock_id: str | None#

ID of this datablock.

property files: Iterator[File]#

Iterator over all files.

classmethod from_download_model(orig_datablock_model)[source]#

Construct a new OrigDatablock from pydantic models.

Parameters:

orig_datablock_model (DownloadOrigDatablock) – Model of the orig datablock to construct.

Returns:

OrigDatablock – A new instance.

property is_published: bool | None#

Return whether the datablock is public on SciCat.

make_upload_model()[source]#

Build a new pydantic model to upload this datablock.

Returns:

UploadOrigDatablock – A new model for this orig datablock.

property size: int#

Total size of all files.

property updated_at: datetime | None#

Last update time of this orig datablock.

property updated_by: str | None#

User who last updated this datablock.