memory-graph 0.3.18__tar.gz → 0.3.19__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.
- {memory_graph-0.3.18/memory_graph.egg-info → memory_graph-0.3.19}/PKG-INFO +6 -5
- {memory_graph-0.3.18 → memory_graph-0.3.19}/README.md +5 -4
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree.py +2 -2
- memory_graph-0.3.19/images/avltree_leaf.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging01.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging02.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging03.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging04.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging05.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging06.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial01.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial02.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial03.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial04.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial05.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial06.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial07.png +0 -0
- memory_graph-0.3.19/images/log.txt +186 -0
- memory_graph-0.3.19/images/not_node_types2.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set1.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set10.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set11.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set12.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set13.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set14.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set15.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set16.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set17.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set18.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set19.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set2.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set20.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set21.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set22.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set3.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set4.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set5.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set6.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set7.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set8.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set9.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/__init__.py +1 -1
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/config_default.py +8 -8
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/memory_to_nodes.py +2 -2
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/node_base.py +6 -6
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/node_key_value.py +3 -1
- memory_graph-0.3.19/memory_graph/node_leaf.py +23 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/node_linear.py +3 -1
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/node_table.py +2 -2
- {memory_graph-0.3.18 → memory_graph-0.3.19/memory_graph.egg-info}/PKG-INFO +6 -5
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph.egg-info/SOURCES.txt +3 -2
- {memory_graph-0.3.18 → memory_graph-0.3.19}/setup.py +1 -1
- memory_graph-0.3.18/TODO.txt +0 -9
- memory_graph-0.3.18/images/avltree_base.png +0 -0
- memory_graph-0.3.18/images/not_node_types2.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/LICENSE.txt +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/MANIFEST.in +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/.ipynb_checkpoints/jupyter_example-checkpoint.ipynb +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/add_one.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/add_one.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree.py~ +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree_dir.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree_fail.gv +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree_fail.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree_key_value.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree_linear.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/avltree_table.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/bin_tree.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/bin_tree.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/bin_tree2.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/bin_tree2.py~ +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/copies.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/copies.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/copy_method.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/copy_method.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/create_gif.sh +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/create_images.sh +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debug_vscode.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging.gif +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/debugging.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/extension_numpy.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/extension_numpy.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/extension_pandas.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/extension_pandas.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial.gif +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/factorial.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/hash_set.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/hash_set.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/highlight.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/highlight.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/immutable.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/immutable1.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/immutable2.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/ipython.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/jupyter_example.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/linked_list.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/linked_list.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/many_types.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/many_types.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/memory_graph.gv.pdf +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/memory_graph.pdf +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/mutable.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/mutable1.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/mutable2.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/my_graph.gv +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/my_graph.pdf +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/name_rebinding.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/not_node_types.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/not_node_types.py~ +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/not_node_types1.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set.gif +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/power_set.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/pyodide.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/rebinding1.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/rebinding2.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/images/uva.png +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/install.txt +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/call_stack.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/config.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/config_helpers.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/extension_numpy.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/extension_pandas.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/html_table.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/list_view.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/sequence.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/slicer.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/slices.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/slices_iterator.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/slices_table_iterator.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_max_graph_depth.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_memory_graph.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_memory_to_nodes.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_sequence.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_slicer.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_slices.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/test_slices_iterator.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph/utils.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph.egg-info/dependency_links.txt +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph.egg-info/requires.txt +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/memory_graph.egg-info/top_level.txt +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/setup.cfg +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/src/auto_memory_graph.py +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/src/jupyter_example.ipynb +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/src/pyodide.html +0 -0
- {memory_graph-0.3.18 → memory_graph-0.3.19}/uml/memory_graph.uxf +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.19
|
|
4
4
|
Summary: Generate intuitive graphs of your Python data, great for debugging and understanding complex relationships.
|
|
5
5
|
Home-page: https://github.com/bterwijn/memory_graph
|
|
6
6
|
Author: Bas Terwijn
|
|
@@ -664,8 +664,8 @@ mg.show(locals())
|
|
|
664
664
|
|
|
665
665
|
Next figure out what are the attributes you want to graph and choose a Node type, there are four options:
|
|
666
666
|
|
|
667
|
-
### 1)
|
|
668
|
-
|
|
667
|
+
### 1) Node_Leaf ###
|
|
668
|
+
Node_Leaf is a leaf node (with no children) and shows just a single value.
|
|
669
669
|
```python
|
|
670
670
|
import memory_graph as mg
|
|
671
671
|
import bintrees
|
|
@@ -678,11 +678,12 @@ tree.insert(20, "twenty")
|
|
|
678
678
|
tree.insert(15, "fifteen")
|
|
679
679
|
|
|
680
680
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
681
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
681
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_leaf.Node_Leaf(data,
|
|
682
|
+
f"key:{data.key} value:{data.value}")
|
|
682
683
|
|
|
683
684
|
mg.show(locals())
|
|
684
685
|
```
|
|
685
|
-

|
|
686
687
|
|
|
687
688
|
### 2) Node_Linear ###
|
|
688
689
|
Node_Linear shows all the values in a line like a list.
|
|
@@ -645,8 +645,8 @@ mg.show(locals())
|
|
|
645
645
|
|
|
646
646
|
Next figure out what are the attributes you want to graph and choose a Node type, there are four options:
|
|
647
647
|
|
|
648
|
-
### 1)
|
|
649
|
-
|
|
648
|
+
### 1) Node_Leaf ###
|
|
649
|
+
Node_Leaf is a leaf node (with no children) and shows just a single value.
|
|
650
650
|
```python
|
|
651
651
|
import memory_graph as mg
|
|
652
652
|
import bintrees
|
|
@@ -659,11 +659,12 @@ tree.insert(20, "twenty")
|
|
|
659
659
|
tree.insert(15, "fifteen")
|
|
660
660
|
|
|
661
661
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
662
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
662
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_leaf.Node_Leaf(data,
|
|
663
|
+
f"key:{data.key} value:{data.value}")
|
|
663
664
|
|
|
664
665
|
mg.show(locals())
|
|
665
666
|
```
|
|
666
|
-

|
|
667
668
|
|
|
668
669
|
### 2) Node_Linear ###
|
|
669
670
|
Node_Linear shows all the values in a line like a list.
|
|
@@ -19,8 +19,8 @@ mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_linear.Node
|
|
|
19
19
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.slicer.Slicer()
|
|
20
20
|
mg.render(locals(), 'avltree_dir.png')
|
|
21
21
|
|
|
22
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
23
|
-
mg.render(locals(), '
|
|
22
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_leaf.Node_Leaf(data, f"key:{data.key} value:{data.value}")
|
|
23
|
+
mg.render(locals(), 'avltree_leaf.png')
|
|
24
24
|
|
|
25
25
|
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_linear.Node_Linear(data,
|
|
26
26
|
['left:', data.left,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
diff --git a/images/avltree.py b/images/avltree.py
|
|
2
|
+
index a8400e8..c984c04 100644
|
|
3
|
+
--- a/images/avltree.py
|
|
4
|
+
+++ b/images/avltree.py
|
|
5
|
+
@@ -19,7 +19,7 @@ mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_linear.Node
|
|
6
|
+
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.slicer.Slicer()
|
|
7
|
+
mg.render(locals(), 'avltree_dir.png')
|
|
8
|
+
|
|
9
|
+
-mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_base.Node_Base(f"key:{data.key} value:{data.value}")
|
|
10
|
+
+mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_leaf.Node_Leaf(data, f"key:{data.key} value:{data.value}")
|
|
11
|
+
mg.render(locals(), 'avltree_base.png')
|
|
12
|
+
|
|
13
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_linear.Node_Linear(data,
|
|
14
|
+
diff --git a/images/avltree_base.png b/images/avltree_base.png
|
|
15
|
+
index 324c36d..de59c50 100644
|
|
16
|
+
Binary files a/images/avltree_base.png and b/images/avltree_base.png differ
|
|
17
|
+
diff --git a/images/not_node_types2.png b/images/not_node_types2.png
|
|
18
|
+
index b001e4b..ee6e943 100644
|
|
19
|
+
Binary files a/images/not_node_types2.png and b/images/not_node_types2.png differ
|
|
20
|
+
diff --git a/memory_graph/config_default.py b/memory_graph/config_default.py
|
|
21
|
+
index 4945c75..02877c0 100644
|
|
22
|
+
--- a/memory_graph/config_default.py
|
|
23
|
+
+++ b/memory_graph/config_default.py
|
|
24
|
+
@@ -3,7 +3,7 @@
|
|
25
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
26
|
+
|
|
27
|
+
""" Sets the default configuration values for the memory graph. """
|
|
28
|
+
-from memory_graph.node_base import Node_Base
|
|
29
|
+
+from memory_graph.node_leaf import Node_Leaf
|
|
30
|
+
from memory_graph.node_linear import Node_Linear
|
|
31
|
+
from memory_graph.node_key_value import Node_Key_Value
|
|
32
|
+
from memory_graph.node_table import Node_Table
|
|
33
|
+
@@ -37,14 +37,14 @@ config.not_node_types = {
|
|
34
|
+
""" Types that will not have references pointing to their children in the graph but instead will have their children visualized in their node. """
|
|
35
|
+
config.no_child_references_types = {dict, types.MappingProxyType}
|
|
36
|
+
|
|
37
|
+
-""" Conversion from type to Node_Base objects. """
|
|
38
|
+
+""" Conversion from type to Node objects. """
|
|
39
|
+
config.type_to_node = {
|
|
40
|
+
- str: lambda data: Node_Base(data), # visit as whole string, don't iterate over characters
|
|
41
|
+
+ str: lambda data: Node_Leaf(data, data), # visit as whole string, don't iterate over characters
|
|
42
|
+
call_stack: lambda data: Node_Key_Value(data, data.items()),
|
|
43
|
+
- types.FunctionType: lambda data: Node_Base(data.__qualname__),
|
|
44
|
+
- types.MethodType: lambda data: Node_Base(data.__qualname__),
|
|
45
|
+
- classmethod: lambda data: Node_Base(data.__qualname__),
|
|
46
|
+
- staticmethod: lambda data: Node_Base(data.__qualname__),
|
|
47
|
+
+ types.FunctionType: lambda data: Node_Leaf(data, data.__qualname__),
|
|
48
|
+
+ types.MethodType: lambda data: Node_Leaf(data, data.__qualname__),
|
|
49
|
+
+ classmethod: lambda data: Node_Leaf(data, data.__qualname__),
|
|
50
|
+
+ staticmethod: lambda data: Node_Leaf(data, data.__qualname__),
|
|
51
|
+
range: lambda data: Node_Key_Value(data, {'start':data.start, 'stop':data.stop, 'step':data.step}.items()),
|
|
52
|
+
dict: lambda data: (
|
|
53
|
+
Node_Key_Value(data, utils.filter_dict(data.items()) )
|
|
54
|
+
@@ -79,7 +79,7 @@ config.type_to_color = {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
""" Types that will be visualized in vertical orientation if 'True', or horizontal orientation
|
|
58
|
+
-if 'False'. Otherwise the Node_Base decides based on it having references."""
|
|
59
|
+
+if 'False'. Otherwise the Node decides based on it having references."""
|
|
60
|
+
config.type_to_vertical_orientation = {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
diff --git a/memory_graph/memory_to_nodes.py b/memory_graph/memory_to_nodes.py
|
|
64
|
+
index a67662e..10c559a 100644
|
|
65
|
+
--- a/memory_graph/memory_to_nodes.py
|
|
66
|
+
+++ b/memory_graph/memory_to_nodes.py
|
|
67
|
+
@@ -2,7 +2,7 @@
|
|
68
|
+
# Copyright (c) 2023, Bas Terwijn.
|
|
69
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
70
|
+
|
|
71
|
+
-from memory_graph.node_base import Node_Base
|
|
72
|
+
+from memory_graph.node_leaf import Node_Leaf
|
|
73
|
+
from memory_graph.node_linear import Node_Linear
|
|
74
|
+
from memory_graph.node_key_value import Node_Key_Value
|
|
75
|
+
|
|
76
|
+
@@ -21,7 +21,7 @@ def read_nodes(data):
|
|
77
|
+
elif utils.is_finite_iterable(data): # for lists, tuples, sets, ...
|
|
78
|
+
return Node_Linear(data, data)
|
|
79
|
+
else:
|
|
80
|
+
- return Node_Base(data)
|
|
81
|
+
+ return Node_Leaf(data, data)
|
|
82
|
+
|
|
83
|
+
def memory_to_nodes_recursive(nodes, data, parent, parent_index):
|
|
84
|
+
data_type = type(data)
|
|
85
|
+
diff --git a/memory_graph/node_base.py b/memory_graph/node_base.py
|
|
86
|
+
index 1f46b9a..3d1fbe1 100644
|
|
87
|
+
--- a/memory_graph/node_base.py
|
|
88
|
+
+++ b/memory_graph/node_base.py
|
|
89
|
+
@@ -7,7 +7,9 @@ import memory_graph.config as config
|
|
90
|
+
import memory_graph.config_helpers as config_helpers
|
|
91
|
+
from memory_graph.sequence import Sequence1D
|
|
92
|
+
|
|
93
|
+
-class Node_Base:
|
|
94
|
+
+from abc import ABC, abstractmethod
|
|
95
|
+
+
|
|
96
|
+
+class Node_Base(ABC):
|
|
97
|
+
"""
|
|
98
|
+
Node_Base represents a node in the memory graph. This base class has different subclasses for different types of nodes.
|
|
99
|
+
"""
|
|
100
|
+
@@ -99,10 +101,7 @@ class Node_Base:
|
|
101
|
+
from memory_graph.html_table import HTML_Table
|
|
102
|
+
import memory_graph.node_base
|
|
103
|
+
html_table = HTML_Table()
|
|
104
|
+
- if type(self) is memory_graph.node_base.Node_Base:
|
|
105
|
+
- html_table.add_string(f'{self.data}')
|
|
106
|
+
- elif not slices is None:
|
|
107
|
+
- self.fill_html_table(nodes, html_table, slices, id_to_slices)
|
|
108
|
+
+ self.fill_html_table(nodes, html_table, slices, id_to_slices)
|
|
109
|
+
return html_table
|
|
110
|
+
|
|
111
|
+
def get_slicer(self):
|
|
112
|
+
@@ -123,6 +122,7 @@ class Node_Base:
|
|
113
|
+
|
|
114
|
+
# -------------------- Node_Base interface, overriden by subclasses --------------------
|
|
115
|
+
|
|
116
|
+
+ @abstractmethod
|
|
117
|
+
def fill_html_table(self, html_table, slices, id_to_slices):
|
|
118
|
+
"""
|
|
119
|
+
Fill the HTML_Table object with each child of the node.
|
|
120
|
+
@@ -133,4 +133,4 @@ class Node_Base:
|
|
121
|
+
"""
|
|
122
|
+
Return a label for the node to be shown in the graph next to the HTML table.
|
|
123
|
+
"""
|
|
124
|
+
- return self.get_type_name()
|
|
125
|
+
|
|
126
|
+
+ return self.get_type_name()
|
|
127
|
+
diff --git a/memory_graph/node_key_value.py b/memory_graph/node_key_value.py
|
|
128
|
+
index 762857e..0c2cd86 100644
|
|
129
|
+
--- a/memory_graph/node_key_value.py
|
|
130
|
+
+++ b/memory_graph/node_key_value.py
|
|
131
|
+
@@ -54,6 +54,8 @@ class Node_Key_Value(Node_Base):
|
|
132
|
+
"""
|
|
133
|
+
Fill the html_table with the children of the Node_Base.
|
|
134
|
+
"""
|
|
135
|
+
+ if slices is None:
|
|
136
|
+
+ return
|
|
137
|
+
vertical = self.is_vertical(nodes, slices, id_to_slices)
|
|
138
|
+
if vertical:
|
|
139
|
+
self.fill_html_table_vertical(html_table, nodes, slices, id_to_slices)
|
|
140
|
+
@@ -119,4 +121,4 @@ class Node_Key_Value(Node_Base):
|
|
141
|
+
if len(s) == 1:
|
|
142
|
+
if s[0][1] - s[0][0] == size:
|
|
143
|
+
return f'{type_name}'
|
|
144
|
+
- return f'{type_name} {size}'
|
|
145
|
+
|
|
146
|
+
+ return f'{type_name} {size}'
|
|
147
|
+
diff --git a/memory_graph/node_linear.py b/memory_graph/node_linear.py
|
|
148
|
+
index c6926f0..38b8cf0 100644
|
|
149
|
+
--- a/memory_graph/node_linear.py
|
|
150
|
+
+++ b/memory_graph/node_linear.py
|
|
151
|
+
@@ -45,6 +45,8 @@ class Node_Linear(Node_Base):
|
|
152
|
+
"""
|
|
153
|
+
Fill the html_table with the children of the Node_Base.
|
|
154
|
+
"""
|
|
155
|
+
+ if slices is None:
|
|
156
|
+
+ return
|
|
157
|
+
if self.is_vertical(nodes, slices, id_to_slices):
|
|
158
|
+
self.fill_html_table_vertical(html_table, nodes, slices, id_to_slices)
|
|
159
|
+
else:
|
|
160
|
+
@@ -95,4 +97,4 @@ class Node_Linear(Node_Base):
|
|
161
|
+
if s[0][1] - s[0][0] == size:
|
|
162
|
+
return f'{type_name}'
|
|
163
|
+
return f'{type_name} {size}'
|
|
164
|
+
-
|
|
165
|
+
|
|
166
|
+
+
|
|
167
|
+
diff --git a/memory_graph/node_table.py b/memory_graph/node_table.py
|
|
168
|
+
index 67914a9..82279d3 100644
|
|
169
|
+
--- a/memory_graph/node_table.py
|
|
170
|
+
+++ b/memory_graph/node_table.py
|
|
171
|
+
@@ -35,7 +35,7 @@ class Node_Table(Node_Base):
|
|
172
|
+
"""
|
|
173
|
+
Fill the html_table with the children of the Node_Base.
|
|
174
|
+
"""
|
|
175
|
+
- if slices.is_empty():
|
|
176
|
+
+ if slices is None or slices.is_empty():
|
|
177
|
+
return
|
|
178
|
+
children = self.children
|
|
179
|
+
children_size = children.size()
|
|
180
|
+
@@ -80,4 +80,4 @@ class Node_Table(Node_Base):
|
|
181
|
+
"""
|
|
182
|
+
size = self.get_children().size()
|
|
183
|
+
return f'{self.get_type_name()} {size[0]}⨯{size[1]}'
|
|
184
|
+
-
|
|
185
|
+
|
|
186
|
+
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
4
4
|
|
|
5
5
|
""" Sets the default configuration values for the memory graph. """
|
|
6
|
-
from memory_graph.
|
|
6
|
+
from memory_graph.node_leaf import Node_Leaf
|
|
7
7
|
from memory_graph.node_linear import Node_Linear
|
|
8
8
|
from memory_graph.node_key_value import Node_Key_Value
|
|
9
9
|
from memory_graph.node_table import Node_Table
|
|
@@ -37,14 +37,14 @@ config.not_node_types = {
|
|
|
37
37
|
""" Types that will not have references pointing to their children in the graph but instead will have their children visualized in their node. """
|
|
38
38
|
config.no_child_references_types = {dict, types.MappingProxyType}
|
|
39
39
|
|
|
40
|
-
""" Conversion from type to
|
|
40
|
+
""" Conversion from type to Node objects. """
|
|
41
41
|
config.type_to_node = {
|
|
42
|
-
str: lambda data:
|
|
42
|
+
str: lambda data: Node_Leaf(data, data), # visit as whole string, don't iterate over characters
|
|
43
43
|
call_stack: lambda data: Node_Key_Value(data, data.items()),
|
|
44
|
-
types.FunctionType: lambda data:
|
|
45
|
-
types.MethodType: lambda data:
|
|
46
|
-
classmethod: lambda data:
|
|
47
|
-
staticmethod: lambda data:
|
|
44
|
+
types.FunctionType: lambda data: Node_Leaf(data, data.__qualname__),
|
|
45
|
+
types.MethodType: lambda data: Node_Leaf(data, data.__qualname__),
|
|
46
|
+
classmethod: lambda data: Node_Leaf(data, data.__qualname__),
|
|
47
|
+
staticmethod: lambda data: Node_Leaf(data, data.__qualname__),
|
|
48
48
|
range: lambda data: Node_Key_Value(data, {'start':data.start, 'stop':data.stop, 'step':data.step}.items()),
|
|
49
49
|
dict: lambda data: (
|
|
50
50
|
Node_Key_Value(data, utils.filter_dict(data.items()) )
|
|
@@ -79,7 +79,7 @@ config.type_to_color = {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
""" Types that will be visualized in vertical orientation if 'True', or horizontal orientation
|
|
82
|
-
if 'False'. Otherwise the
|
|
82
|
+
if 'False'. Otherwise the Node decides based on it having references."""
|
|
83
83
|
config.type_to_vertical_orientation = {
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2023, Bas Terwijn.
|
|
3
3
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
4
4
|
|
|
5
|
-
from memory_graph.
|
|
5
|
+
from memory_graph.node_leaf import Node_Leaf
|
|
6
6
|
from memory_graph.node_linear import Node_Linear
|
|
7
7
|
from memory_graph.node_key_value import Node_Key_Value
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ def read_nodes(data):
|
|
|
21
21
|
elif utils.is_finite_iterable(data): # for lists, tuples, sets, ...
|
|
22
22
|
return Node_Linear(data, data)
|
|
23
23
|
else:
|
|
24
|
-
return
|
|
24
|
+
return Node_Leaf(data, data)
|
|
25
25
|
|
|
26
26
|
def memory_to_nodes_recursive(nodes, data, parent, parent_index):
|
|
27
27
|
data_type = type(data)
|
|
@@ -7,7 +7,9 @@ import memory_graph.config as config
|
|
|
7
7
|
import memory_graph.config_helpers as config_helpers
|
|
8
8
|
from memory_graph.sequence import Sequence1D
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
from abc import ABC, abstractmethod
|
|
11
|
+
|
|
12
|
+
class Node_Base(ABC):
|
|
11
13
|
"""
|
|
12
14
|
Node_Base represents a node in the memory graph. This base class has different subclasses for different types of nodes.
|
|
13
15
|
"""
|
|
@@ -99,10 +101,7 @@ class Node_Base:
|
|
|
99
101
|
from memory_graph.html_table import HTML_Table
|
|
100
102
|
import memory_graph.node_base
|
|
101
103
|
html_table = HTML_Table()
|
|
102
|
-
|
|
103
|
-
html_table.add_string(f'{self.data}')
|
|
104
|
-
elif not slices is None:
|
|
105
|
-
self.fill_html_table(nodes, html_table, slices, id_to_slices)
|
|
104
|
+
self.fill_html_table(nodes, html_table, slices, id_to_slices)
|
|
106
105
|
return html_table
|
|
107
106
|
|
|
108
107
|
def get_slicer(self):
|
|
@@ -123,6 +122,7 @@ class Node_Base:
|
|
|
123
122
|
|
|
124
123
|
# -------------------- Node_Base interface, overriden by subclasses --------------------
|
|
125
124
|
|
|
125
|
+
@abstractmethod
|
|
126
126
|
def fill_html_table(self, html_table, slices, id_to_slices):
|
|
127
127
|
"""
|
|
128
128
|
Fill the HTML_Table object with each child of the node.
|
|
@@ -133,4 +133,4 @@ class Node_Base:
|
|
|
133
133
|
"""
|
|
134
134
|
Return a label for the node to be shown in the graph next to the HTML table.
|
|
135
135
|
"""
|
|
136
|
-
return self.get_type_name()
|
|
136
|
+
return self.get_type_name()
|
|
@@ -54,6 +54,8 @@ class Node_Key_Value(Node_Base):
|
|
|
54
54
|
"""
|
|
55
55
|
Fill the html_table with the children of the Node_Base.
|
|
56
56
|
"""
|
|
57
|
+
if slices is None:
|
|
58
|
+
return
|
|
57
59
|
vertical = self.is_vertical(nodes, slices, id_to_slices)
|
|
58
60
|
if vertical:
|
|
59
61
|
self.fill_html_table_vertical(html_table, nodes, slices, id_to_slices)
|
|
@@ -119,4 +121,4 @@ class Node_Key_Value(Node_Base):
|
|
|
119
121
|
if len(s) == 1:
|
|
120
122
|
if s[0][1] - s[0][0] == size:
|
|
121
123
|
return f'{type_name}'
|
|
122
|
-
return f'{type_name} {size}'
|
|
124
|
+
return f'{type_name} {size}'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file is part of memory_graph.
|
|
2
|
+
# Copyright (c) 2023, Bas Terwijn.
|
|
3
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
4
|
+
|
|
5
|
+
from memory_graph.node_base import Node_Base
|
|
6
|
+
|
|
7
|
+
class Node_Leaf(Node_Base):
|
|
8
|
+
"""
|
|
9
|
+
Node_Leaf (subclass of Node_Base) is a leaf node with no children but a value.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, data, value):
|
|
13
|
+
"""
|
|
14
|
+
Create a Node_Leaf object.
|
|
15
|
+
"""
|
|
16
|
+
super().__init__(data)
|
|
17
|
+
self.value = value
|
|
18
|
+
|
|
19
|
+
def fill_html_table(self, nodes, html_table, slices, id_to_slices):
|
|
20
|
+
"""
|
|
21
|
+
Fill the html_table with the children of the Node_Base.
|
|
22
|
+
"""
|
|
23
|
+
html_table.add_value(self.value)
|
|
@@ -45,6 +45,8 @@ class Node_Linear(Node_Base):
|
|
|
45
45
|
"""
|
|
46
46
|
Fill the html_table with the children of the Node_Base.
|
|
47
47
|
"""
|
|
48
|
+
if slices is None:
|
|
49
|
+
return
|
|
48
50
|
if self.is_vertical(nodes, slices, id_to_slices):
|
|
49
51
|
self.fill_html_table_vertical(html_table, nodes, slices, id_to_slices)
|
|
50
52
|
else:
|
|
@@ -95,4 +97,4 @@ class Node_Linear(Node_Base):
|
|
|
95
97
|
if s[0][1] - s[0][0] == size:
|
|
96
98
|
return f'{type_name}'
|
|
97
99
|
return f'{type_name} {size}'
|
|
98
|
-
|
|
100
|
+
|
|
@@ -35,7 +35,7 @@ class Node_Table(Node_Base):
|
|
|
35
35
|
"""
|
|
36
36
|
Fill the html_table with the children of the Node_Base.
|
|
37
37
|
"""
|
|
38
|
-
if slices.is_empty():
|
|
38
|
+
if slices is None or slices.is_empty():
|
|
39
39
|
return
|
|
40
40
|
children = self.children
|
|
41
41
|
children_size = children.size()
|
|
@@ -80,4 +80,4 @@ class Node_Table(Node_Base):
|
|
|
80
80
|
"""
|
|
81
81
|
size = self.get_children().size()
|
|
82
82
|
return f'{self.get_type_name()} {size[0]}⨯{size[1]}'
|
|
83
|
-
|
|
83
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.19
|
|
4
4
|
Summary: Generate intuitive graphs of your Python data, great for debugging and understanding complex relationships.
|
|
5
5
|
Home-page: https://github.com/bterwijn/memory_graph
|
|
6
6
|
Author: Bas Terwijn
|
|
@@ -664,8 +664,8 @@ mg.show(locals())
|
|
|
664
664
|
|
|
665
665
|
Next figure out what are the attributes you want to graph and choose a Node type, there are four options:
|
|
666
666
|
|
|
667
|
-
### 1)
|
|
668
|
-
|
|
667
|
+
### 1) Node_Leaf ###
|
|
668
|
+
Node_Leaf is a leaf node (with no children) and shows just a single value.
|
|
669
669
|
```python
|
|
670
670
|
import memory_graph as mg
|
|
671
671
|
import bintrees
|
|
@@ -678,11 +678,12 @@ tree.insert(20, "twenty")
|
|
|
678
678
|
tree.insert(15, "fifteen")
|
|
679
679
|
|
|
680
680
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
681
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
681
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_leaf.Node_Leaf(data,
|
|
682
|
+
f"key:{data.key} value:{data.value}")
|
|
682
683
|
|
|
683
684
|
mg.show(locals())
|
|
684
685
|
```
|
|
685
|
-

|
|
686
687
|
|
|
687
688
|
### 2) Node_Linear ###
|
|
688
689
|
Node_Linear shows all the values in a line like a list.
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
LICENSE.txt
|
|
2
2
|
MANIFEST.in
|
|
3
3
|
README.md
|
|
4
|
-
TODO.txt
|
|
5
4
|
install.txt
|
|
6
5
|
setup.py
|
|
7
6
|
images/add_one.png
|
|
8
7
|
images/add_one.py
|
|
9
8
|
images/avltree.py
|
|
10
9
|
images/avltree.py~
|
|
11
|
-
images/avltree_base.png
|
|
12
10
|
images/avltree_dir.png
|
|
13
11
|
images/avltree_fail.gv
|
|
14
12
|
images/avltree_fail.png
|
|
15
13
|
images/avltree_key_value.png
|
|
14
|
+
images/avltree_leaf.png
|
|
16
15
|
images/avltree_linear.png
|
|
17
16
|
images/avltree_table.png
|
|
18
17
|
images/bin_tree.png
|
|
@@ -58,6 +57,7 @@ images/ipython.png
|
|
|
58
57
|
images/jupyter_example.png
|
|
59
58
|
images/linked_list.png
|
|
60
59
|
images/linked_list.py
|
|
60
|
+
images/log.txt
|
|
61
61
|
images/many_types.png
|
|
62
62
|
images/many_types.py
|
|
63
63
|
images/memory_graph.gv.pdf
|
|
@@ -113,6 +113,7 @@ memory_graph/list_view.py
|
|
|
113
113
|
memory_graph/memory_to_nodes.py
|
|
114
114
|
memory_graph/node_base.py
|
|
115
115
|
memory_graph/node_key_value.py
|
|
116
|
+
memory_graph/node_leaf.py
|
|
116
117
|
memory_graph/node_linear.py
|
|
117
118
|
memory_graph/node_table.py
|
|
118
119
|
memory_graph/sequence.py
|
|
@@ -11,7 +11,7 @@ long_description_from_readme = (this_directory / "README.md").read_text()
|
|
|
11
11
|
|
|
12
12
|
setup(
|
|
13
13
|
name = 'memory_graph',
|
|
14
|
-
version = '0.3.
|
|
14
|
+
version = '0.3.19',
|
|
15
15
|
description = 'Generate intuitive graphs of your Python data, great for debugging and understanding complex relationships.',
|
|
16
16
|
long_description = long_description_from_readme,
|
|
17
17
|
long_description_content_type = 'text/markdown',
|
memory_graph-0.3.18/TODO.txt
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
mg.block(fun, print_loc=True), update docs, stack-overflow posts
|
|
3
|
-
|
|
4
|
-
Jupyter Notebook inline render using display()
|
|
5
|
-
|
|
6
|
-
webassembly inline render
|
|
7
|
-
|
|
8
|
-
optional max introspect depth for each type/id
|
|
9
|
-
https://discuss.python.org/t/request-for-feedback-memory-graph-a-python-visualization-tool-for-education/78347
|
|
Binary file
|
|
Binary file
|
|
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
|
|
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
|
|
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
|
|
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
|