computation-graph 64__tar.gz → 65__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-64 → computation_graph-65}/PKG-INFO +8 -2
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/lift.py +9 -1
- computation_graph-65/computation_graph/composers/lift_test.py +42 -0
- {computation_graph-64 → computation_graph-65}/computation_graph.egg-info/PKG-INFO +8 -2
- {computation_graph-64 → computation_graph-65}/computation_graph.egg-info/SOURCES.txt +1 -0
- {computation_graph-64 → computation_graph-65}/setup.py +1 -1
- {computation_graph-64 → computation_graph-65}/LICENSE.md +0 -0
- {computation_graph-64 → computation_graph-65}/README.md +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/__init__.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/base_types.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/__init__.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/composers_test.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/condition.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/condition_test.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/debug.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/duplication.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/logic.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/memory.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/composers/memory_test.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/graph.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/graph_runners.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/graph_test.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/legacy.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/run.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/signature.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/trace/__init__.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/trace/ascii.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/trace/graphviz.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/trace/graphviz_test.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/trace/mermaid.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph/trace/trace_utils.py +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph.egg-info/dependency_links.txt +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph.egg-info/requires.txt +0 -0
- {computation_graph-64 → computation_graph-65}/computation_graph.egg-info/top_level.txt +0 -0
- {computation_graph-64 → computation_graph-65}/pyproject.toml +0 -0
- {computation_graph-64 → computation_graph-65}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: computation-graph
|
|
3
|
-
Version:
|
|
3
|
+
Version: 65
|
|
4
4
|
Requires-Python: >=3
|
|
5
5
|
Description-Content-Type: text/markdown
|
|
6
6
|
License-File: LICENSE.md
|
|
@@ -12,6 +12,12 @@ Requires-Dist: termcolor
|
|
|
12
12
|
Provides-Extra: test
|
|
13
13
|
Requires-Dist: pygraphviz; extra == "test"
|
|
14
14
|
Requires-Dist: pytest>=5.4.0; extra == "test"
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
Dynamic: provides-extra
|
|
19
|
+
Dynamic: requires-dist
|
|
20
|
+
Dynamic: requires-python
|
|
15
21
|
|
|
16
22
|
[](https://travis-ci.com/hyroai/computation-graph)
|
|
17
23
|
|
|
@@ -5,11 +5,19 @@ import gamla
|
|
|
5
5
|
from computation_graph import base_types, composers
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
def _short_name(x) -> str:
|
|
9
|
+
if x is None or isinstance(x, (int, float, str)):
|
|
10
|
+
return f"{x!s:.30}"
|
|
11
|
+
if isinstance(x, (dict, list, tuple, set, frozenset)):
|
|
12
|
+
return f"{type(x).__name__}[{len(x)}]"
|
|
13
|
+
return type(x).__name__
|
|
14
|
+
|
|
15
|
+
|
|
8
16
|
def always(x):
|
|
9
17
|
def always():
|
|
10
18
|
return x
|
|
11
19
|
|
|
12
|
-
always.__name__ = f"always {x
|
|
20
|
+
always.__name__ = f"always {_short_name(x)}"
|
|
13
21
|
return always
|
|
14
22
|
|
|
15
23
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from computation_graph.composers import lift
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_always_returns_the_value():
|
|
5
|
+
assert lift.always(5)() == 5
|
|
6
|
+
obj = {"a": 1}
|
|
7
|
+
assert lift.always(obj)() is obj
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_always_name_keeps_scalars_readable():
|
|
11
|
+
assert lift.always(5).__name__ == "always 5"
|
|
12
|
+
assert lift.always(3.5).__name__ == "always 3.5"
|
|
13
|
+
assert lift.always("cardiology").__name__ == "always cardiology"
|
|
14
|
+
assert lift.always(None).__name__ == "always None"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_always_name_summarizes_containers_by_type_and_length():
|
|
18
|
+
assert lift.always({"a": 1, "b": 2}).__name__ == "always dict[2]"
|
|
19
|
+
assert lift.always([1, 2, 3]).__name__ == "always list[3]"
|
|
20
|
+
assert lift.always((1, 2)).__name__ == "always tuple[2]"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_always_name_does_not_render_large_container_contents():
|
|
24
|
+
# The point of the summary: naming a node must not stringify a huge value.
|
|
25
|
+
name = lift.always({i: i for i in range(10_000)}).__name__
|
|
26
|
+
assert name == "always dict[10000]"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_always_name_falls_back_to_type_for_other_objects():
|
|
30
|
+
class Custom:
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
assert lift.always(Custom()).__name__ == "always Custom"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_distinct_always_calls_produce_distinct_nodes_despite_equal_names():
|
|
37
|
+
# Names are display-only; node identity is hash(func), and every always()
|
|
38
|
+
# call is a fresh function, so equal names must not collapse two nodes.
|
|
39
|
+
a, b = lift.always({"x": 1}), lift.always({"y": 2})
|
|
40
|
+
assert a.__name__ == b.__name__ == "always dict[1]"
|
|
41
|
+
assert a is not b
|
|
42
|
+
assert hash(a) != hash(b)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: computation-graph
|
|
3
|
-
Version:
|
|
3
|
+
Version: 65
|
|
4
4
|
Requires-Python: >=3
|
|
5
5
|
Description-Content-Type: text/markdown
|
|
6
6
|
License-File: LICENSE.md
|
|
@@ -12,6 +12,12 @@ Requires-Dist: termcolor
|
|
|
12
12
|
Provides-Extra: test
|
|
13
13
|
Requires-Dist: pygraphviz; extra == "test"
|
|
14
14
|
Requires-Dist: pytest>=5.4.0; extra == "test"
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
Dynamic: provides-extra
|
|
19
|
+
Dynamic: requires-dist
|
|
20
|
+
Dynamic: requires-python
|
|
15
21
|
|
|
16
22
|
[](https://travis-ci.com/hyroai/computation-graph)
|
|
17
23
|
|
|
@@ -22,6 +22,7 @@ computation_graph/composers/condition_test.py
|
|
|
22
22
|
computation_graph/composers/debug.py
|
|
23
23
|
computation_graph/composers/duplication.py
|
|
24
24
|
computation_graph/composers/lift.py
|
|
25
|
+
computation_graph/composers/lift_test.py
|
|
25
26
|
computation_graph/composers/logic.py
|
|
26
27
|
computation_graph/composers/memory.py
|
|
27
28
|
computation_graph/composers/memory_test.py
|
|
@@ -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="65",
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{computation_graph-64 → computation_graph-65}/computation_graph.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|