mark old style as deprecated; in the Types!
This commit is contained in:
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Literal, cast
|
||||
from typing import Any, Literal, overload, cast
|
||||
import warnings
|
||||
from warnings import deprecated
|
||||
|
||||
@@ -163,6 +163,30 @@ class WorkflowBuilder:
|
||||
self.state_schema = state_schema_from(self.state_schema)
|
||||
self.output_schema = schema_ref_from(self.output_schema)
|
||||
|
||||
@overload
|
||||
def use(
|
||||
self,
|
||||
spec: NodeSpec[Any, Any],
|
||||
*,
|
||||
id: str | None = None,
|
||||
input: Sequence[InputBindingArg] | None = None,
|
||||
output: Sequence[OutputBindingArg] | None = None,
|
||||
desc: str | None = None,
|
||||
) -> NodeUse: ...
|
||||
|
||||
@overload
|
||||
@deprecated("use input/output canonical binding lists instead")
|
||||
def use(
|
||||
self,
|
||||
spec: NodeSpec[Any, Any],
|
||||
*,
|
||||
id: str | None = None,
|
||||
in_map: MapArg | None = None,
|
||||
input_values: Mapping[Any, Any] | None = None,
|
||||
out_map: MapArg | None = None,
|
||||
desc: str | None = None,
|
||||
) -> NodeUse: ...
|
||||
|
||||
def use(
|
||||
self,
|
||||
spec: NodeSpec[Any, Any],
|
||||
@@ -228,6 +252,30 @@ class WorkflowBuilder:
|
||||
self.nodes.append(node)
|
||||
return node
|
||||
|
||||
@overload
|
||||
def use_ref(
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
id: str | None = None,
|
||||
input: Sequence[InputBindingArg] | None = None,
|
||||
output: Sequence[OutputBindingArg] | None = None,
|
||||
desc: str | None = None,
|
||||
) -> NodeUse: ...
|
||||
|
||||
@overload
|
||||
@deprecated("use input/output canonical binding lists instead")
|
||||
def use_ref(
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
id: str | None = None,
|
||||
in_map: MapArg | None = None,
|
||||
input_values: Mapping[Any, Any] | None = None,
|
||||
out_map: MapArg | None = None,
|
||||
desc: str | None = None,
|
||||
) -> NodeUse: ...
|
||||
|
||||
def use_ref(
|
||||
self,
|
||||
name: str,
|
||||
@@ -364,6 +412,29 @@ class WorkflowBuilder:
|
||||
self.nodes.append(node)
|
||||
return node
|
||||
|
||||
@overload
|
||||
def interrupt(
|
||||
self,
|
||||
*,
|
||||
id: str | None = None,
|
||||
kind: str,
|
||||
request: Sequence[InputBindingArg] | None = None,
|
||||
resume: Sequence[OutputBindingArg] | None = None,
|
||||
outcomes: list[str] | None = None,
|
||||
) -> InterruptNode: ...
|
||||
|
||||
@overload
|
||||
@deprecated("use request/resume canonical binding lists instead")
|
||||
def interrupt(
|
||||
self,
|
||||
*,
|
||||
id: str | None = None,
|
||||
kind: str,
|
||||
request_map: MapArg | None = None,
|
||||
out_map: MapArg | None = None,
|
||||
outcomes: list[str] | None = None,
|
||||
) -> InterruptNode: ...
|
||||
|
||||
def interrupt(
|
||||
self,
|
||||
*,
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import warnings
|
||||
from collections.abc import Iterator, Mapping
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -413,7 +414,7 @@ def test_builder_rejects_mixed_canonical_and_deprecated_input_styles() -> None:
|
||||
)
|
||||
|
||||
with pytest.raises(TypeError, match="cannot mix canonical input"):
|
||||
builder.use(
|
||||
cast(Any, builder.use)(
|
||||
auto_bind_node,
|
||||
input=[{"target": "text", "path": "input.text"}],
|
||||
in_map={"input.text": "text"},
|
||||
@@ -429,7 +430,7 @@ def test_builder_rejects_mixed_canonical_and_deprecated_output_styles() -> None:
|
||||
)
|
||||
|
||||
with pytest.raises(TypeError, match="cannot mix canonical output"):
|
||||
builder.use(
|
||||
cast(Any, builder.use)(
|
||||
auto_bind_node,
|
||||
output=[{"source": "text", "target": "state.text"}],
|
||||
out_map={"text": "state.text"},
|
||||
|
||||
Reference in New Issue
Block a user