Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ordeq/src/ordeq/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def run(

io_subs = _resolve_refs_to_subs(io or {})
user_patches = _substitutes_modules_to_ios(io_subs)
patches = {**user_patches, **save_mode_patches}
patches = {**save_mode_patches, **user_patches}
if patches:
patched_nodes = _patch_nodes(*nodes_and_views, patches=patches)
graph = NodeGraph.from_nodes(patched_nodes)
Expand Down
24 changes: 23 additions & 1 deletion packages/ordeq/tests/resources/runner/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,33 @@ def f4(i: str, j: str, k: str) -> str:

pipeline = [f1, f2, f3, f4]

run(*pipeline, save="all", verbose=True)
run(*pipeline, save="none", verbose=True)
print("Expect R4 to be empty")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

run(*pipeline, save="sinks", verbose=True)
print("Expect R4 to be populated")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

run(*pipeline, save="all", verbose=True)
print("Expect R4 to be populated")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

run(*pipeline, save="none", verbose=True)
print("Expect R4 to be empty")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

R5 = StringBuffer()
run(*pipeline, save="none", io={R4: R5}, verbose=True)
print("Expect R4 to be empty")
print(R4.load())
print("Expect R5 to be populated")
print(R5.load())
91 changes: 81 additions & 10 deletions packages/ordeq/tests/snapshots/runner/graph.snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,36 @@ def f4(i: str, j: str, k: str) -> str:

pipeline = [f1, f2, f3, f4]

run(*pipeline, save="all", verbose=True)
run(*pipeline, save="none", verbose=True)
print("Expect R4 to be empty")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

run(*pipeline, save="sinks", verbose=True)
print("Expect R4 to be populated")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

run(*pipeline, save="all", verbose=True)
print("Expect R4 to be populated")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

run(*pipeline, save="none", verbose=True)
print("Expect R4 to be empty")
print(R4.load())
R4._buffer.truncate(0)
R4._buffer.seek(0)

R5 = StringBuffer()
run(*pipeline, save="none", io={R4: R5}, verbose=True)
print("Expect R4 to be empty")
print(R4.load())
print("Expect R5 to be populated")
print(R5.load())

```

Expand All @@ -61,6 +83,35 @@ Node:__main__:f2 --> io-4
io-3 --> Node:__main__:f4
io-4 --> Node:__main__:f4
Node:__main__:f4 --> io-5
Expect R4 to be empty

io-0 --> Node:__main__:f1
io-0 --> Node:__main__:f2
io-1 --> Node:__main__:f1
Node:__main__:f1 --> io-2
io-2 --> Node:__main__:f2
io-2 --> Node:__main__:f3
io-2 --> Node:__main__:f4
Node:__main__:f3 --> io-3
Node:__main__:f2 --> io-4
io-3 --> Node:__main__:f4
io-4 --> Node:__main__:f4
Node:__main__:f4 --> io-5
Expect R4 to be populated
Hello + world! / world! - Hello + world! + Hello + world! * 2
io-0 --> Node:__main__:f1
io-0 --> Node:__main__:f2
io-1 --> Node:__main__:f1
Node:__main__:f1 --> io-2
io-2 --> Node:__main__:f2
io-2 --> Node:__main__:f3
io-2 --> Node:__main__:f4
Node:__main__:f3 --> io-3
Node:__main__:f2 --> io-4
io-3 --> Node:__main__:f4
io-4 --> Node:__main__:f4
Node:__main__:f4 --> io-5
Expect R4 to be populated
Hello + world! / world! - Hello + world! + Hello + world! * 2
io-0 --> Node:__main__:f1
io-0 --> Node:__main__:f2
Expand All @@ -74,7 +125,8 @@ Node:__main__:f2 --> io-4
io-3 --> Node:__main__:f4
io-4 --> Node:__main__:f4
Node:__main__:f4 --> io-5
Hello + world! / world! - Hello + world! + Hello + world! * 2Hello + world! / world! - Hello + world! + Hello + world! * 2
Expect R4 to be empty

io-0 --> Node:__main__:f1
io-0 --> Node:__main__:f2
io-1 --> Node:__main__:f1
Expand All @@ -87,7 +139,10 @@ Node:__main__:f2 --> io-4
io-3 --> Node:__main__:f4
io-4 --> Node:__main__:f4
Node:__main__:f4 --> io-5
Hello + world! / world! - Hello + world! + Hello + world! * 2Hello + world! / world! - Hello + world! + Hello + world! * 2
Expect R4 to be empty

Expect R5 to be populated
Hello + world! / world! - Hello + world! + Hello + world! * 2

```

Expand All @@ -97,28 +152,44 @@ Hello + world! / world! - Hello + world! + Hello + world! * 2Hello + world! / wo
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH1>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH2>)
INFO ordeq.runner Running node "f1" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.runner Running node "f2" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH4>)
INFO ordeq.runner Running node "f3" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH5>)
INFO ordeq.runner Running node "f4" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH6>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH6>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH1>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH2>)
INFO ordeq.runner Running node "f1" in module "__main__"
INFO ordeq.runner Running node "f2" in module "__main__"
INFO ordeq.runner Running node "f3" in module "__main__"
INFO ordeq.runner Running node "f4" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH1>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH2>)
INFO ordeq.runner Running node "f1" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH4>)
INFO ordeq.runner Running node "f2" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH5>)
INFO ordeq.runner Running node "f3" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH6>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH6>)
INFO ordeq.runner Running node "f4" in module "__main__"
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH1>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH2>)
INFO ordeq.runner Running node "f1" in module "__main__"
INFO ordeq.runner Running node "f2" in module "__main__"
INFO ordeq.runner Running node "f3" in module "__main__"
INFO ordeq.runner Running node "f4" in module "__main__"
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH1>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH2>)
INFO ordeq.runner Running node "f1" in module "__main__"
INFO ordeq.runner Running node "f2" in module "__main__"
INFO ordeq.runner Running node "f3" in module "__main__"
INFO ordeq.runner Running node "f4" in module "__main__"
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH6>)
INFO ordeq.io Saving StringBuffer(_buffer=<_io.StringIO object at HASH7>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH3>)
INFO ordeq.io Loading StringBuffer(_buffer=<_io.StringIO object at HASH7>)

```
6 changes: 4 additions & 2 deletions packages/ordeq/tests/snapshots/typing.snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ packages/ordeq/tests/resources/substitute/substitute_ios_with_ios.py:6: error: N
packages/ordeq/tests/resources/substitute/substitute_ios_with_ios.py:8: error: Need type annotation for "B" [var-annotated]
packages/ordeq/tests/resources/runner/logging_verbosity.py:17: error: Argument 1 to "from_nodes" of "NodeGraph" has incompatible type "set[Node[Any, Any]]"; expected "Sequence[Node[Any, Any]]" [arg-type]
packages/ordeq/tests/resources/runner/graph.py:35: error: Argument 1 to "run" has incompatible type "*list[function]"; expected Module | Callable[..., Any] | str [arg-type]
packages/ordeq/tests/resources/runner/graph.py:38: error: Argument 1 to "run" has incompatible type "*list[function]"; expected Module | Callable[..., Any] | str [arg-type]
packages/ordeq/tests/resources/runner/graph.py:41: error: Argument 1 to "run" has incompatible type "*list[function]"; expected Module | Callable[..., Any] | str [arg-type]
packages/ordeq/tests/resources/runner/graph.py:47: error: Argument 1 to "run" has incompatible type "*list[function]"; expected Module | Callable[..., Any] | str [arg-type]
packages/ordeq/tests/resources/runner/graph.py:53: error: Argument 1 to "run" has incompatible type "*list[function]"; expected Module | Callable[..., Any] | str [arg-type]
packages/ordeq/tests/resources/runner/graph.py:60: error: Argument 1 to "run" has incompatible type "*list[function]"; expected Module | Callable[..., Any] | str [arg-type]
packages/ordeq/tests/resources/nodes/node_unexpected_output_type.py:7: error: No overload variant of "node" matches argument types "Literal[str]", "Literal[str]" [call-overload]
packages/ordeq/tests/resources/nodes/node_unexpected_output_type.py:7: note: Possible overload variants:
packages/ordeq/tests/resources/nodes/node_unexpected_output_type.py:7: note: def [FuncParams`-1, FuncReturns] node(func: Callable[FuncParams, FuncReturns], *, inputs: Sequence[Input[Any] | Callable[..., Any]] | Input[Any] | Callable[..., Any] | None = ..., outputs: Sequence[Output[Any]] | Output[Any] | None = ..., **attributes: Any) -> Callable[FuncParams, FuncReturns]
Expand All @@ -57,4 +59,4 @@ packages/ordeq/tests/resources/views/standalone_view_df_filter.py:18: error: No
packages/ordeq/tests/resources/views/standalone_view_df_filter.py:18: note: Possible overload variants:
packages/ordeq/tests/resources/views/standalone_view_df_filter.py:18: note: def where(self, cond: Series[Any] | DataFrame | ndarray[tuple[Any, ...], dtype[Any]] | Callable[[DataFrame], DataFrame] | Callable[[Any], bool], other: Any = ..., *, inplace: Literal[True], axis: Literal['index', 0] | Literal['columns', 1] | None = ..., level: Hashable | None = ...) -> None
packages/ordeq/tests/resources/views/standalone_view_df_filter.py:18: note: def where(self, cond: Series[Any] | DataFrame | ndarray[tuple[Any, ...], dtype[Any]] | Callable[[DataFrame], DataFrame] | Callable[[Any], bool], other: Any = ..., *, inplace: Literal[False] = ..., axis: Literal['index', 0, 'columns', 1] | None = ..., level: Hashable | None = ...) -> DataFrame
Found 26 errors in 20 files (checked 232 source files)
Found 28 errors in 20 files (checked 232 source files)
Loading