omnipy.util.callable_types
Helpers and literal enums for classifying and wrapping callable shapes.
| CLASS | DESCRIPTION |
|---|---|
AsyncCallableType |
Literal enum values for asynchronous callable variants. |
CallableType |
Combined literal enum values for every supported callable variant. |
GeneratorCallableType |
Literal enum values for generator-based callable variants. |
PlainCallableType |
Literal enum values for non-generator callable variants. |
SyncCallableType |
Literal enum values for synchronous callable variants. |
| FUNCTION | DESCRIPTION |
|---|---|
callable_type_from_flags |
Return a callable-type literal from boolean async/generator flags. |
decorate_callable_by_type |
Wrap a callable while preserving its declared callable shape. |
decorate_result_by_type |
Create a decorator that runs a callback when a result has fully finished. |
get_callable_type |
Inspect a callable and classify its sync/async and generator shape. |
AsyncCallableType
Bases: _AsyncCoroutineType, _AsyncGeneratorType
flowchart BT
omnipy.util.callable_types.AsyncCallableType[AsyncCallableType]
omnipy.util.callable_types._AsyncCoroutineType[_AsyncCoroutineType]
omnipy.util.callable_types._AsyncGeneratorType[_AsyncGeneratorType]
omnipy.util.literal_enum.LiteralEnum[LiteralEnum]
omnipy.util.callable_types._AsyncCoroutineType --> omnipy.util.callable_types.AsyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._AsyncCoroutineType
omnipy.util.callable_types._AsyncGeneratorType --> omnipy.util.callable_types.AsyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._AsyncGeneratorType
click omnipy.util.callable_types.AsyncCallableType href "" "omnipy.util.callable_types.AsyncCallableType"
click omnipy.util.callable_types._AsyncCoroutineType href "" "omnipy.util.callable_types._AsyncCoroutineType"
click omnipy.util.callable_types._AsyncGeneratorType href "" "omnipy.util.callable_types._AsyncGeneratorType"
click omnipy.util.literal_enum.LiteralEnum href "" "omnipy.util.literal_enum.LiteralEnum"
Literal enum values for asynchronous callable variants.
-
Reference
Code reference
omnipy
util
callable_typesCallableType
-
Reference
Code reference
omnipy
util
callable_typesCallableTypeLiterals
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
Source code in src/omnipy/util/callable_types.py
Literals
class-attribute
instance-attribute
-
Reference
Code reference
omnipy
util
callable_typesCallableTypeLiterals
CallableType
Bases: SyncCallableType, AsyncCallableType
flowchart BT
omnipy.util.callable_types.CallableType[CallableType]
omnipy.util.callable_types.SyncCallableType[SyncCallableType]
omnipy.util.callable_types._SyncFunctionType[_SyncFunctionType]
omnipy.util.callable_types._SyncGeneratorType[_SyncGeneratorType]
omnipy.util.callable_types.AsyncCallableType[AsyncCallableType]
omnipy.util.callable_types._AsyncCoroutineType[_AsyncCoroutineType]
omnipy.util.callable_types._AsyncGeneratorType[_AsyncGeneratorType]
omnipy.util.literal_enum.LiteralEnum[LiteralEnum]
omnipy.util.callable_types.SyncCallableType --> omnipy.util.callable_types.CallableType
omnipy.util.callable_types._SyncFunctionType --> omnipy.util.callable_types.SyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._SyncFunctionType
omnipy.util.callable_types._SyncGeneratorType --> omnipy.util.callable_types.SyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._SyncGeneratorType
omnipy.util.callable_types.AsyncCallableType --> omnipy.util.callable_types.CallableType
omnipy.util.callable_types._AsyncCoroutineType --> omnipy.util.callable_types.AsyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._AsyncCoroutineType
omnipy.util.callable_types._AsyncGeneratorType --> omnipy.util.callable_types.AsyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._AsyncGeneratorType
click omnipy.util.callable_types.CallableType href "" "omnipy.util.callable_types.CallableType"
click omnipy.util.callable_types.SyncCallableType href "" "omnipy.util.callable_types.SyncCallableType"
click omnipy.util.callable_types._SyncFunctionType href "" "omnipy.util.callable_types._SyncFunctionType"
click omnipy.util.callable_types._SyncGeneratorType href "" "omnipy.util.callable_types._SyncGeneratorType"
click omnipy.util.callable_types.AsyncCallableType href "" "omnipy.util.callable_types.AsyncCallableType"
click omnipy.util.callable_types._AsyncCoroutineType href "" "omnipy.util.callable_types._AsyncCoroutineType"
click omnipy.util.callable_types._AsyncGeneratorType href "" "omnipy.util.callable_types._AsyncGeneratorType"
click omnipy.util.literal_enum.LiteralEnum href "" "omnipy.util.literal_enum.LiteralEnum"
Combined literal enum values for every supported callable variant.
-
Reference
Code reference
omnipy
- compute
-
engine
run_spec -
shared
protocols
compute
job-
IsAnyFlowcallable_type -
IsAnyFlowTemplatecallable_type -
IsChildJobListArgJobcallable_type -
IsChildJobListArgJobBasecallable_type -
IsChildJobListArgJobTemplatecallable_type -
IsDagFlowcallable_type -
IsDagFlowTemplatecallable_type -
IsFuncArgJobcallable_type -
IsFuncArgJobBasecallable_type -
IsFuncArgJobTemplatecallable_type -
IsFuncFlowcallable_type -
IsFuncFlowTemplatecallable_type -
IsLinearFlowcallable_type -
IsLinearFlowTemplatecallable_type -
IsTaskcallable_type -
IsTaskTemplatecallable_type
-
-
util
callable_types
-
Reference
Code reference
omnipy
util
callable_typesdecorate_callable_by_type
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
Source code in src/omnipy/util/callable_types.py
Literals
class-attribute
instance-attribute
Literals = Literal[SyncCallableType.Literals, AsyncCallableType.Literals]
-
Reference
Code reference
omnipy
- compute
-
engine
run_spec -
shared
protocols
compute
job-
IsAnyFlowcallable_type -
IsAnyFlowTemplatecallable_type -
IsChildJobListArgJobcallable_type -
IsChildJobListArgJobBasecallable_type -
IsChildJobListArgJobTemplatecallable_type -
IsDagFlowcallable_type -
IsDagFlowTemplatecallable_type -
IsFuncArgJobcallable_type -
IsFuncArgJobBasecallable_type -
IsFuncArgJobTemplatecallable_type -
IsFuncFlowcallable_type -
IsFuncFlowTemplatecallable_type -
IsLinearFlowcallable_type -
IsLinearFlowTemplatecallable_type -
IsTaskcallable_type -
IsTaskTemplatecallable_type
-
-
util
callable_types
-
Reference
Code reference
omnipy
util
callable_typesdecorate_callable_by_type
GeneratorCallableType
Bases: _SyncGeneratorType, _AsyncGeneratorType
flowchart BT
omnipy.util.callable_types.GeneratorCallableType[GeneratorCallableType]
omnipy.util.callable_types._SyncGeneratorType[_SyncGeneratorType]
omnipy.util.callable_types._AsyncGeneratorType[_AsyncGeneratorType]
omnipy.util.literal_enum.LiteralEnum[LiteralEnum]
omnipy.util.callable_types._SyncGeneratorType --> omnipy.util.callable_types.GeneratorCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._SyncGeneratorType
omnipy.util.callable_types._AsyncGeneratorType --> omnipy.util.callable_types.GeneratorCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._AsyncGeneratorType
click omnipy.util.callable_types.GeneratorCallableType href "" "omnipy.util.callable_types.GeneratorCallableType"
click omnipy.util.callable_types._SyncGeneratorType href "" "omnipy.util.callable_types._SyncGeneratorType"
click omnipy.util.callable_types._AsyncGeneratorType href "" "omnipy.util.callable_types._AsyncGeneratorType"
click omnipy.util.literal_enum.LiteralEnum href "" "omnipy.util.literal_enum.LiteralEnum"
Literal enum values for generator-based callable variants.
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
Source code in src/omnipy/util/callable_types.py
PlainCallableType
Bases: _SyncFunctionType, _AsyncCoroutineType
flowchart BT
omnipy.util.callable_types.PlainCallableType[PlainCallableType]
omnipy.util.callable_types._SyncFunctionType[_SyncFunctionType]
omnipy.util.callable_types._AsyncCoroutineType[_AsyncCoroutineType]
omnipy.util.literal_enum.LiteralEnum[LiteralEnum]
omnipy.util.callable_types._SyncFunctionType --> omnipy.util.callable_types.PlainCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._SyncFunctionType
omnipy.util.callable_types._AsyncCoroutineType --> omnipy.util.callable_types.PlainCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._AsyncCoroutineType
click omnipy.util.callable_types.PlainCallableType href "" "omnipy.util.callable_types.PlainCallableType"
click omnipy.util.callable_types._SyncFunctionType href "" "omnipy.util.callable_types._SyncFunctionType"
click omnipy.util.callable_types._AsyncCoroutineType href "" "omnipy.util.callable_types._AsyncCoroutineType"
click omnipy.util.literal_enum.LiteralEnum href "" "omnipy.util.literal_enum.LiteralEnum"
Literal enum values for non-generator callable variants.
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
Source code in src/omnipy/util/callable_types.py
SyncCallableType
Bases: _SyncFunctionType, _SyncGeneratorType
flowchart BT
omnipy.util.callable_types.SyncCallableType[SyncCallableType]
omnipy.util.callable_types._SyncFunctionType[_SyncFunctionType]
omnipy.util.callable_types._SyncGeneratorType[_SyncGeneratorType]
omnipy.util.literal_enum.LiteralEnum[LiteralEnum]
omnipy.util.callable_types._SyncFunctionType --> omnipy.util.callable_types.SyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._SyncFunctionType
omnipy.util.callable_types._SyncGeneratorType --> omnipy.util.callable_types.SyncCallableType
omnipy.util.literal_enum.LiteralEnum --> omnipy.util.callable_types._SyncGeneratorType
click omnipy.util.callable_types.SyncCallableType href "" "omnipy.util.callable_types.SyncCallableType"
click omnipy.util.callable_types._SyncFunctionType href "" "omnipy.util.callable_types._SyncFunctionType"
click omnipy.util.callable_types._SyncGeneratorType href "" "omnipy.util.callable_types._SyncGeneratorType"
click omnipy.util.literal_enum.LiteralEnum href "" "omnipy.util.literal_enum.LiteralEnum"
Literal enum values for synchronous callable variants.
-
Reference
Code reference
omnipy
util
callable_typesCallableType
-
Reference
Code reference
omnipy
util
callable_typesCallableTypeLiterals
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
Source code in src/omnipy/util/callable_types.py
Literals
class-attribute
instance-attribute
-
Reference
Code reference
omnipy
util
callable_typesCallableTypeLiterals
callable_type_from_flags
callable_type_from_flags(*, is_async: bool, is_generator: bool) -> CallableType.Literals
Return a callable-type literal from boolean async/generator flags.
| PARAMETER | DESCRIPTION |
|---|---|
is_async
|
Whether the callable executes asynchronously.
TYPE:
|
is_generator
|
Whether the callable yields values instead of returning once.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CallableType.Literals
|
CallableType.Literals: Callable variant matching the supplied flags. |
Source code in src/omnipy/util/callable_types.py
decorate_callable_by_type
decorate_callable_by_type(
call_func: Callable[_P, Any],
param_signatures: MappingProxyType[str, inspect.Parameter],
return_type: type,
call_type: CallableType.Literals,
*,
context_factory: Callable[[], AbstractContextManager[object]] | None = None,
resolve_async_result: bool = False,
) -> Callable[_P, Any]
Wrap a callable while preserving its declared callable shape.
| PARAMETER | DESCRIPTION |
|---|---|
call_func
|
Callable to wrap.
TYPE:
|
param_signatures
|
Parameter mapping used to expose the desired signature.
TYPE:
|
return_type
|
Return annotation to expose on the wrapper.
TYPE:
|
call_type
|
Effective callable type to emulate.
TYPE:
|
context_factory
|
Optional factory producing a context manager entered for each invocation.
TYPE:
|
resolve_async_result
|
Whether async-coroutine wrappers should resolve nested awaitables before returning.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Callable[_P, Any]
|
Callable[_P, Any]: Wrapper matching |
Source code in src/omnipy/util/callable_types.py
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 | |
decorate_result_by_type
decorate_result_by_type(
*, on_finished: Callable[[], None] | None = None
) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]
Create a decorator that runs a callback when a result has fully finished.
The callback is delayed until generators are exhausted and awaitables resolve, so completion is tracked at the end of observable consumption rather than at call time.
| PARAMETER | DESCRIPTION |
|---|---|
on_finished
|
Callback invoked when the wrapped result is fully consumed.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Callable[[Callable[_P, _R]], Callable[_P, _R]]
|
Callable[[Callable[_P, _R]], Callable[_P, _R]]: Decorator that preserves the wrapped callable while adding completion tracking. |
Source code in src/omnipy/util/callable_types.py
get_callable_type
get_callable_type(callable: Callable[..., Any]) -> CallableType.Literals
Inspect a callable and classify its sync/async and generator shape.
| PARAMETER | DESCRIPTION |
|---|---|
callable
|
Callable object to inspect.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CallableType.Literals
|
CallableType.Literals: Detected callable variant. |