omnipy.shared.protocols.data
| CLASS | DESCRIPTION |
|---|---|
AvailableDisplayDims |
|
HasContent |
|
HasData |
|
IsDataClassCreator |
|
IsDataset |
Dict-based container of data files that follow a specific Model |
IsFailedData |
|
IsHttpUrlDataset |
|
IsHttpUrlModel |
|
IsModel |
|
IsMultiModelDataset |
Variant of Dataset that allows custom models to be set on individual data files |
IsPendingData |
|
IsReactive |
|
IsReactiveObjects |
|
IsSerializer |
|
IsSerializerRegistry |
|
IsSnapshotHolder |
|
IsSnapshotWrapper |
|
IsTarFileSerializer |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
ContentT |
|
HasContentT |
|
IsPathOrUrl |
TYPE:
|
IsPathsOrUrls |
TYPE:
|
IsPathsOrUrlsOneOrMore |
TYPE:
|
IsPathsOrUrlsOneOrMoreOrNone |
TYPE:
|
ObjContraT |
|
IsPathsOrUrls
module-attribute
IsPathsOrUrlsOneOrMore
module-attribute
IsPathsOrUrlsOneOrMoreOrNone
module-attribute
AvailableDisplayDims
Bases: TypedDict
| ATTRIBUTE | DESCRIPTION |
|---|---|
height |
TYPE:
|
width |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
HasContent
HasData
Bases: Protocol
| ATTRIBUTE | DESCRIPTION |
|---|---|
data |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsDataClassCreator
Bases: Protocol[HasContentT, ContentT]
| METHOD | DESCRIPTION |
|---|---|
deepcopy_context |
|
set_config |
|
set_reactive_objects |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
config |
TYPE:
|
reactive_objects |
TYPE:
|
snapshot_holder |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
deepcopy_context
set_config
set_config(config: IsDataConfig) -> None
set_reactive_objects
set_reactive_objects(reactive_objects: IsReactiveObjects) -> None
IsDataset
Bases: IsMutableMapping[str, _ModelOrDatasetT], Protocol[_ModelOrDatasetT]
Dict-based container of data files that follow a specific Model
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
clear |
D.clear() -> None. Remove all items from D. |
failed_task_details |
|
from_data |
|
from_json |
|
get |
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
get_type |
Returns the concrete type (Model or Dataset class) used for all |
keys |
D.keys() -> a set-like object providing a view on D's keys |
load |
|
load_into |
|
pending_task_details |
|
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 |
|
setdefault |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
to_data |
|
to_json |
|
to_json_schema |
|
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 |
TYPE:
|
failed_data |
TYPE:
|
pending_data |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 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 | |
__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]
from_data
from_json
get
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
get_type
cached
classmethod
Returns the concrete type (Model or Dataset class) used for all
data files in the dataset, e.g.: Model[list[int]], or
Dataset[Model[dict[str, float]]] for nested datasets.
:return: The concrete type (Model or Dataset class) used for all
data files in the dataset.
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_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]
pending_task_details
pending_task_details() -> dict[str, IsPendingData]
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
setdefault
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
to_data
to_json
to_json_schema
classmethod
update
update(
m: SupportsKeysAndGetItem[_KT, _VT]
| SupportsKeysAndGetItem[str, _VT]
| Iterable[tuple[_KT, _VT]]
| Iterable[tuple[str, _VT]]
| None = None,
/,
**kwargs: _VT,
) -> None
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
| 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
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
clear |
D.clear() -> None. Remove all items from D. |
failed_task_details |
|
from_data |
|
from_json |
|
get |
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
get_type |
Returns the concrete type (Model or Dataset class) used for all |
keys |
D.keys() -> a set-like object providing a view on D's keys |
load |
|
load_into |
|
pending_task_details |
|
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 |
|
setdefault |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
to_data |
|
to_json |
|
to_json_schema |
|
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 |
TYPE:
|
failed_data |
TYPE:
|
pending_data |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
__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]
from_data
from_json
get
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
get_type
cached
classmethod
Returns the concrete type (Model or Dataset class) used for all
data files in the dataset, e.g.: Model[list[int]], or
Dataset[Model[dict[str, float]]] for nested datasets.
:return: The concrete type (Model or Dataset class) used for all
data files in the dataset.
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_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]
pending_task_details
pending_task_details() -> dict[str, IsPendingData]
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
setdefault
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
to_data
to_json
to_json_schema
classmethod
update
update(
m: SupportsKeysAndGetItem[_KT, _VT]
| SupportsKeysAndGetItem[str, _VT]
| Iterable[tuple[_KT, _VT]]
| Iterable[tuple[str, _VT]]
| None = None,
/,
**kwargs: _VT,
) -> None
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
IsModel
Bases: HasContent[_RootT], Protocol[_RootT]
| METHOD | DESCRIPTION |
|---|---|
full_type |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
content |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsMultiModelDataset
Bases: IsDataset[_ModelOrDatasetT], Protocol[_ModelOrDatasetT]
Variant of Dataset that allows custom models to be set on individual data files
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
clear |
D.clear() -> None. Remove all items from D. |
failed_task_details |
|
from_data |
|
from_json |
|
get |
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. |
get_model |
|
get_type |
Returns the concrete type (Model or Dataset class) used for all |
keys |
D.keys() -> a set-like object providing a view on D's keys |
load |
|
load_into |
|
pending_task_details |
|
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 |
|
set_model |
|
setdefault |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D |
to_data |
|
to_json |
|
to_json_schema |
|
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 |
TYPE:
|
failed_data |
TYPE:
|
pending_data |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
__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]
from_data
from_json
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]
get_type
cached
classmethod
Returns the concrete type (Model or Dataset class) used for all
data files in the dataset, e.g.: Model[list[int]], or
Dataset[Model[dict[str, float]]] for nested datasets.
:return: The concrete type (Model or Dataset class) used for all
data files in the dataset.
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_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]
pending_task_details
pending_task_details() -> dict[str, IsPendingData]
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
set_model
set_model(data_file: str, model: type[IsModel]) -> None
setdefault
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
to_data
to_json
to_json_schema
classmethod
update
update(
m: SupportsKeysAndGetItem[_KT, _VT]
| SupportsKeysAndGetItem[str, _VT]
| Iterable[tuple[_KT, _VT]]
| Iterable[tuple[str, _VT]]
| None = None,
/,
**kwargs: _VT,
) -> None
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
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
job_name |
TYPE:
|
job_unique_name |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
IsReactive
IsReactiveObjects
Bases: Protocol
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_display_dims_in_px |
TYPE:
|
jupyter_ui_config |
|
layout_config |
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]
| METHOD | DESCRIPTION |
|---|---|
deserialize |
|
get_dataset_cls_for_new |
|
get_output_file_suffix |
|
is_dataset_directly_supported |
|
serialize |
|
Source code in src/omnipy/shared/protocols/data.py
IsSerializerRegistry
Bases: Protocol
| ATTRIBUTE | DESCRIPTION |
|---|---|
serializers |
TYPE:
|
tar_file_serializers |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
__init__
auto_detect
auto_detect(dataset: IsDataset) -> tuple[IsDataset, IsSerializer] | tuple[None, None]
auto_detect_tar_file_serializer
auto_detect_tar_file_serializer(
dataset: IsDataset,
) -> tuple[IsDataset, IsSerializer] | tuple[None, None]
detect_tar_file_serializers_from_dataset_cls
detect_tar_file_serializers_from_dataset_cls(
dataset: IsDataset,
) -> tuple[Type[IsTarFileSerializer], ...]
detect_tar_file_serializers_from_file_suffix
detect_tar_file_serializers_from_file_suffix(
file_suffix: str,
) -> tuple[Type[IsTarFileSerializer], ...]
load_from_tar_file_path_based_on_dataset_cls
load_from_tar_file_path_based_on_file_suffix
register
register(serializer_cls: Type[IsSerializer]) -> None
IsSnapshotHolder
Bases: IsWeakKeyRefContainer[HasContentT, IsSnapshotWrapper[HasContentT, ContentT]], Protocol[HasContentT, ContentT]
Source code in src/omnipy/shared/protocols/data.py
all_are_empty
clear
delete_scheduled_deepcopy_content_ids
get
get_deepcopy_content_ids
get_deepcopy_content_ids() -> SetDeque[int]
get_deepcopy_content_ids_scheduled_for_deletion
get_deepcopy_content_ids_scheduled_for_deletion() -> SetDeque[int]
schedule_deepcopy_content_ids_for_deletion
take_snapshot
take_snapshot(obj: HasContentT) -> None
take_snapshot_setup
IsSnapshotWrapper
Bases: Protocol[ObjContraT, ContentT]
| METHOD | DESCRIPTION |
|---|---|
differs_from |
|
taken_of_same_obj |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
TYPE:
|
snapshot |
TYPE:
|
Source code in src/omnipy/shared/protocols/data.py
differs_from
differs_from(obj: ObjContraT) -> bool
taken_of_same_obj
taken_of_same_obj(obj: ObjContraT) -> bool
IsTarFileSerializer
Bases: IsSerializer[_DatasetT], Protocol[_DatasetT]
| METHOD | DESCRIPTION |
|---|---|
create_dataset_from_tarfile |
|
create_tarfile_from_dataset |
|
deserialize |
|
get_dataset_cls_for_new |
|
get_output_file_suffix |
|
is_dataset_directly_supported |
|
serialize |
|
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
Source code in src/omnipy/shared/protocols/data.py
create_tarfile_from_dataset
classmethod
deserialize
classmethod
get_dataset_cls_for_new
classmethod
get_dataset_cls_for_new() -> Type[IsDataset]
get_output_file_suffix
classmethod
is_dataset_directly_supported
classmethod
is_dataset_directly_supported(dataset: IsDataset) -> bool