omnipy.shared.protocols.data
Protocols for Omnipy data models, datasets, serializers, and reactive state.
| CLASS | DESCRIPTION |
|---|---|
AvailableDisplayDims |
Display-space dimensions available for rendering, in pixels. |
HasContent |
Object with a typed |
HasData |
Object exposing an internal mapping of loaded, pending, and failed items. |
IsDataClassCreator |
Factory/service protocol that wires config, reactive state, and snapshots. |
IsDataset |
Dictionary-like collection of named models or nested datasets. |
IsFailedData |
Metadata describing a dataset entry whose asynchronous load failed. |
IsHttpUrlDataset |
Dataset protocol for collections of HTTP URL model entries. |
IsHttpUrlModel |
Model protocol representing a validated HTTP URL value. |
IsModel |
Single-value data wrapper with typed content and conversion support. |
IsMultiModelDataset |
Dataset protocol that can assign different model classes per item. |
IsPendingData |
Metadata describing a dataset entry that is still processing. |
IsReactive |
Mutable reactive value wrapper used for config/state propagation. |
IsReactiveObjects |
Bundle of reactive objects shared by display and configuration layers. |
IsSerializer |
Serializer interface for converting datasets to and from bytes. |
IsSerializerRegistry |
Registry that tracks serializers and selects suitable ones for datasets. |
IsSnapshotHolder |
Container protocol managing snapshots used for deepcopy/reactive tracking. |
IsSnapshotWrapper |
Snapshot record linking an object identity to captured content. |
IsTarFileSerializer |
Serializer extension that stores dataset entries inside tar archives. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
ContentT |
|
HasContentT |
|
IsPathOrUrl |
TYPE:
|
IsPathsOrUrls |
TYPE:
|
IsPathsOrUrlsOneOrMore |
TYPE:
|
IsPathsOrUrlsOneOrMoreOrNone |
TYPE:
|
ObjContraT |
|
ContentT
module-attribute
HasContentT
module-attribute
-
Reference
Code reference
omnipy
shared
protocols
dataIsDataClassCreatorsnapshot_holder
- Reference Code reference omnipy
- Reference Code reference omnipy
IsPathOrUrl
module-attribute
IsPathsOrUrls
module-attribute
IsPathsOrUrlsOneOrMore
module-attribute
IsPathsOrUrlsOneOrMoreOrNone
module-attribute
ObjContraT
module-attribute
AvailableDisplayDims
Bases: TypedDict
flowchart BT
omnipy.shared.protocols.data.AvailableDisplayDims[AvailableDisplayDims]
click omnipy.shared.protocols.data.AvailableDisplayDims href "" "omnipy.shared.protocols.data.AvailableDisplayDims"
Display-space dimensions available for rendering, in pixels.
-
Reference
Code reference
omnipy
shared
protocols
dataIsReactiveObjectsavailable_display_dims_in_px
| ATTRIBUTE | DESCRIPTION |
|---|---|
height |
TYPE:
|
width |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
HasContent
Bases: Protocol[ContentT]
flowchart BT
omnipy.shared.protocols.data.HasContent[HasContent]
click omnipy.shared.protocols.data.HasContent href "" "omnipy.shared.protocols.data.HasContent"
Object with a typed content value that can be read or replaced.
| ATTRIBUTE | DESCRIPTION |
|---|---|
content |
Return the wrapped content value.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
HasData
Bases: Protocol
flowchart BT
omnipy.shared.protocols.data.HasData[HasData]
click omnipy.shared.protocols.data.HasData href "" "omnipy.shared.protocols.data.HasData"
Object exposing an internal mapping of loaded, pending, and failed items.
| ATTRIBUTE | DESCRIPTION |
|---|---|
data |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsDataClassCreator
Bases: Protocol[HasContentT, ContentT]
flowchart BT
omnipy.shared.protocols.data.IsDataClassCreator[IsDataClassCreator]
click omnipy.shared.protocols.data.IsDataClassCreator href "" "omnipy.shared.protocols.data.IsDataClassCreator"
Factory/service protocol that wires config, reactive state, and snapshots.
- Reference Code reference omnipy
| METHOD | DESCRIPTION |
|---|---|
deepcopy_context |
Return a context manager for coordinated deepcopy bookkeeping. |
set_config |
Replace the shared data configuration for the owning data-class family. |
set_reactive_objects |
Store the shared bundle of reactive runtime objects. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
config |
Return the data configuration shared by the owning data-class family.
TYPE:
|
reactive_objects |
Return the shared bundle of reactive runtime objects, if configured.
TYPE:
|
snapshot_holder |
Return the snapshot manager used for deepcopy and reactive tracking.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
config
property
config: IsDataConfig
Return the data configuration shared by the owning data-class family.
| RETURNS | DESCRIPTION |
|---|---|
IsDataConfig
|
Shared configuration object used by related models and datasets.
TYPE:
|
reactive_objects
property
reactive_objects: IsReactiveObjects | None
Return the shared bundle of reactive runtime objects, if configured.
| RETURNS | DESCRIPTION |
|---|---|
IsReactiveObjects | None
|
IsReactiveObjects | None: Shared reactive-object bundle, or |
snapshot_holder
property
snapshot_holder: IsSnapshotHolder[HasContentT, ContentT]
Return the snapshot manager used for deepcopy and reactive tracking.
| RETURNS | DESCRIPTION |
|---|---|
IsSnapshotHolder[HasContentT, ContentT]
|
IsSnapshotHolder[HasContentT, ContentT]: Snapshot manager for related objects. |
deepcopy_context
deepcopy_context(
top_level_entry_func: Callable[[], None], top_level_exit_func: Callable[[], None]
) -> ContextManager[int]
Return a context manager for coordinated deepcopy bookkeeping.
| PARAMETER | DESCRIPTION |
|---|---|
top_level_entry_func
|
Callback invoked when entering the outermost deepcopy.
TYPE:
|
top_level_exit_func
|
Callback invoked when leaving the outermost deepcopy.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ContextManager[int]
|
ContextManager[int]: Context manager tracking nested deepcopy depth. |
Source code in src/omnipy/shared/protocols/data.py
set_config
set_config(config: IsDataConfig) -> None
Replace the shared data configuration for the owning data-class family.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Data configuration object to store for related models and datasets.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
set_reactive_objects
set_reactive_objects(reactive_objects: IsReactiveObjects) -> None
Store the shared bundle of reactive runtime objects.
| PARAMETER | DESCRIPTION |
|---|---|
reactive_objects
|
Reactive-object bundle to share with related data classes.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsDataset
Bases: IsMutableMapping[str, _ModelOrDatasetT], Protocol[_ModelOrDatasetT]
flowchart BT
omnipy.shared.protocols.data.IsDataset[IsDataset]
omnipy.shared.protocols.typing.IsMutableMapping[IsMutableMapping]
omnipy.shared.protocols.typing.IsMapping[IsMapping]
omnipy.shared.protocols.typing.IsMutableMapping --> omnipy.shared.protocols.data.IsDataset
omnipy.shared.protocols.typing.IsMapping --> omnipy.shared.protocols.typing.IsMutableMapping
click omnipy.shared.protocols.data.IsDataset href "" "omnipy.shared.protocols.data.IsDataset"
click omnipy.shared.protocols.typing.IsMutableMapping href "" "omnipy.shared.protocols.typing.IsMutableMapping"
click omnipy.shared.protocols.typing.IsMapping href "" "omnipy.shared.protocols.typing.IsMapping"
Dictionary-like collection of named models or nested datasets.
Datasets expose conversion helpers for plain data, JSON, and file-based load/save operations.
-
Reference
Code reference
omnipy
- components
-
data
serializer -
shared
protocols
-
data -
compute
job-
IsAnyFlowoutput_dataset_cls -
IsAnyFlowTemplateoutput_dataset_cls -
IsChildJobListArgJoboutput_dataset_cls -
IsChildJobListArgJobBaseoutput_dataset_cls -
IsChildJobListArgJobTemplateoutput_dataset_cls -
IsDagFlowoutput_dataset_cls -
IsDagFlowTemplateoutput_dataset_cls -
IsFuncArgJoboutput_dataset_cls -
IsFuncArgJobBaseoutput_dataset_cls -
IsFuncArgJobTemplateoutput_dataset_cls -
IsFuncFlowoutput_dataset_cls -
IsFuncFlowTemplateoutput_dataset_cls -
IsLinearFlowoutput_dataset_cls -
IsLinearFlowTemplateoutput_dataset_cls -
IsTaskoutput_dataset_cls -
IsTaskTemplateoutput_dataset_cls
-
-
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
clear |
D.clear() -> None. Remove all items from D. |
failed_task_details |
Return failure metadata for entries whose processing failed. |
from_data |
Populate the dataset from plain Python data. |
from_json |
Populate the dataset from JSON-encoded entries. |
get |
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
get_type |
Return the item type stored by this dataset class. |
keys |
D.keys() -> a set-like object providing a view on D's keys |
load |
Load dataset content from one or more paths or URLs. |
load_into |
Load external content into the current dataset instance. |
pending_task_details |
Return metadata for entries that are still processing. |
pop |
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. |
popitem |
D.popitem() -> (k, v), remove and return some (key, value) pair |
save |
Persist the dataset to a filesystem path. |
setdefault |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
to_data |
Convert the dataset to plain Python data. |
to_json |
Serialize the dataset to JSON strings. |
to_json_schema |
Return the JSON schema for this dataset type. |
update |
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. |
values |
D.values() -> an object providing a view on D's values |
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_data |
Return a view containing only successfully available entries.
TYPE:
|
failed_data |
Return a view containing entries whose processing failed.
TYPE:
|
pending_data |
Return a view containing entries that are still processing.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
available_data
property
Return a view containing only successfully available entries.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries whose content is already available.
TYPE:
|
failed_data
property
Return a view containing entries whose processing failed.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries associated with failures.
TYPE:
|
pending_data
property
Return a view containing entries that are still processing.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries backed by pending work.
TYPE:
|
__init__
__init__(
value: Mapping[str, object] | Iterator[tuple[str, object]] | UndefinedType = Undefined,
*,
data: Mapping[str, object] | UndefinedType = Undefined,
**input_data: object,
) -> None
clear
failed_task_details
failed_task_details() -> dict[str, IsFailedData]
Return failure metadata for entries whose processing failed.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, IsFailedData]
|
dict[str, IsFailedData]: Failure metadata keyed by dataset entry name. |
from_data
Populate the dataset from plain Python data.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Plain-data mapping or iterable of key-value pairs to import.
TYPE:
|
update
|
Whether imported values should merge into existing content.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
from_json
Populate the dataset from JSON-encoded entries.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
JSON strings keyed by dataset entry name.
TYPE:
|
update
|
Whether imported values should merge into existing content.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
get
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
get_type
cached
classmethod
Return the item type stored by this dataset class.
| RETURNS | DESCRIPTION |
|---|---|
type[_ModelOrDatasetT]
|
type[_ModelOrDatasetT]: Model or nested-dataset type used for items. |
Source code in src/omnipy/shared/protocols/data.py
keys
keys() -> IsKeysView[_KT]
load
classmethod
load(
paths_or_urls: IsPathsOrUrlsOneOrMoreOrNone = None,
by_file_suffix: bool = False,
as_mime_type: None | str = None,
**kwargs: IsPathOrUrl,
) -> Self | asyncio.Task[Self]
Load dataset content from one or more paths or URLs.
| PARAMETER | DESCRIPTION |
|---|---|
paths_or_urls
|
Source path, URL, or collection of sources to load.
TYPE:
|
by_file_suffix
|
Whether serializer lookup should prefer file suffixes.
TYPE:
|
as_mime_type
|
Explicit MIME type override, if any.
TYPE:
|
kwargs
|
Additional named path or URL sources.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self | asyncio.Task[Self]
|
Self | asyncio.Task[Self]: Loaded dataset or asynchronous load task. |
Source code in src/omnipy/shared/protocols/data.py
load_into
load_into(
paths_or_urls: IsPathsOrUrlsOneOrMoreOrNone = None,
by_file_suffix: bool = False,
as_mime_type: None | str = None,
**kwargs: IsPathOrUrl,
) -> Self | asyncio.Task[Self]
Load external content into the current dataset instance.
| PARAMETER | DESCRIPTION |
|---|---|
paths_or_urls
|
Source path, URL, or collection of sources to load.
TYPE:
|
by_file_suffix
|
Whether serializer lookup should prefer file suffixes.
TYPE:
|
as_mime_type
|
Explicit MIME type override, if any.
TYPE:
|
kwargs
|
Additional named path or URL sources.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self | asyncio.Task[Self]
|
Self | asyncio.Task[Self]: Updated dataset or asynchronous load task. |
Source code in src/omnipy/shared/protocols/data.py
pending_task_details
pending_task_details() -> dict[str, IsPendingData]
Return metadata for entries that are still processing.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, IsPendingData]
|
dict[str, IsPendingData]: Pending metadata keyed by dataset entry name. |
pop
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
Source code in src/omnipy/shared/protocols/typing.py
popitem
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.
save
Persist the dataset to a filesystem path.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
Destination path for the serialized dataset.
TYPE:
|
setdefault
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
to_data
Convert the dataset to plain Python data.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
dict[str, Any]: Plain-data representation keyed by dataset entry name. |
to_json
Serialize the dataset to JSON strings.
| PARAMETER | DESCRIPTION |
|---|---|
pretty
|
Whether to format the JSON output for readability.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, str]
|
dict[str, str]: JSON representation for each dataset entry. |
Source code in src/omnipy/shared/protocols/data.py
to_json_schema
classmethod
Return the JSON schema for this dataset type.
| PARAMETER | DESCRIPTION |
|---|---|
pretty
|
Whether to format the schema output for readability.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
str | dict[str, str]
|
str | dict[str, str]: JSON schema as one string or per-entry mapping. |
Source code in src/omnipy/shared/protocols/data.py
update
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
Source code in src/omnipy/shared/protocols/typing.py
values
values() -> IsValuesView[_VT_co]
IsFailedData
dataclass
Bases: Protocol
flowchart BT
omnipy.shared.protocols.data.IsFailedData[IsFailedData]
click omnipy.shared.protocols.data.IsFailedData href "" "omnipy.shared.protocols.data.IsFailedData"
Metadata describing a dataset entry whose asynchronous load failed.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
exception |
TYPE:
|
job_name |
TYPE:
|
job_unique_name |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsHttpUrlDataset
Bases: IsDataset, Protocol
flowchart BT
omnipy.shared.protocols.data.IsHttpUrlDataset[IsHttpUrlDataset]
omnipy.shared.protocols.data.IsDataset[IsDataset]
omnipy.shared.protocols.typing.IsMutableMapping[IsMutableMapping]
omnipy.shared.protocols.typing.IsMapping[IsMapping]
omnipy.shared.protocols.data.IsDataset --> omnipy.shared.protocols.data.IsHttpUrlDataset
omnipy.shared.protocols.typing.IsMutableMapping --> omnipy.shared.protocols.data.IsDataset
omnipy.shared.protocols.typing.IsMapping --> omnipy.shared.protocols.typing.IsMutableMapping
click omnipy.shared.protocols.data.IsHttpUrlDataset href "" "omnipy.shared.protocols.data.IsHttpUrlDataset"
click omnipy.shared.protocols.data.IsDataset href "" "omnipy.shared.protocols.data.IsDataset"
click omnipy.shared.protocols.typing.IsMutableMapping href "" "omnipy.shared.protocols.typing.IsMutableMapping"
click omnipy.shared.protocols.typing.IsMapping href "" "omnipy.shared.protocols.typing.IsMapping"
Dataset protocol for collections of HTTP URL model entries.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
clear |
D.clear() -> None. Remove all items from D. |
failed_task_details |
Return failure metadata for entries whose processing failed. |
from_data |
Populate the dataset from plain Python data. |
from_json |
Populate the dataset from JSON-encoded entries. |
get |
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
get_type |
Return the item type stored by this dataset class. |
keys |
D.keys() -> a set-like object providing a view on D's keys |
load |
Load dataset content from one or more paths or URLs. |
load_into |
Load external content into the current dataset instance. |
pending_task_details |
Return metadata for entries that are still processing. |
pop |
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. |
popitem |
D.popitem() -> (k, v), remove and return some (key, value) pair |
save |
Persist the dataset to a filesystem path. |
setdefault |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
to_data |
Convert the dataset to plain Python data. |
to_json |
Serialize the dataset to JSON strings. |
to_json_schema |
Return the JSON schema for this dataset type. |
update |
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. |
values |
D.values() -> an object providing a view on D's values |
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_data |
Return a view containing only successfully available entries.
TYPE:
|
failed_data |
Return a view containing entries whose processing failed.
TYPE:
|
pending_data |
Return a view containing entries that are still processing.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
available_data
property
Return a view containing only successfully available entries.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries whose content is already available.
TYPE:
|
failed_data
property
Return a view containing entries whose processing failed.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries associated with failures.
TYPE:
|
pending_data
property
Return a view containing entries that are still processing.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries backed by pending work.
TYPE:
|
__init__
__init__(
value: Mapping[str, object] | Iterator[tuple[str, object]] | UndefinedType = Undefined,
*,
data: Mapping[str, object] | UndefinedType = Undefined,
**input_data: object,
) -> None
clear
failed_task_details
failed_task_details() -> dict[str, IsFailedData]
Return failure metadata for entries whose processing failed.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, IsFailedData]
|
dict[str, IsFailedData]: Failure metadata keyed by dataset entry name. |
from_data
Populate the dataset from plain Python data.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Plain-data mapping or iterable of key-value pairs to import.
TYPE:
|
update
|
Whether imported values should merge into existing content.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
from_json
Populate the dataset from JSON-encoded entries.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
JSON strings keyed by dataset entry name.
TYPE:
|
update
|
Whether imported values should merge into existing content.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
get
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
get_type
cached
classmethod
Return the item type stored by this dataset class.
| RETURNS | DESCRIPTION |
|---|---|
type[_ModelOrDatasetT]
|
type[_ModelOrDatasetT]: Model or nested-dataset type used for items. |
Source code in src/omnipy/shared/protocols/data.py
keys
keys() -> IsKeysView[_KT]
load
classmethod
load(
paths_or_urls: IsPathsOrUrlsOneOrMoreOrNone = None,
by_file_suffix: bool = False,
as_mime_type: None | str = None,
**kwargs: IsPathOrUrl,
) -> Self | asyncio.Task[Self]
Load dataset content from one or more paths or URLs.
| PARAMETER | DESCRIPTION |
|---|---|
paths_or_urls
|
Source path, URL, or collection of sources to load.
TYPE:
|
by_file_suffix
|
Whether serializer lookup should prefer file suffixes.
TYPE:
|
as_mime_type
|
Explicit MIME type override, if any.
TYPE:
|
kwargs
|
Additional named path or URL sources.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self | asyncio.Task[Self]
|
Self | asyncio.Task[Self]: Loaded dataset or asynchronous load task. |
Source code in src/omnipy/shared/protocols/data.py
load_into
load_into(
paths_or_urls: IsPathsOrUrlsOneOrMoreOrNone = None,
by_file_suffix: bool = False,
as_mime_type: None | str = None,
**kwargs: IsPathOrUrl,
) -> Self | asyncio.Task[Self]
Load external content into the current dataset instance.
| PARAMETER | DESCRIPTION |
|---|---|
paths_or_urls
|
Source path, URL, or collection of sources to load.
TYPE:
|
by_file_suffix
|
Whether serializer lookup should prefer file suffixes.
TYPE:
|
as_mime_type
|
Explicit MIME type override, if any.
TYPE:
|
kwargs
|
Additional named path or URL sources.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self | asyncio.Task[Self]
|
Self | asyncio.Task[Self]: Updated dataset or asynchronous load task. |
Source code in src/omnipy/shared/protocols/data.py
pending_task_details
pending_task_details() -> dict[str, IsPendingData]
Return metadata for entries that are still processing.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, IsPendingData]
|
dict[str, IsPendingData]: Pending metadata keyed by dataset entry name. |
pop
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
Source code in src/omnipy/shared/protocols/typing.py
popitem
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.
save
Persist the dataset to a filesystem path.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
Destination path for the serialized dataset.
TYPE:
|
setdefault
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
to_data
Convert the dataset to plain Python data.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
dict[str, Any]: Plain-data representation keyed by dataset entry name. |
to_json
Serialize the dataset to JSON strings.
| PARAMETER | DESCRIPTION |
|---|---|
pretty
|
Whether to format the JSON output for readability.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, str]
|
dict[str, str]: JSON representation for each dataset entry. |
Source code in src/omnipy/shared/protocols/data.py
to_json_schema
classmethod
Return the JSON schema for this dataset type.
| PARAMETER | DESCRIPTION |
|---|---|
pretty
|
Whether to format the schema output for readability.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
str | dict[str, str]
|
str | dict[str, str]: JSON schema as one string or per-entry mapping. |
Source code in src/omnipy/shared/protocols/data.py
update
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
Source code in src/omnipy/shared/protocols/typing.py
values
values() -> IsValuesView[_VT_co]
IsHttpUrlModel
Bases: IsModel, Protocol
flowchart BT
omnipy.shared.protocols.data.IsHttpUrlModel[IsHttpUrlModel]
omnipy.shared.protocols.data.IsModel[IsModel]
omnipy.shared.protocols.data.HasContent[HasContent]
omnipy.shared.protocols.data.IsModel --> omnipy.shared.protocols.data.IsHttpUrlModel
omnipy.shared.protocols.data.HasContent --> omnipy.shared.protocols.data.IsModel
click omnipy.shared.protocols.data.IsHttpUrlModel href "" "omnipy.shared.protocols.data.IsHttpUrlModel"
click omnipy.shared.protocols.data.IsModel href "" "omnipy.shared.protocols.data.IsModel"
click omnipy.shared.protocols.data.HasContent href "" "omnipy.shared.protocols.data.HasContent"
Model protocol representing a validated HTTP URL value.
| METHOD | DESCRIPTION |
|---|---|
full_type |
Return the fully resolved Python type represented by this model. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
content |
Return the wrapped content value.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
content
property
writable
content: ContentT
Return the wrapped content value.
| RETURNS | DESCRIPTION |
|---|---|
ContentT
|
Current content stored by the object.
TYPE:
|
full_type
classmethod
Return the fully resolved Python type represented by this model.
| RETURNS | DESCRIPTION |
|---|---|
type[_RootT]
|
type[_RootT]: Concrete Python type accepted as model content. |
IsModel
Bases: HasContent[_RootT], Protocol[_RootT]
flowchart BT
omnipy.shared.protocols.data.IsModel[IsModel]
omnipy.shared.protocols.data.HasContent[HasContent]
omnipy.shared.protocols.data.HasContent --> omnipy.shared.protocols.data.IsModel
click omnipy.shared.protocols.data.IsModel href "" "omnipy.shared.protocols.data.IsModel"
click omnipy.shared.protocols.data.HasContent href "" "omnipy.shared.protocols.data.HasContent"
Single-value data wrapper with typed content and conversion support.
-
Reference
Code reference
omnipy
shared
protocols
-
config-
IsBrowserUserInterfaceConfigas_model -
IsColorConfigas_model -
IsConfigBaseas_model -
IsDataConfigas_model -
IsDimsModeConfigas_model -
IsEngineConfigas_model -
IsFontConfigas_model -
IsHtmlUserInterfaceConfigas_model -
IsHttpConfigas_model -
IsHttpRequestsConfigas_model -
IsJobConfigas_model -
IsJobRunnerConfigas_model -
IsJupyterUserInterfaceConfigas_model -
IsLayoutConfigas_model -
IsLocalOutputStorageConfigas_model -
IsLocalRunnerConfigas_model -
IsModelConfigas_model -
IsOutputStorageConfigas_model -
IsOutputStorageConfigBaseas_model -
IsOverflowConfigas_model -
IsPrefectEngineConfigas_model -
IsRootLogConfigas_model -
IsS3OutputStorageConfigas_model -
IsTerminalUserInterfaceConfigas_model -
IsTextConfigas_model -
IsUserInterfaceConfigas_model -
IsUserInterfaceTypeConfigas_model
-
-
dataIsMultiModelDatasetget_model -
hub
runtimeIsRuntimeConfigas_model
-
-
Reference
Code reference
omnipy
shared
protocols
dataIsHttpUrlModel
| METHOD | DESCRIPTION |
|---|---|
full_type |
Return the fully resolved Python type represented by this model. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
content |
Return the wrapped content value.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
content
property
writable
content: ContentT
Return the wrapped content value.
| RETURNS | DESCRIPTION |
|---|---|
ContentT
|
Current content stored by the object.
TYPE:
|
full_type
classmethod
Return the fully resolved Python type represented by this model.
| RETURNS | DESCRIPTION |
|---|---|
type[_RootT]
|
type[_RootT]: Concrete Python type accepted as model content. |
IsMultiModelDataset
Bases: IsDataset[_ModelOrDatasetT], Protocol[_ModelOrDatasetT]
flowchart BT
omnipy.shared.protocols.data.IsMultiModelDataset[IsMultiModelDataset]
omnipy.shared.protocols.data.IsDataset[IsDataset]
omnipy.shared.protocols.typing.IsMutableMapping[IsMutableMapping]
omnipy.shared.protocols.typing.IsMapping[IsMapping]
omnipy.shared.protocols.data.IsDataset --> omnipy.shared.protocols.data.IsMultiModelDataset
omnipy.shared.protocols.typing.IsMutableMapping --> omnipy.shared.protocols.data.IsDataset
omnipy.shared.protocols.typing.IsMapping --> omnipy.shared.protocols.typing.IsMutableMapping
click omnipy.shared.protocols.data.IsMultiModelDataset href "" "omnipy.shared.protocols.data.IsMultiModelDataset"
click omnipy.shared.protocols.data.IsDataset href "" "omnipy.shared.protocols.data.IsDataset"
click omnipy.shared.protocols.typing.IsMutableMapping href "" "omnipy.shared.protocols.typing.IsMutableMapping"
click omnipy.shared.protocols.typing.IsMapping href "" "omnipy.shared.protocols.typing.IsMapping"
Dataset protocol that can assign different model classes per item.
- Reference Code reference
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
clear |
D.clear() -> None. Remove all items from D. |
failed_task_details |
Return failure metadata for entries whose processing failed. |
from_data |
Populate the dataset from plain Python data. |
from_json |
Populate the dataset from JSON-encoded entries. |
get |
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
get_model |
Return the model class associated with one dataset entry. |
get_type |
Return the item type stored by this dataset class. |
keys |
D.keys() -> a set-like object providing a view on D's keys |
load |
Load dataset content from one or more paths or URLs. |
load_into |
Load external content into the current dataset instance. |
pending_task_details |
Return metadata for entries that are still processing. |
pop |
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. |
popitem |
D.popitem() -> (k, v), remove and return some (key, value) pair |
save |
Persist the dataset to a filesystem path. |
set_model |
Assign a model class to one dataset entry. |
setdefault |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
to_data |
Convert the dataset to plain Python data. |
to_json |
Serialize the dataset to JSON strings. |
to_json_schema |
Return the JSON schema for this dataset type. |
update |
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. |
values |
D.values() -> an object providing a view on D's values |
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_data |
Return a view containing only successfully available entries.
TYPE:
|
failed_data |
Return a view containing entries whose processing failed.
TYPE:
|
pending_data |
Return a view containing entries that are still processing.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
available_data
property
Return a view containing only successfully available entries.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries whose content is already available.
TYPE:
|
failed_data
property
Return a view containing entries whose processing failed.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries associated with failures.
TYPE:
|
pending_data
property
Return a view containing entries that are still processing.
| RETURNS | DESCRIPTION |
|---|---|
Self
|
Dataset containing entries backed by pending work.
TYPE:
|
__init__
__init__(
value: Mapping[str, object] | Iterator[tuple[str, object]] | UndefinedType = Undefined,
*,
data: Mapping[str, object] | UndefinedType = Undefined,
**input_data: object,
) -> None
clear
failed_task_details
failed_task_details() -> dict[str, IsFailedData]
Return failure metadata for entries whose processing failed.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, IsFailedData]
|
dict[str, IsFailedData]: Failure metadata keyed by dataset entry name. |
from_data
Populate the dataset from plain Python data.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Plain-data mapping or iterable of key-value pairs to import.
TYPE:
|
update
|
Whether imported values should merge into existing content.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
from_json
Populate the dataset from JSON-encoded entries.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
JSON strings keyed by dataset entry name.
TYPE:
|
update
|
Whether imported values should merge into existing content.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
get
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
get_model
get_model(data_file: str) -> type[IsModel]
Return the model class associated with one dataset entry.
| PARAMETER | DESCRIPTION |
|---|---|
data_file
|
Entry name whose model should be returned.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
type[IsModel]
|
type[IsModel]: Model class associated with that entry. |
Source code in src/omnipy/shared/protocols/data.py
get_type
cached
classmethod
Return the item type stored by this dataset class.
| RETURNS | DESCRIPTION |
|---|---|
type[_ModelOrDatasetT]
|
type[_ModelOrDatasetT]: Model or nested-dataset type used for items. |
Source code in src/omnipy/shared/protocols/data.py
keys
keys() -> IsKeysView[_KT]
load
classmethod
load(
paths_or_urls: IsPathsOrUrlsOneOrMoreOrNone = None,
by_file_suffix: bool = False,
as_mime_type: None | str = None,
**kwargs: IsPathOrUrl,
) -> Self | asyncio.Task[Self]
Load dataset content from one or more paths or URLs.
| PARAMETER | DESCRIPTION |
|---|---|
paths_or_urls
|
Source path, URL, or collection of sources to load.
TYPE:
|
by_file_suffix
|
Whether serializer lookup should prefer file suffixes.
TYPE:
|
as_mime_type
|
Explicit MIME type override, if any.
TYPE:
|
kwargs
|
Additional named path or URL sources.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self | asyncio.Task[Self]
|
Self | asyncio.Task[Self]: Loaded dataset or asynchronous load task. |
Source code in src/omnipy/shared/protocols/data.py
load_into
load_into(
paths_or_urls: IsPathsOrUrlsOneOrMoreOrNone = None,
by_file_suffix: bool = False,
as_mime_type: None | str = None,
**kwargs: IsPathOrUrl,
) -> Self | asyncio.Task[Self]
Load external content into the current dataset instance.
| PARAMETER | DESCRIPTION |
|---|---|
paths_or_urls
|
Source path, URL, or collection of sources to load.
TYPE:
|
by_file_suffix
|
Whether serializer lookup should prefer file suffixes.
TYPE:
|
as_mime_type
|
Explicit MIME type override, if any.
TYPE:
|
kwargs
|
Additional named path or URL sources.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self | asyncio.Task[Self]
|
Self | asyncio.Task[Self]: Updated dataset or asynchronous load task. |
Source code in src/omnipy/shared/protocols/data.py
pending_task_details
pending_task_details() -> dict[str, IsPendingData]
Return metadata for entries that are still processing.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, IsPendingData]
|
dict[str, IsPendingData]: Pending metadata keyed by dataset entry name. |
pop
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
Source code in src/omnipy/shared/protocols/typing.py
popitem
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.
save
Persist the dataset to a filesystem path.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
Destination path for the serialized dataset.
TYPE:
|
set_model
set_model(data_file: str, model: type[IsModel]) -> None
Assign a model class to one dataset entry.
| PARAMETER | DESCRIPTION |
|---|---|
data_file
|
Entry name whose model should be updated.
TYPE:
|
model
|
Model class to associate with that entry.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
setdefault
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
to_data
Convert the dataset to plain Python data.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
dict[str, Any]: Plain-data representation keyed by dataset entry name. |
to_json
Serialize the dataset to JSON strings.
| PARAMETER | DESCRIPTION |
|---|---|
pretty
|
Whether to format the JSON output for readability.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, str]
|
dict[str, str]: JSON representation for each dataset entry. |
Source code in src/omnipy/shared/protocols/data.py
to_json_schema
classmethod
Return the JSON schema for this dataset type.
| PARAMETER | DESCRIPTION |
|---|---|
pretty
|
Whether to format the schema output for readability.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
str | dict[str, str]
|
str | dict[str, str]: JSON schema as one string or per-entry mapping. |
Source code in src/omnipy/shared/protocols/data.py
update
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
Source code in src/omnipy/shared/protocols/typing.py
values
values() -> IsValuesView[_VT_co]
IsPendingData
dataclass
Bases: Protocol
flowchart BT
omnipy.shared.protocols.data.IsPendingData[IsPendingData]
click omnipy.shared.protocols.data.IsPendingData href "" "omnipy.shared.protocols.data.IsPendingData"
Metadata describing a dataset entry that is still processing.
Used for items backed by asynchronous work that has not completed yet.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
job_name |
TYPE:
|
job_unique_name |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsReactive
Bases: Protocol[ContentT]
flowchart BT
omnipy.shared.protocols.data.IsReactive[IsReactive]
click omnipy.shared.protocols.data.IsReactive href "" "omnipy.shared.protocols.data.IsReactive"
Mutable reactive value wrapper used for config/state propagation.
-
Reference
Code reference
omnipy
shared
protocols
dataIsReactiveObjects
| METHOD | DESCRIPTION |
|---|---|
set |
Replace the current reactive value. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
value |
Return the current reactive value.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsReactiveObjects
Bases: Protocol
flowchart BT
omnipy.shared.protocols.data.IsReactiveObjects[IsReactiveObjects]
click omnipy.shared.protocols.data.IsReactiveObjects href "" "omnipy.shared.protocols.data.IsReactiveObjects"
Bundle of reactive objects shared by display and configuration layers.
- Reference Code reference omnipy
-
Reference
Code reference
omnipy
shared
protocols
dataIsDataClassCreatorset_reactive_objects
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_display_dims_in_px |
TYPE:
|
jupyter_ui_config |
|
layout_config |
TYPE:
|
obj_id_update_flags |
TYPE:
|
text_config |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
available_display_dims_in_px
instance-attribute
available_display_dims_in_px: IsReactive[AvailableDisplayDims]
IsSerializer
Bases: Protocol[_DatasetT]
flowchart BT
omnipy.shared.protocols.data.IsSerializer[IsSerializer]
click omnipy.shared.protocols.data.IsSerializer href "" "omnipy.shared.protocols.data.IsSerializer"
Serializer interface for converting datasets to and from bytes.
- Reference Code reference omnipy
-
Reference
Code reference
omnipy
shared
protocols
dataIsTarFileSerializer
- Reference Code reference omnipy
| METHOD | DESCRIPTION |
|---|---|
deserialize |
Deserialize a bytes payload into a dataset instance. |
get_dataset_cls_for_new |
Return the dataset class this serializer creates when deserializing. |
get_output_file_suffix |
Return the default file suffix produced by this serializer. |
is_dataset_directly_supported |
Return whether the serializer can handle the dataset as-is. |
serialize |
Serialize a dataset into a bytes-like payload. |
Source code in src/omnipy/shared/protocols/data.py
deserialize
classmethod
Deserialize a bytes payload into a dataset instance.
| PARAMETER | DESCRIPTION |
|---|---|
serialized
|
Serialized dataset payload.
TYPE:
|
any_file_suffix
|
Whether suffix validation should be relaxed.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
_DatasetT
|
Deserialized dataset instance.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
get_dataset_cls_for_new
classmethod
get_dataset_cls_for_new() -> Type[IsDataset]
Return the dataset class this serializer creates when deserializing.
| RETURNS | DESCRIPTION |
|---|---|
Type[IsDataset]
|
Type[IsDataset]: Dataset class produced for fresh deserialization targets. |
Source code in src/omnipy/shared/protocols/data.py
get_output_file_suffix
classmethod
Return the default file suffix produced by this serializer.
| RETURNS | DESCRIPTION |
|---|---|
str
|
File suffix used for serialized output files.
TYPE:
|
is_dataset_directly_supported
classmethod
is_dataset_directly_supported(dataset: IsDataset) -> bool
Return whether the serializer can handle the dataset as-is.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset instance to check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
serialize
classmethod
Serialize a dataset into a bytes-like payload.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset instance to serialize.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes | memoryview
|
bytes | memoryview: Serialized dataset payload. |
Source code in src/omnipy/shared/protocols/data.py
IsSerializerRegistry
Bases: Protocol
flowchart BT
omnipy.shared.protocols.data.IsSerializerRegistry[IsSerializerRegistry]
click omnipy.shared.protocols.data.IsSerializerRegistry href "" "omnipy.shared.protocols.data.IsSerializerRegistry"
Registry that tracks serializers and selects suitable ones for datasets.
- Reference Code reference omnipy
-
Reference
Code reference
omnipy
componentsregister_serializers
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
auto_detect |
Return the best serializer match for a dataset, if any. |
auto_detect_tar_file_serializer |
Return the best tar-file serializer match for a dataset, if any. |
detect_tar_file_serializers_from_dataset_cls |
Return tar-file serializers compatible with the dataset class. |
detect_tar_file_serializers_from_file_suffix |
Return tar-file serializers matching a file suffix. |
load_from_tar_file_path_based_on_dataset_cls |
Load a tar archive into a dataset using dataset-class detection. |
load_from_tar_file_path_based_on_file_suffix |
Load a tar archive into a dataset using suffix-based detection. |
register |
Register a serializer class with the registry. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
serializers |
Return all registered serializer classes.
TYPE:
|
tar_file_serializers |
Return the registered tar-file serializer classes.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | |
serializers
property
serializers: tuple[Type[IsSerializer], ...]
Return all registered serializer classes.
| RETURNS | DESCRIPTION |
|---|---|
tuple[Type[IsSerializer], ...]
|
tuple[Type[IsSerializer], ...]: Registered serializer classes. |
tar_file_serializers
property
tar_file_serializers: tuple[Type[IsTarFileSerializer], ...]
Return the registered tar-file serializer classes.
| RETURNS | DESCRIPTION |
|---|---|
tuple[Type[IsTarFileSerializer], ...]
|
tuple[Type[IsTarFileSerializer], ...]: Registered tar-file serializers. |
__init__
auto_detect
auto_detect(dataset: IsDataset) -> tuple[IsDataset, IsSerializer] | tuple[None, None]
Return the best serializer match for a dataset, if any.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset to inspect.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[IsDataset, IsSerializer] | tuple[None, None]
|
tuple[IsDataset, IsSerializer] | tuple[None, None]: Parsed dataset and
serializer pair, or |
Source code in src/omnipy/shared/protocols/data.py
auto_detect_tar_file_serializer
auto_detect_tar_file_serializer(
dataset: IsDataset,
) -> tuple[IsDataset, IsSerializer] | tuple[None, None]
Return the best tar-file serializer match for a dataset, if any.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset to inspect.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[IsDataset, IsSerializer] | tuple[None, None]
|
tuple[IsDataset, IsSerializer] | tuple[None, None]: Parsed dataset and
tar-file serializer pair, or |
Source code in src/omnipy/shared/protocols/data.py
detect_tar_file_serializers_from_dataset_cls
detect_tar_file_serializers_from_dataset_cls(
dataset: IsDataset,
) -> tuple[Type[IsTarFileSerializer], ...]
Return tar-file serializers compatible with the dataset class.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset whose class should be inspected.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Type[IsTarFileSerializer], ...]
|
tuple[Type[IsTarFileSerializer], ...]: Compatible tar-file serializer classes. |
Source code in src/omnipy/shared/protocols/data.py
detect_tar_file_serializers_from_file_suffix
detect_tar_file_serializers_from_file_suffix(
file_suffix: str,
) -> tuple[Type[IsTarFileSerializer], ...]
Return tar-file serializers matching a file suffix.
| PARAMETER | DESCRIPTION |
|---|---|
file_suffix
|
File suffix to match against registered serializers.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Type[IsTarFileSerializer], ...]
|
tuple[Type[IsTarFileSerializer], ...]: Matching tar-file serializer classes. |
Source code in src/omnipy/shared/protocols/data.py
load_from_tar_file_path_based_on_dataset_cls
load_from_tar_file_path_based_on_dataset_cls(
log_obj: CanLog, tar_file_path: str, to_dataset: IsDataset
) -> IsDataset | None
Load a tar archive into a dataset using dataset-class detection.
| PARAMETER | DESCRIPTION |
|---|---|
log_obj
|
Logger used for progress and error reporting.
TYPE:
|
tar_file_path
|
Path to the tar archive on disk.
TYPE:
|
to_dataset
|
Dataset instance to populate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IsDataset | None
|
IsDataset | None: Populated dataset, or |
Source code in src/omnipy/shared/protocols/data.py
load_from_tar_file_path_based_on_file_suffix
load_from_tar_file_path_based_on_file_suffix(
log_obj: CanLog, tar_file_path: str, to_dataset: IsDataset
) -> IsDataset | None
Load a tar archive into a dataset using suffix-based detection.
| PARAMETER | DESCRIPTION |
|---|---|
log_obj
|
Logger used for progress and error reporting.
TYPE:
|
tar_file_path
|
Path to the tar archive on disk.
TYPE:
|
to_dataset
|
Dataset instance to populate.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IsDataset | None
|
IsDataset | None: Populated dataset, or |
Source code in src/omnipy/shared/protocols/data.py
register
register(serializer_cls: Type[IsSerializer]) -> None
Register a serializer class with the registry.
| PARAMETER | DESCRIPTION |
|---|---|
serializer_cls
|
Serializer class to add.
TYPE:
|
IsSnapshotHolder
Bases: IsWeakKeyRefContainer[HasContentT, IsSnapshotWrapper[HasContentT, ContentT]], Protocol[HasContentT, ContentT]
flowchart BT
omnipy.shared.protocols.data.IsSnapshotHolder[IsSnapshotHolder]
omnipy.shared.protocols._util.IsWeakKeyRefContainer[IsWeakKeyRefContainer]
omnipy.shared.protocols._util.IsWeakKeyRefContainer --> omnipy.shared.protocols.data.IsSnapshotHolder
click omnipy.shared.protocols.data.IsSnapshotHolder href "" "omnipy.shared.protocols.data.IsSnapshotHolder"
click omnipy.shared.protocols._util.IsWeakKeyRefContainer href "" "omnipy.shared.protocols._util.IsWeakKeyRefContainer"
Container protocol managing snapshots used for deepcopy/reactive tracking.
- Reference Code reference omnipy
| METHOD | DESCRIPTION |
|---|---|
all_are_empty |
Return whether every tracked snapshot collection is empty. |
clear |
Remove all tracked snapshots and bookkeeping state. |
delete_scheduled_deepcopy_content_ids |
Delete every content id previously scheduled for removal. |
get |
|
get_deepcopy_content_ids |
Return tracked content ids participating in deepcopy bookkeeping. |
get_deepcopy_content_ids_scheduled_for_deletion |
Return tracked content ids waiting to be deleted. |
schedule_deepcopy_content_ids_for_deletion |
Mark tracked content ids for later deletion. |
take_snapshot |
Capture a snapshot of the given object's current content. |
take_snapshot_setup |
Prepare internal state before taking one or more snapshots. |
take_snapshot_teardown |
Finalize snapshot bookkeeping after snapshot capture completes. |
Source code in src/omnipy/shared/protocols/data.py
all_are_empty
Return whether every tracked snapshot collection is empty.
| PARAMETER | DESCRIPTION |
|---|---|
debug
|
Whether extra diagnostics should be enabled during the check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
clear
delete_scheduled_deepcopy_content_ids
get
get_deepcopy_content_ids
get_deepcopy_content_ids() -> SetDeque[int]
Return tracked content ids participating in deepcopy bookkeeping.
| RETURNS | DESCRIPTION |
|---|---|
SetDeque[int]
|
SetDeque[int]: Content ids currently tracked for deepcopy handling. |
get_deepcopy_content_ids_scheduled_for_deletion
get_deepcopy_content_ids_scheduled_for_deletion() -> SetDeque[int]
Return tracked content ids waiting to be deleted.
| RETURNS | DESCRIPTION |
|---|---|
SetDeque[int]
|
SetDeque[int]: Content ids marked for later deletion. |
schedule_deepcopy_content_ids_for_deletion
Mark tracked content ids for later deletion.
| PARAMETER | DESCRIPTION |
|---|---|
keys
|
Content ids to queue for deletion.
TYPE:
|
take_snapshot
take_snapshot(obj: HasContentT) -> None
Capture a snapshot of the given object's current content.
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
Object whose content should be snapshotted.
TYPE:
|
take_snapshot_setup
IsSnapshotWrapper
Bases: Protocol[ObjContraT, ContentT]
flowchart BT
omnipy.shared.protocols.data.IsSnapshotWrapper[IsSnapshotWrapper]
click omnipy.shared.protocols.data.IsSnapshotWrapper href "" "omnipy.shared.protocols.data.IsSnapshotWrapper"
Snapshot record linking an object identity to captured content.
- Reference Code reference omnipy
| METHOD | DESCRIPTION |
|---|---|
differs_from |
Return whether the object's current content differs from the snapshot. |
taken_of_same_obj |
Return whether the snapshot belongs to the given object. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
TYPE:
|
snapshot |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
differs_from
differs_from(obj: ObjContraT) -> bool
Return whether the object's current content differs from the snapshot.
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
Object whose current content should be compared.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
taken_of_same_obj
taken_of_same_obj(obj: ObjContraT) -> bool
Return whether the snapshot belongs to the given object.
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
Object to compare with the captured snapshot owner.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsTarFileSerializer
Bases: IsSerializer[_DatasetT], Protocol[_DatasetT]
flowchart BT
omnipy.shared.protocols.data.IsTarFileSerializer[IsTarFileSerializer]
omnipy.shared.protocols.data.IsSerializer[IsSerializer]
omnipy.shared.protocols.data.IsSerializer --> omnipy.shared.protocols.data.IsTarFileSerializer
click omnipy.shared.protocols.data.IsTarFileSerializer href "" "omnipy.shared.protocols.data.IsTarFileSerializer"
click omnipy.shared.protocols.data.IsSerializer href "" "omnipy.shared.protocols.data.IsSerializer"
Serializer extension that stores dataset entries inside tar archives.
- Reference Code reference omnipy
| METHOD | DESCRIPTION |
|---|---|
create_dataset_from_tarfile |
Populate a dataset from a tar archive payload. |
create_tarfile_from_dataset |
Create a tar archive payload from a dataset. |
deserialize |
Deserialize a bytes payload into a dataset instance. |
get_dataset_cls_for_new |
Return the dataset class this serializer creates when deserializing. |
get_output_file_suffix |
Return the default file suffix produced by this serializer. |
is_dataset_directly_supported |
Return whether the serializer can handle the dataset as-is. |
serialize |
Serialize a dataset into a bytes-like payload. |
Source code in src/omnipy/shared/protocols/data.py
create_dataset_from_tarfile
classmethod
create_dataset_from_tarfile(
dataset: _DatasetT,
tarfile_bytes: bytes,
data_decode_func: Callable[[IO[bytes]], Any],
dictify_object_func: Callable[[str, Any], dict | str],
import_method: str = "from_data",
any_file_suffix: bool = False,
) -> None
Populate a dataset from a tar archive payload.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset instance to populate.
TYPE:
|
tarfile_bytes
|
Serialized tar archive payload.
TYPE:
|
data_decode_func
|
Decoder used for individual archived payloads.
TYPE:
|
dictify_object_func
|
Helper that converts decoded objects to importable values.
TYPE:
|
import_method
|
Dataset import method to call for decoded entries.
TYPE:
|
any_file_suffix
|
Whether suffix validation should be relaxed.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
create_tarfile_from_dataset
classmethod
create_tarfile_from_dataset(
dataset: _DatasetT, data_encode_func: Callable[..., bytes | memoryview]
) -> bytes
Create a tar archive payload from a dataset.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset to archive.
TYPE:
|
data_encode_func
|
Encoder used for individual dataset-entry payloads.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes
|
Tar archive containing the serialized dataset entries.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
deserialize
classmethod
Deserialize a bytes payload into a dataset instance.
| PARAMETER | DESCRIPTION |
|---|---|
serialized
|
Serialized dataset payload.
TYPE:
|
any_file_suffix
|
Whether suffix validation should be relaxed.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
_DatasetT
|
Deserialized dataset instance.
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
get_dataset_cls_for_new
classmethod
get_dataset_cls_for_new() -> Type[IsDataset]
Return the dataset class this serializer creates when deserializing.
| RETURNS | DESCRIPTION |
|---|---|
Type[IsDataset]
|
Type[IsDataset]: Dataset class produced for fresh deserialization targets. |
Source code in src/omnipy/shared/protocols/data.py
get_output_file_suffix
classmethod
Return the default file suffix produced by this serializer.
| RETURNS | DESCRIPTION |
|---|---|
str
|
File suffix used for serialized output files.
TYPE:
|
is_dataset_directly_supported
classmethod
is_dataset_directly_supported(dataset: IsDataset) -> bool
Return whether the serializer can handle the dataset as-is.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset instance to check.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
serialize
classmethod
Serialize a dataset into a bytes-like payload.
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
Dataset instance to serialize.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes | memoryview
|
bytes | memoryview: Serialized dataset payload. |