SDK Models | spectrumx.models
spectrumx.models
Data models for the SpectrumX Data System SDK.
Modules:
| Name | Description |
|---|---|
base |
|
captures |
Capture model for SpectrumX. |
datasets |
Dataset model for SpectrumX. |
files |
Data models for the SpectrumX Data System SDK. |
Classes:
| Name | Description |
|---|---|
SDSModel |
Base class for most models in SDS. |
Classes
SDSModel
Bases: BaseModel
flowchart TD
spectrumx.models.SDSModel[SDSModel]
click spectrumx.models.SDSModel href "" "spectrumx.models.SDSModel"
Base class for most models in SDS.
-
API Reference
SDK Models | spectrumx.models
models Modules
-
API Reference
Operations
Pagination | spectrumx.ops.pagination
pagination ClassesPaginator
Modules
base
Classes:
| Name | Description |
|---|---|
SDSModel |
Base class for most models in SDS. |
Classes
SDSModel
Bases: BaseModel
flowchart TD
spectrumx.models.base.SDSModel[SDSModel]
click spectrumx.models.base.SDSModel href "" "spectrumx.models.base.SDSModel"
Base class for most models in SDS.
-
API Reference
SDK Models | spectrumx.models
models Modules
-
API Reference
Operations
Pagination | spectrumx.ops.pagination
pagination ClassesPaginator
captures
Capture model for SpectrumX.
Classes:
| Name | Description |
|---|---|
Capture |
A capture in SDS. A collection of spectrum data files that is indexed. |
CaptureType |
Capture types in SDS. |
Classes
Capture
Bases: SDSModel
flowchart TD
spectrumx.models.captures.Capture[Capture]
spectrumx.models.base.SDSModel[SDSModel]
spectrumx.models.base.SDSModel --> spectrumx.models.captures.Capture
click spectrumx.models.captures.Capture href "" "spectrumx.models.captures.Capture"
click spectrumx.models.base.SDSModel href "" "spectrumx.models.base.SDSModel"
A capture in SDS. A collection of spectrum data files that is indexed.
CaptureOrigin
Bases: StrEnum
flowchart TD
spectrumx.models.captures.CaptureOrigin[CaptureOrigin]
click spectrumx.models.captures.CaptureOrigin href "" "spectrumx.models.captures.CaptureOrigin"
Capture origins in SDS.
CaptureType
Bases: StrEnum
flowchart TD
spectrumx.models.captures.CaptureType[CaptureType]
click spectrumx.models.captures.CaptureType href "" "spectrumx.models.captures.CaptureType"
Capture types in SDS.
datasets
Dataset model for SpectrumX.
Classes:
| Name | Description |
|---|---|
Dataset |
A dataset in SDS. |
Classes
Dataset
Bases: BaseModel
flowchart TD
spectrumx.models.datasets.Dataset[Dataset]
click spectrumx.models.datasets.Dataset href "" "spectrumx.models.datasets.Dataset"
A dataset in SDS.
files
Data models for the SpectrumX Data System SDK.
Modules:
| Name | Description |
|---|---|
file |
File model for SpectrumX. |
permission |
|
Classes:
| Name | Description |
|---|---|
File |
A file in SDS. |
PermissionRepresentation |
|
Classes
File
Bases: SDSModel
flowchart TD
spectrumx.models.files.File[File]
spectrumx.models.base.SDSModel[SDSModel]
spectrumx.models.base.SDSModel --> spectrumx.models.files.File
click spectrumx.models.files.File href "" "spectrumx.models.files.File"
click spectrumx.models.base.SDSModel href "" "spectrumx.models.base.SDSModel"
A file in SDS.
Attributes:
| Name | Type | Description |
|---|---|---|
created_at |
datetime
|
The timestamp when the file was created. |
directory |
Annotated[PurePosixPath, Field(default_factory=PurePosixPath)]
|
The path to the file, relative to the user storage in SDS. |
expiration_date |
datetime | None
|
The date when the file will be marked for deletion from SDS. |
media_type |
str
|
The MIME type of the file. |
name |
str
|
The user-defined name for this file. |
permissions |
UnixPermissionStr
|
The permissions for the file. |
size |
int
|
The size of the file in bytes. |
sum_blake3 |
str | None
|
The BLAKE3 checksum of the file. |
updated_at |
datetime
|
The timestamp when the file was last updated. |
uuid |
UUID4 | None
|
The unique identifier of the file in SDS. |
# |
local attributes
|
|
is_sample |
bool
|
Sample files are not written to disk (used in dry-run mode) |
local_path |
Path | None
|
The path to the file on the local filesystem (includes name) |
Methods:
| Name | Description |
|---|---|
compute_sum_blake3 |
Calculates the BLAKE3 checksum of the file. |
is_same_contents |
Checks if the file has the same contents as another local file. |
model_post_init |
Post-initialization steps. |
path
property
Returns the path to the file, relative to the owner's root on SDS.
compute_sum_blake3
Calculates the BLAKE3 checksum of the file.
If the file is currently being downloaded, this method will block until the download is complete or terminated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
when True, waits until the file contents are unlocked. |
required |
Returns: The BLAKE3 checksum of the file, OR None if the file is not available locally.
Source code in spectrumx/models/files/file.py
is_same_contents
is_same_contents(
other: File, *, verbose: bool = False
) -> bool
Checks if the file has the same contents as another local file.
Source code in spectrumx/models/files/file.py
PermissionRepresentation
Bases: StrEnum
flowchart TD
spectrumx.models.files.PermissionRepresentation[PermissionRepresentation]
click spectrumx.models.files.PermissionRepresentation href "" "spectrumx.models.files.PermissionRepresentation"
Modules
file
File model for SpectrumX.
Classes:
| Name | Description |
|---|---|
File |
A file in SDS. |
File
Bases: SDSModel
flowchart TD
spectrumx.models.files.file.File[File]
spectrumx.models.base.SDSModel[SDSModel]
spectrumx.models.base.SDSModel --> spectrumx.models.files.file.File
click spectrumx.models.files.file.File href "" "spectrumx.models.files.file.File"
click spectrumx.models.base.SDSModel href "" "spectrumx.models.base.SDSModel"
A file in SDS.
Attributes:
| Name | Type | Description |
|---|---|---|
created_at |
datetime
|
The timestamp when the file was created. |
directory |
Annotated[PurePosixPath, Field(default_factory=PurePosixPath)]
|
The path to the file, relative to the user storage in SDS. |
expiration_date |
datetime | None
|
The date when the file will be marked for deletion from SDS. |
media_type |
str
|
The MIME type of the file. |
name |
str
|
The user-defined name for this file. |
permissions |
UnixPermissionStr
|
The permissions for the file. |
size |
int
|
The size of the file in bytes. |
sum_blake3 |
str | None
|
The BLAKE3 checksum of the file. |
updated_at |
datetime
|
The timestamp when the file was last updated. |
uuid |
UUID4 | None
|
The unique identifier of the file in SDS. |
# |
local attributes
|
|
is_sample |
bool
|
Sample files are not written to disk (used in dry-run mode) |
local_path |
Path | None
|
The path to the file on the local filesystem (includes name) |
Methods:
| Name | Description |
|---|---|
compute_sum_blake3 |
Calculates the BLAKE3 checksum of the file. |
is_same_contents |
Checks if the file has the same contents as another local file. |
model_post_init |
Post-initialization steps. |
path
property
Returns the path to the file, relative to the owner's root on SDS.
compute_sum_blake3
Calculates the BLAKE3 checksum of the file.
If the file is currently being downloaded, this method will block until the download is complete or terminated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
when True, waits until the file contents are unlocked. |
required |
Returns: The BLAKE3 checksum of the file, OR None if the file is not available locally.
Source code in spectrumx/models/files/file.py
is_same_contents
is_same_contents(
other: File, *, verbose: bool = False
) -> bool
Checks if the file has the same contents as another local file.
Source code in spectrumx/models/files/file.py
permission
Classes:
| Name | Description |
|---|---|
PermissionRepresentation |
|
PermissionRepresentation
Bases: StrEnum
flowchart TD
spectrumx.models.files.permission.PermissionRepresentation[PermissionRepresentation]
click spectrumx.models.files.permission.PermissionRepresentation href "" "spectrumx.models.files.permission.PermissionRepresentation"
octal_to_unix_perm_string
Convert an octal Unix file permission to a string representation.
:param value: An int representing the file permission in octal format (e.g., 0o755) :return: A 9-character string representing Unix permissions (e.g., 'rwxr-xr-x') :raises ValueError: If the input is not a valid octal Unix permission.
Source code in spectrumx/models/files/permission.py
serialize_unix_permission
Serialize Unix permission based on context (octal or string).
Source code in spectrumx/models/files/permission.py
unix_perm_string_to_octal
Convert a Unix permission string (e.g., 'rwxr-xr-x') to an octal integer.
:param value: A 9-character Unix permission string (e.g., 'rw-r--r--') :return: An integer representing the octal value of the permission (e.g., 0o755) :raises ValueError: If the input string is not a valid Unix permission string.