omnipy.data.helpers
Helper types and utilities shared across Omnipy's data layer internals.
| CLASS | DESCRIPTION |
|---|---|
DoubleTypeVarStore |
Sentinel generic used to expose one of two type variables to internal helpers. |
FailedData |
Marker payload for dataset items whose producing task failed. |
MethodInfo |
Metadata describing how a Python special method behaves for wrapped data classes. |
PendingData |
Marker payload for dataset items whose producing task has not completed yet. |
ResetSolutionTuple |
Result from internal reset handling during snapshot-aware operations. |
TypeVarStore |
Sentinel generic used to expose a single type variable in helper type plumbing. |
TypeVarStore1 |
Distinct single-type-variable marker used when multiple stores are needed. |
TypeVarStore2 |
Distinct single-type-variable marker used when multiple stores are needed. |
TypeVarStore3 |
Distinct single-type-variable marker used when multiple stores are needed. |
TypeVarStore4 |
Distinct single-type-variable marker used when multiple stores are needed. |
YesNoMaybe |
Tri-state answer used when Omnipy infers special-method behavior. |
| FUNCTION | DESCRIPTION |
|---|---|
build_own_module_and_global_namespace_for_forward_refs |
Build own-module and global namespaces for fwd reference resolution |
cleanup_name_qualname_and_module |
Normalize generated class identity metadata for parametrized data classes. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
SPECIAL_METHODS_INFO_DICT |
TYPE:
|
SPECIAL_METHODS_INFO_DICT
module-attribute
SPECIAL_METHODS_INFO_DICT: dict[str, MethodInfo] = {
"__len__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__length_hint__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__getitem__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__setitem__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__delitem__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__missing__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__iter__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__next__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__reversed__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__contains__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__add__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.YES),
"__sub__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__mul__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__matmul__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__truediv__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__floordiv__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__mod__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__divmod__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__pow__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__lshift__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rshift__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__and__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__xor__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__or__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__radd__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.YES),
"__rsub__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rmul__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rmatmul__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rtruediv__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rfloordiv__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rmod__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rdivmod__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rpow__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rlshift__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rrshift__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rand__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__rxor__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__ror__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__iadd__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.YES),
"__isub__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__imul__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__imatmul__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__itruediv__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__ifloordiv__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__imod__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__ipow__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__ilshift__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__irshift__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__iand__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__ixor__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__ior__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.MAYBE),
"__neg__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__pos__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__abs__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__invert__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__complex__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__int__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__float__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__str__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__bytes__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__index__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__round__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__trunc__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__floor__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__ceil__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.MAYBE),
"__enter__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__exit__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__buffer__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__release_buffer__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__hash__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__await__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__aiter__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__anext__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__aenter__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__aexit__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
"__copy__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.YES),
"__deepcopy__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.YES),
"__replace__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.YES),
"__format__": MethodInfo(state_changing=False, returns_same_type=YesNoMaybe.NO),
"__delattr__": MethodInfo(state_changing=True, returns_same_type=YesNoMaybe.NO),
}
DoubleTypeVarStore
Bases: Generic[_T, _U]
flowchart BT
omnipy.data.helpers.DoubleTypeVarStore[DoubleTypeVarStore]
click omnipy.data.helpers.DoubleTypeVarStore href "" "omnipy.data.helpers.DoubleTypeVarStore"
Sentinel generic used to expose one of two type variables to internal helpers.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
FailedData
dataclass
Marker payload for dataset items whose producing task failed.
| ATTRIBUTE | DESCRIPTION |
|---|---|
job_name |
Human-readable task name.
TYPE:
|
job_unique_name |
Optional unique task identifier when available.
TYPE:
|
exception |
The captured task failure.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
MethodInfo
Bases: NamedTuple
flowchart BT
omnipy.data.helpers.MethodInfo[MethodInfo]
click omnipy.data.helpers.MethodInfo href "" "omnipy.data.helpers.MethodInfo"
Metadata describing how a Python special method behaves for wrapped data classes.
| ATTRIBUTE | DESCRIPTION |
|---|---|
state_changing |
Whether calling the method mutates the wrapped object.
TYPE:
|
returns_same_type |
Whether the method is expected to return the same data-class type.
TYPE:
|
-
Reference
Code reference
omnipy
data
helpersSPECIAL_METHODS_INFO_DICT
-
Reference
Code reference
omnipy
data
helpersSPECIAL_METHODS_INFO_DICT
Source code in src/omnipy/data/helpers.py
PendingData
dataclass
Marker payload for dataset items whose producing task has not completed yet.
| ATTRIBUTE | DESCRIPTION |
|---|---|
job_name |
Human-readable task name.
TYPE:
|
job_unique_name |
Optional unique task identifier when available.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
ResetSolutionTuple
Bases: NamedTuple
flowchart BT
omnipy.data.helpers.ResetSolutionTuple[ResetSolutionTuple]
click omnipy.data.helpers.ResetSolutionTuple href "" "omnipy.data.helpers.ResetSolutionTuple"
Result from internal reset handling during snapshot-aware operations.
| ATTRIBUTE | DESCRIPTION |
|---|---|
reset_solution |
Context manager that applies the chosen reset strategy.
TYPE:
|
snapshot_taken |
Whether a fresh snapshot was captured before the operation.
TYPE:
|
Source code in src/omnipy/data/helpers.py
TypeVarStore
Bases: Generic[_T]
flowchart BT
omnipy.data.helpers.TypeVarStore[TypeVarStore]
click omnipy.data.helpers.TypeVarStore href "" "omnipy.data.helpers.TypeVarStore"
Sentinel generic used to expose a single type variable in helper type plumbing.
- Reference Code reference omnipy
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
TypeVarStore1
Bases: TypeVarStore[_T], Generic[_T]
flowchart BT
omnipy.data.helpers.TypeVarStore1[TypeVarStore1]
omnipy.data.helpers.TypeVarStore[TypeVarStore]
omnipy.data.helpers.TypeVarStore --> omnipy.data.helpers.TypeVarStore1
click omnipy.data.helpers.TypeVarStore1 href "" "omnipy.data.helpers.TypeVarStore1"
click omnipy.data.helpers.TypeVarStore href "" "omnipy.data.helpers.TypeVarStore"
Distinct single-type-variable marker used when multiple stores are needed.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
TypeVarStore2
Bases: TypeVarStore[_T], Generic[_T]
flowchart BT
omnipy.data.helpers.TypeVarStore2[TypeVarStore2]
omnipy.data.helpers.TypeVarStore[TypeVarStore]
omnipy.data.helpers.TypeVarStore --> omnipy.data.helpers.TypeVarStore2
click omnipy.data.helpers.TypeVarStore2 href "" "omnipy.data.helpers.TypeVarStore2"
click omnipy.data.helpers.TypeVarStore href "" "omnipy.data.helpers.TypeVarStore"
Distinct single-type-variable marker used when multiple stores are needed.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
TypeVarStore3
Bases: TypeVarStore[_T], Generic[_T]
flowchart BT
omnipy.data.helpers.TypeVarStore3[TypeVarStore3]
omnipy.data.helpers.TypeVarStore[TypeVarStore]
omnipy.data.helpers.TypeVarStore --> omnipy.data.helpers.TypeVarStore3
click omnipy.data.helpers.TypeVarStore3 href "" "omnipy.data.helpers.TypeVarStore3"
click omnipy.data.helpers.TypeVarStore href "" "omnipy.data.helpers.TypeVarStore"
Distinct single-type-variable marker used when multiple stores are needed.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
TypeVarStore4
Bases: TypeVarStore[_T], Generic[_T]
flowchart BT
omnipy.data.helpers.TypeVarStore4[TypeVarStore4]
omnipy.data.helpers.TypeVarStore[TypeVarStore]
omnipy.data.helpers.TypeVarStore --> omnipy.data.helpers.TypeVarStore4
click omnipy.data.helpers.TypeVarStore4 href "" "omnipy.data.helpers.TypeVarStore4"
click omnipy.data.helpers.TypeVarStore href "" "omnipy.data.helpers.TypeVarStore"
Distinct single-type-variable marker used when multiple stores are needed.
| METHOD | DESCRIPTION |
|---|---|
__init__ |
|
Source code in src/omnipy/data/helpers.py
YesNoMaybe
Bases: IntEnum
flowchart BT
omnipy.data.helpers.YesNoMaybe[YesNoMaybe]
click omnipy.data.helpers.YesNoMaybe href "" "omnipy.data.helpers.YesNoMaybe"
Tri-state answer used when Omnipy infers special-method behavior.
-
Reference
Code reference
omnipy
data
helpersMethodInforeturns_same_type
-
Reference
Code reference
omnipy
data
helpersSPECIAL_METHODS_INFO_DICT
| ATTRIBUTE | DESCRIPTION |
|---|---|
MAYBE |
|
NO |
|
YES |
|
Source code in src/omnipy/data/helpers.py
MAYBE
class-attribute
instance-attribute
-
Reference
Code reference
omnipy
data
helpersSPECIAL_METHODS_INFO_DICT
NO
class-attribute
instance-attribute
-
Reference
Code reference
omnipy
data
helpersSPECIAL_METHODS_INFO_DICT
YES
class-attribute
instance-attribute
-
Reference
Code reference
omnipy
data
helpersSPECIAL_METHODS_INFO_DICT
build_own_module_and_global_namespace_for_forward_refs
build_own_module_and_global_namespace_for_forward_refs(
own_class: type, calling_module: str | None, **localns: Any
) -> tuple[dict[str, Any], dict[str, Any]]
Build own-module and global namespaces for fwd reference resolution
Build global namespaces for forward reference resolution by merging:
-
The model's own defining module namespace — so forward refs declared inside the model (e.g. JsonScalar in tables/models.py) are always resolvable even when update_forward_refs is triggered from a different module.
-
The calling module's namespace on top — so forward refs that point to types available at the call site (e.g. NestedDataset in datasets.py) are resolved correctly.
-
Any explicitly passed localns with the highest priority.
| RETURNS | DESCRIPTION |
|---|---|
tuple[dict[str, Any], dict[str, Any]]
|
A tuple of (own_module_namespace, global_namespace) to be used for forward reference resolution. |
Source code in src/omnipy/data/helpers.py
cleanup_name_qualname_and_module
cleanup_name_qualname_and_module(
cls: type[DataClassBase], model_or_dataset: type[DataClassBase], orig_model: TypeForm
) -> None
Normalize generated class identity metadata for parametrized data classes.
Omnipy dynamically creates specialized model and dataset classes. This helper keeps the generated class name, qualified name, and module aligned with the originating class so those classes display predictably in errors, debugging output, and introspection tools.
| PARAMETER | DESCRIPTION |
|---|---|
cls
|
The original generic data-class type being specialized.
TYPE:
|
model_or_dataset
|
The generated specialized class whose metadata should be updated.
TYPE:
|
orig_model
|
The type parameter representation used to build the specialized class name.
TYPE:
|
Source code in src/omnipy/data/helpers.py
debug_get_sorted_validate_counts
Return validation-call counts sorted from highest to lowest for debugging.
debug_get_total_validate_count
Return the total number of tracked validation calls for debugging.