resource π
Interface to the struct vaccel_resource C object.
Resource π
Bases: CType
Wrapper for the struct vaccel_resource C object.
Manages the creation and initialization of a C struct vaccel_resource and provides access to it through Python properties.
Inherits
CType: Abstract base class for defining C data types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| list[Path] | list[str] | Path | str | The path(s) to the file(s) that will be represented by the resource. | required |
| ResourceType | The type of the resource. | required |
Source code in vaccel/resource.py
value property π
Returns the value of the underlying C struct.
Returns:
| Type | Description |
|---|---|
CData | The dereferenced 'struct vaccel_resource` |
from_buffer classmethod π
Initializes a new Resource object from byte-like data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| bytes | bytearray | memoryview | The data to be passed to the C struct. | required |
| ResourceType | The type of the resource. | required |
Returns:
| Type | Description |
|---|---|
Resource | A new |
Source code in vaccel/resource.py
from_numpy classmethod π
Initializes a new Resource object from a NumPy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ndarray | The NumPy array containing the resource data. | required |
Returns:
| Type | Description |
|---|---|
Resource | A new |
Raises:
| Type | Description |
|---|---|
NotImplementedError | If NumPy is not installed. |
Source code in vaccel/resource.py
register π
register(session: BaseSession) -> None
Registers the resource with a session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| BaseSession | The session to register the resource with. | required |
Raises:
| Type | Description |
|---|---|
FFIError | If resource registration fails. |
Source code in vaccel/resource.py
sync π
sync(session: BaseSession) -> None
Synchronizes the resource data to reflect any remote changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| BaseSession | The session the resource is registered with. | required |
Raises:
| Type | Description |
|---|---|
FFIError | If resource synchronization fails. |
Source code in vaccel/resource.py
unregister π
unregister(session: BaseSession) -> None
Unregisters the resource from a session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| BaseSession | The session to unregister the resource from. | required |
Raises:
| Type | Description |
|---|---|
FFIError | If resource unregistration fails. |