computation-graph 53__tar.gz → 54__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {computation-graph-53 → computation-graph-54}/PKG-INFO +1 -1
- {computation-graph-53 → computation-graph-54}/computation_graph/base_types.py +0 -2
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/__init__.py +31 -33
- {computation-graph-53 → computation-graph-54}/computation_graph/graph.py +24 -21
- {computation-graph-53 → computation-graph-54}/computation_graph/graph_test.py +5 -5
- {computation-graph-53 → computation-graph-54}/computation_graph/legacy.py +3 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/run.py +35 -6
- {computation-graph-53 → computation-graph-54}/computation_graph/signature.py +7 -10
- {computation-graph-53 → computation-graph-54}/computation_graph.egg-info/PKG-INFO +1 -1
- {computation-graph-53 → computation-graph-54}/setup.py +1 -1
- {computation-graph-53 → computation-graph-54}/LICENSE.md +0 -0
- {computation-graph-53 → computation-graph-54}/README.md +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/__init__.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/composers_test.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/condition.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/condition_test.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/debug.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/duplication.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/lift.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/logic.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/memory.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/composers/memory_test.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/graph_runners.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/trace/__init__.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/trace/ascii.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/trace/graphviz.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/trace/graphviz_test.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/trace/mermaid.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph/trace/trace_utils.py +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph.egg-info/SOURCES.txt +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph.egg-info/dependency_links.txt +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph.egg-info/requires.txt +0 -0
- {computation-graph-53 → computation-graph-54}/computation_graph.egg-info/top_level.txt +0 -0
- {computation-graph-53 → computation-graph-54}/pyproject.toml +0 -0
- {computation-graph-53 → computation-graph-54}/setup.cfg +0 -0
|
@@ -48,14 +48,14 @@ def make_and(
|
|
|
48
48
|
|
|
49
49
|
merge_node = graph.make_computation_node(args_to_tuple)
|
|
50
50
|
|
|
51
|
-
return gamla.pipe(
|
|
51
|
+
return gamla.sync.pipe(
|
|
52
52
|
funcs,
|
|
53
|
-
gamla.map(_callable_or_graph_type_to_node_or_graph_type),
|
|
53
|
+
gamla.sync.map(_callable_or_graph_type_to_node_or_graph_type),
|
|
54
54
|
tuple,
|
|
55
|
-
gamla.juxtcat(
|
|
56
|
-
gamla.map(_get_edges_from_node_or_graph),
|
|
57
|
-
gamla.compose_left(
|
|
58
|
-
gamla.map(_infer_sink),
|
|
55
|
+
gamla.sync.juxtcat(
|
|
56
|
+
gamla.sync.map(_get_edges_from_node_or_graph),
|
|
57
|
+
gamla.sync.compose_left(
|
|
58
|
+
gamla.sync.map(_infer_sink),
|
|
59
59
|
tuple,
|
|
60
60
|
lambda nodes: (
|
|
61
61
|
(
|
|
@@ -72,7 +72,7 @@ def make_and(
|
|
|
72
72
|
),
|
|
73
73
|
),
|
|
74
74
|
),
|
|
75
|
-
gamla.star(base_types.merge_graphs),
|
|
75
|
+
gamla.sync.star(base_types.merge_graphs),
|
|
76
76
|
)
|
|
77
77
|
|
|
78
78
|
|
|
@@ -92,13 +92,13 @@ def make_or(
|
|
|
92
92
|
|
|
93
93
|
filter_node = graph.make_computation_node(filter_computation_errors)
|
|
94
94
|
|
|
95
|
-
return gamla.pipe(
|
|
95
|
+
return gamla.sync.pipe(
|
|
96
96
|
funcs,
|
|
97
|
-
gamla.map(make_optional(default_value=_ComputationError())),
|
|
97
|
+
gamla.sync.map(make_optional(default_value=_ComputationError())),
|
|
98
98
|
tuple,
|
|
99
|
-
gamla.
|
|
100
|
-
gamla.compose_left(
|
|
101
|
-
gamla.map(_infer_sink),
|
|
99
|
+
gamla.sync.pair_right(
|
|
100
|
+
gamla.sync.compose_left(
|
|
101
|
+
gamla.sync.map(_infer_sink),
|
|
102
102
|
tuple,
|
|
103
103
|
lambda sinks: (
|
|
104
104
|
(
|
|
@@ -116,7 +116,7 @@ def make_or(
|
|
|
116
116
|
)
|
|
117
117
|
),
|
|
118
118
|
gamla.concat,
|
|
119
|
-
gamla.star(base_types.merge_graphs),
|
|
119
|
+
gamla.sync.star(base_types.merge_graphs),
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
|
|
@@ -126,18 +126,16 @@ _destinations = gamla.compose(set, gamla.map(base_types.edge_destination))
|
|
|
126
126
|
def _infer_sink(graph_or_node: base_types.NodeOrGraph) -> base_types.ComputationNode:
|
|
127
127
|
if isinstance(graph_or_node, base_types.ComputationNode):
|
|
128
128
|
return graph_or_node
|
|
129
|
-
graph_without_future_edges =
|
|
129
|
+
graph_without_future_edges = graph.remove_future_edges(graph_or_node)
|
|
130
130
|
if graph_without_future_edges:
|
|
131
131
|
try:
|
|
132
|
-
return
|
|
133
|
-
graph_without_future_edges, graph.sink_excluding_terminals
|
|
134
|
-
)
|
|
132
|
+
return graph.sink_excluding_terminals(graph_without_future_edges)
|
|
135
133
|
except AssertionError:
|
|
136
134
|
# If we reached here we can try again without sources of future edges.
|
|
137
|
-
sources_of_future_edges = gamla.pipe(
|
|
135
|
+
sources_of_future_edges = gamla.sync.pipe(
|
|
138
136
|
graph_or_node,
|
|
139
|
-
gamla.filter(base_types.edge_is_future),
|
|
140
|
-
gamla.map(base_types.edge_source),
|
|
137
|
+
gamla.sync.filter(base_types.edge_is_future),
|
|
138
|
+
gamla.sync.map(base_types.edge_source),
|
|
141
139
|
frozenset,
|
|
142
140
|
)
|
|
143
141
|
result = (
|
|
@@ -234,30 +232,30 @@ def _infer_composition_edges(
|
|
|
234
232
|
graph.get_incoming_edges_for_node(destination)
|
|
235
233
|
)
|
|
236
234
|
return base_types.merge_graphs(
|
|
237
|
-
gamla.pipe(
|
|
235
|
+
gamla.sync.pipe(
|
|
238
236
|
destination,
|
|
239
|
-
gamla.mapcat(graph.get_edge_nodes),
|
|
237
|
+
gamla.sync.mapcat(graph.get_edge_nodes),
|
|
240
238
|
gamla.unique,
|
|
241
|
-
gamla.filter(
|
|
242
|
-
gamla.compose_left(
|
|
239
|
+
gamla.sync.filter(
|
|
240
|
+
gamla.sync.compose_left(
|
|
243
241
|
unbound_signature,
|
|
244
242
|
lambda sig: key in sig.kwargs
|
|
245
243
|
or (key is None and signature.is_unary(sig)),
|
|
246
244
|
)
|
|
247
245
|
),
|
|
248
246
|
# Do not add edges to nodes from source that are already present in destination (cycle).
|
|
249
|
-
gamla.filter(
|
|
247
|
+
gamla.sync.filter(
|
|
250
248
|
lambda node: isinstance(source, base_types.ComputationNode)
|
|
251
249
|
or node not in graph.get_all_nodes(source)
|
|
252
250
|
),
|
|
253
|
-
gamla.map(
|
|
251
|
+
gamla.sync.map(
|
|
254
252
|
lambda destination: try_connect(
|
|
255
253
|
destination=destination,
|
|
256
254
|
unbound_destination_signature=unbound_signature(destination),
|
|
257
255
|
)
|
|
258
256
|
),
|
|
259
257
|
tuple,
|
|
260
|
-
gamla.check(
|
|
258
|
+
gamla.sync.check(
|
|
261
259
|
gamla.identity,
|
|
262
260
|
AssertionError(
|
|
263
261
|
f"Cannot compose, destination signature does not contain key '{key}'"
|
|
@@ -278,13 +276,13 @@ def _make_compose_inner(
|
|
|
278
276
|
assert (
|
|
279
277
|
len(funcs) > 1
|
|
280
278
|
), f"Only {len(funcs)} function passed to compose, need at least 2, funcs={funcs}"
|
|
281
|
-
return gamla.pipe(
|
|
279
|
+
return gamla.sync.pipe(
|
|
282
280
|
funcs,
|
|
283
281
|
reversed,
|
|
284
|
-
gamla.map(_callable_or_graph_type_to_node_or_graph_type),
|
|
282
|
+
gamla.sync.map(_callable_or_graph_type_to_node_or_graph_type),
|
|
285
283
|
gamla.sliding_window(2),
|
|
286
|
-
gamla.map(gamla.star(_infer_composition_edges(priority, key, is_future))),
|
|
287
|
-
gamla.star(base_types.merge_graphs),
|
|
284
|
+
gamla.sync.map(gamla.star(_infer_composition_edges(priority, key, is_future))),
|
|
285
|
+
gamla.sync.star(base_types.merge_graphs),
|
|
288
286
|
)
|
|
289
287
|
|
|
290
288
|
|
|
@@ -389,8 +387,8 @@ def compose_dict(
|
|
|
389
387
|
return gamla.pipe(
|
|
390
388
|
d,
|
|
391
389
|
dict.items,
|
|
392
|
-
gamla.map(gamla.star(lambda key, fn: make_compose(f, fn, key=key))),
|
|
393
|
-
gamla.star(base_types.merge_graphs),
|
|
390
|
+
gamla.sync.map(gamla.star(lambda key, fn: make_compose(f, fn, key=key))),
|
|
391
|
+
gamla.sync.star(base_types.merge_graphs),
|
|
394
392
|
) or compose_left_unary(f, lambda x: x)
|
|
395
393
|
|
|
396
394
|
|
|
@@ -6,16 +6,16 @@ from gamla.optimized import sync as opt_gamla
|
|
|
6
6
|
|
|
7
7
|
from computation_graph import base_types, signature
|
|
8
8
|
|
|
9
|
-
get_edge_nodes =
|
|
9
|
+
get_edge_nodes = opt_gamla.ternary(
|
|
10
10
|
base_types.edge_args,
|
|
11
11
|
lambda edge: edge.args + (edge.destination,),
|
|
12
12
|
lambda edge: (edge.source, edge.destination),
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
get_all_nodes =
|
|
15
|
+
get_all_nodes = opt_gamla.compose_left(opt_gamla.mapcat(get_edge_nodes), frozenset)
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
edges_to_node_id_map =
|
|
18
|
+
edges_to_node_id_map = opt_gamla.compose_left(
|
|
19
19
|
gamla.mapcat(get_edge_nodes), gamla.unique, enumerate, gamla.map(reversed), dict
|
|
20
20
|
)
|
|
21
21
|
|
|
@@ -41,13 +41,13 @@ def make_computation_node(
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
def get_leaves(edges: base_types.GraphType) -> FrozenSet[base_types.ComputationNode]:
|
|
44
|
-
return
|
|
44
|
+
return opt_gamla.pipe(
|
|
45
45
|
edges,
|
|
46
46
|
get_all_nodes,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
opt_gamla.remove(
|
|
48
|
+
opt_gamla.pipe(
|
|
49
49
|
edges,
|
|
50
|
-
|
|
50
|
+
opt_gamla.mapcat(lambda edge: (edge.source, *edge.args)),
|
|
51
51
|
frozenset,
|
|
52
52
|
gamla.contains,
|
|
53
53
|
)
|
|
@@ -56,27 +56,29 @@ def get_leaves(edges: base_types.GraphType) -> FrozenSet[base_types.ComputationN
|
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
sink_excluding_terminals =
|
|
59
|
+
sink_excluding_terminals = opt_gamla.compose_left(
|
|
60
60
|
get_leaves,
|
|
61
|
-
|
|
61
|
+
opt_gamla.remove(base_types.node_is_terminal),
|
|
62
62
|
tuple,
|
|
63
63
|
gamla.assert_that(gamla.len_equals(1)),
|
|
64
64
|
gamla.head,
|
|
65
65
|
)
|
|
66
66
|
|
|
67
|
-
get_incoming_edges_for_node =
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
get_incoming_edges_for_node = opt_gamla.compose_left(
|
|
68
|
+
opt_gamla.groupby(base_types.edge_destination),
|
|
69
|
+
opt_gamla.valmap(frozenset),
|
|
70
70
|
gamla.dict_to_getter_with_default(frozenset()),
|
|
71
71
|
)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
get_terminals =
|
|
75
|
-
get_all_nodes,
|
|
74
|
+
get_terminals = opt_gamla.compose_left(
|
|
75
|
+
get_all_nodes, opt_gamla.filter(base_types.node_is_terminal), tuple
|
|
76
76
|
)
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
remove_future_edges =
|
|
79
|
+
remove_future_edges = opt_gamla.compose(
|
|
80
|
+
tuple, opt_gamla.remove(base_types.edge_is_future)
|
|
81
|
+
)
|
|
80
82
|
|
|
81
83
|
|
|
82
84
|
def make_source():
|
|
@@ -98,7 +100,7 @@ def make_terminal(name: str, func: Callable) -> base_types.ComputationNode:
|
|
|
98
100
|
)
|
|
99
101
|
|
|
100
102
|
|
|
101
|
-
_keep_not_in_bound_kwargs =
|
|
103
|
+
_keep_not_in_bound_kwargs = opt_gamla.compose_left(
|
|
102
104
|
opt_gamla.map(base_types.edge_key),
|
|
103
105
|
gamla.filter(gamla.identity),
|
|
104
106
|
frozenset,
|
|
@@ -151,15 +153,15 @@ def _replace_source_in_edges(
|
|
|
151
153
|
traverse_forward: Callable[
|
|
152
154
|
[base_types.GraphType],
|
|
153
155
|
Callable[[base_types.CallableOrNode], Tuple[base_types.ComputationNode, ...]],
|
|
154
|
-
] =
|
|
156
|
+
] = opt_gamla.compose_left(
|
|
155
157
|
gamla.mapcat(
|
|
156
|
-
|
|
158
|
+
opt_gamla.compose_left(
|
|
157
159
|
gamla.juxt(base_types.edge_sources, base_types.edge_destination),
|
|
158
160
|
gamla.explode(0),
|
|
159
161
|
)
|
|
160
162
|
),
|
|
161
163
|
gamla.groupby_many_reduce(
|
|
162
|
-
|
|
164
|
+
opt_gamla.compose_left(gamla.head, gamla.wrap_tuple),
|
|
163
165
|
lambda destinations, e: (*(destinations if destinations else ()), e[1]),
|
|
164
166
|
),
|
|
165
167
|
gamla.dict_to_getter_with_default(()),
|
|
@@ -212,7 +214,8 @@ def transform_edges(
|
|
|
212
214
|
edge_mapper: Callable[[base_types.ComputationEdge], base_types.ComputationEdge],
|
|
213
215
|
):
|
|
214
216
|
return _operate_on_subgraph(
|
|
215
|
-
_split_by_condition(query),
|
|
217
|
+
_split_by_condition(query),
|
|
218
|
+
opt_gamla.compose_left(gamla.map(edge_mapper), tuple),
|
|
216
219
|
)
|
|
217
220
|
|
|
218
221
|
|
|
@@ -283,7 +286,7 @@ def _operate_on_subgraph(selector, transformation):
|
|
|
283
286
|
|
|
284
287
|
|
|
285
288
|
def _split_by_condition(condition):
|
|
286
|
-
return
|
|
289
|
+
return opt_gamla.compose_left(
|
|
287
290
|
gamla.bifurcate(gamla.filter(condition), gamla.remove(condition)),
|
|
288
291
|
gamla.map(tuple),
|
|
289
292
|
tuple,
|
|
@@ -376,7 +376,7 @@ def test_or_with_sink_that_raises():
|
|
|
376
376
|
|
|
377
377
|
|
|
378
378
|
def test_unambiguous_composition_using_terminal():
|
|
379
|
-
terminal = graph.make_terminal("1", lambda x: x)
|
|
379
|
+
terminal = graph.make_terminal("1", lambda x: x[0])
|
|
380
380
|
|
|
381
381
|
def source():
|
|
382
382
|
return 1
|
|
@@ -403,8 +403,8 @@ def test_unambiguous_composition_using_terminal():
|
|
|
403
403
|
|
|
404
404
|
|
|
405
405
|
def test_two_terminals():
|
|
406
|
-
terminal1 = graph.make_terminal("1",
|
|
407
|
-
terminal2 = graph.make_terminal("2",
|
|
406
|
+
terminal1 = graph.make_terminal("1", lambda x: x)
|
|
407
|
+
terminal2 = graph.make_terminal("2", lambda x: x)
|
|
408
408
|
result = graph_runners.unary_bare(
|
|
409
409
|
base_types.merge_graphs(
|
|
410
410
|
composers.compose_unary(terminal1, composers.make_compose(_node2, _node1)),
|
|
@@ -418,8 +418,8 @@ def test_two_terminals():
|
|
|
418
418
|
|
|
419
419
|
def test_two_paths_succeed():
|
|
420
420
|
source = graph.make_source()
|
|
421
|
-
terminal1 = graph.make_terminal("1",
|
|
422
|
-
terminal2 = graph.make_terminal("2",
|
|
421
|
+
terminal1 = graph.make_terminal("1", lambda x: x)
|
|
422
|
+
terminal2 = graph.make_terminal("2", lambda x: x)
|
|
423
423
|
result = graph_runners.variadic_bare(
|
|
424
424
|
base_types.merge_graphs(
|
|
425
425
|
composers.make_first(
|
|
@@ -16,7 +16,7 @@ import typeguard
|
|
|
16
16
|
from gamla.optimized import async_functions as opt_async_gamla
|
|
17
17
|
from gamla.optimized import sync as opt_gamla
|
|
18
18
|
|
|
19
|
-
from computation_graph import base_types, graph, signature
|
|
19
|
+
from computation_graph import base_types, composers, graph, signature
|
|
20
20
|
from computation_graph.composers import debug
|
|
21
21
|
|
|
22
22
|
|
|
@@ -28,7 +28,7 @@ _NodeToResults = Dict[base_types.ComputationNode, base_types.Result]
|
|
|
28
28
|
_ComputationInput = Tuple[Tuple[base_types.Result, ...], Dict[str, base_types.Result]]
|
|
29
29
|
_SingleNodeSideEffect = Callable[[base_types.ComputationNode, Any], None]
|
|
30
30
|
_NodeToComputationInput = Callable[[base_types.ComputationNode], _ComputationInput]
|
|
31
|
-
|
|
31
|
+
_ComputationInputSpec = Tuple[
|
|
32
32
|
Tuple[base_types.ComputationNode, ...], Dict[str, base_types.ComputationNode]
|
|
33
33
|
]
|
|
34
34
|
|
|
@@ -143,12 +143,41 @@ _graph_to_future_sources = opt_gamla.compose_left(
|
|
|
143
143
|
)
|
|
144
144
|
|
|
145
145
|
|
|
146
|
+
"""Replace multiple edges pointing to a terminal with one edge that has multiple args"""
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _merge_edges_pointing_to_terminals(g: base_types.GraphType) -> base_types.GraphType:
|
|
150
|
+
return gamla.compose_left(
|
|
151
|
+
gamla.groupby(gamla.attrgetter("destination")),
|
|
152
|
+
gamla.itemmap(
|
|
153
|
+
gamla.star(
|
|
154
|
+
lambda dest, edges_for_dest: (
|
|
155
|
+
dest,
|
|
156
|
+
base_types.merge_graphs(
|
|
157
|
+
composers.make_or(
|
|
158
|
+
opt_gamla.maptuple(base_types.edge_source)(edges_for_dest),
|
|
159
|
+
merge_fn=(aggregate := lambda args: args),
|
|
160
|
+
),
|
|
161
|
+
composers.compose_left_unary(aggregate, dest),
|
|
162
|
+
)
|
|
163
|
+
if dest.is_terminal
|
|
164
|
+
else edges_for_dest,
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
),
|
|
168
|
+
dict.values,
|
|
169
|
+
gamla.concat,
|
|
170
|
+
tuple,
|
|
171
|
+
)(g)
|
|
172
|
+
|
|
173
|
+
|
|
146
174
|
def _to_callable_with_side_effect_for_single_and_multiple(
|
|
147
175
|
single_node_side_effect: _SingleNodeSideEffect,
|
|
148
176
|
all_nodes_side_effect: Callable,
|
|
149
177
|
edges: base_types.GraphType,
|
|
150
178
|
handled_exceptions: Tuple[Type[Exception], ...],
|
|
151
179
|
) -> Callable[[_NodeToResults, _NodeToResults], _NodeToResults]:
|
|
180
|
+
edges = _merge_edges_pointing_to_terminals(edges)
|
|
152
181
|
single_node_side_effect = (
|
|
153
182
|
(lambda node, result: result)
|
|
154
183
|
if os.getenv(base_types.COMPUTATION_GRAPH_DEBUG_ENV_KEY) is None
|
|
@@ -238,7 +267,7 @@ _get_kwargs_nodes = opt_gamla.compose_left(
|
|
|
238
267
|
|
|
239
268
|
def _node_incoming_edges_to_input_spec(
|
|
240
269
|
node_incoming_edges: Tuple[base_types.ComputationEdge],
|
|
241
|
-
) ->
|
|
270
|
+
) -> _ComputationInputSpec:
|
|
242
271
|
if not len(node_incoming_edges):
|
|
243
272
|
return (), {}
|
|
244
273
|
first_incoming_edge = gamla.head(node_incoming_edges)
|
|
@@ -256,7 +285,7 @@ def _edges_to_accumulated_results_to_node_to_first_possible_input(
|
|
|
256
285
|
) -> Callable[[_NodeToResults], _NodeToComputationInput]:
|
|
257
286
|
node_to_incoming_edges = graph.get_incoming_edges_for_node(edges)
|
|
258
287
|
node_to_computation_input_spec_options: Callable[
|
|
259
|
-
[base_types.ComputationNode], Tuple[
|
|
288
|
+
[base_types.ComputationNode], Tuple[_ComputationInputSpec]
|
|
260
289
|
] = functools.cache(
|
|
261
290
|
gamla.compose_left(
|
|
262
291
|
node_to_incoming_edges,
|
|
@@ -304,7 +333,7 @@ def _make_reduce_layers(
|
|
|
304
333
|
get_node_input_and_apply = _make_get_node_input_and_apply(
|
|
305
334
|
is_async, single_node_side_effect
|
|
306
335
|
)
|
|
307
|
-
|
|
336
|
+
accumulated_results_to_node_to_input = (
|
|
308
337
|
_edges_to_accumulated_results_to_node_to_first_possible_input(edges)
|
|
309
338
|
)
|
|
310
339
|
single_layer_reducer = debug.name_callable(
|
|
@@ -314,7 +343,7 @@ def _make_reduce_layers(
|
|
|
314
343
|
gamla.head,
|
|
315
344
|
gamla.compose_left(
|
|
316
345
|
opt_gamla.packstack(
|
|
317
|
-
|
|
346
|
+
accumulated_results_to_node_to_input, gamla.identity
|
|
318
347
|
),
|
|
319
348
|
gamla.explode(1),
|
|
320
349
|
gamla.map_filter_empty(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import inspect
|
|
3
3
|
from types import MappingProxyType
|
|
4
|
-
from typing import Callable, FrozenSet
|
|
4
|
+
from typing import Callable, FrozenSet
|
|
5
5
|
|
|
6
6
|
import gamla
|
|
7
7
|
|
|
@@ -34,16 +34,13 @@ def _is_default(parameter):
|
|
|
34
34
|
|
|
35
35
|
_parameter_name = gamla.attrgetter("name")
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
gamla.compose_left(
|
|
40
|
-
inspect.signature,
|
|
41
|
-
gamla.attrgetter("parameters"),
|
|
42
|
-
MappingProxyType.values,
|
|
43
|
-
tuple,
|
|
44
|
-
)
|
|
37
|
+
_func_parameters = gamla.compose_left(
|
|
38
|
+
inspect.signature, gamla.attrgetter("parameters"), MappingProxyType.values, tuple
|
|
45
39
|
)
|
|
46
|
-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def from_callable(func: Callable) -> base_types.NodeSignature:
|
|
43
|
+
function_parameters = _func_parameters(func)
|
|
47
44
|
return base_types.NodeSignature(
|
|
48
45
|
is_args=gamla.anymap(parameter_is_star)(function_parameters),
|
|
49
46
|
is_kwargs=gamla.anymap(parameter_is_double_star)(function_parameters),
|
|
@@ -7,7 +7,7 @@ with open("README.md", "r") as fh:
|
|
|
7
7
|
setuptools.setup(
|
|
8
8
|
name="computation-graph",
|
|
9
9
|
python_requires=">=3",
|
|
10
|
-
version="
|
|
10
|
+
version="54",
|
|
11
11
|
long_description=_LONG_DESCRIPTION,
|
|
12
12
|
long_description_content_type="text/markdown",
|
|
13
13
|
packages=setuptools.find_namespace_packages(),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{computation-graph-53 → computation-graph-54}/computation_graph.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|