memory-graph 0.3.58__tar.gz → 0.3.59__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.
Files changed (115) hide show
  1. {memory_graph-0.3.58/memory_graph.egg-info → memory_graph-0.3.59}/PKG-INFO +6 -3
  2. {memory_graph-0.3.58 → memory_graph-0.3.59}/README.md +5 -2
  3. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/__init__.py +1 -1
  4. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/config.py +2 -0
  5. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/config_default.py +4 -1
  6. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/memory_to_nodes.py +10 -6
  7. {memory_graph-0.3.58 → memory_graph-0.3.59/memory_graph.egg-info}/PKG-INFO +6 -3
  8. {memory_graph-0.3.58 → memory_graph-0.3.59}/pyproject.toml +1 -1
  9. {memory_graph-0.3.58 → memory_graph-0.3.59}/LICENSE.txt +0 -0
  10. {memory_graph-0.3.58 → memory_graph-0.3.59}/MANIFEST.in +0 -0
  11. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/add_one.png +0 -0
  12. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/add_one.py +0 -0
  13. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree.py +0 -0
  14. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree_dir.png +0 -0
  15. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree_fail.png +0 -0
  16. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree_key_value.png +0 -0
  17. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree_leaf.png +0 -0
  18. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree_linear.png +0 -0
  19. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/avltree_table.png +0 -0
  20. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/bin_search.png +0 -0
  21. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/bin_search.py +0 -0
  22. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/bin_search_linear.png +0 -0
  23. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/bin_tree.gif +0 -0
  24. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/bin_tree.png +0 -0
  25. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/bin_tree.py +0 -0
  26. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/binary.gif +0 -0
  27. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/binary.py +0 -0
  28. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/colab_example.png +0 -0
  29. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_immutable.png +0 -0
  30. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_immutable.py +0 -0
  31. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_method.png +0 -0
  32. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_method.py +0 -0
  33. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_mix.png +0 -0
  34. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_mix.py +0 -0
  35. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_mutable.png +0 -0
  36. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/copy_mutable.py +0 -0
  37. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/create_gif.sh +0 -0
  38. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/create_images.sh +0 -0
  39. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/debug_vscode.png +0 -0
  40. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/debugging.gif +0 -0
  41. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/debugging.py +0 -0
  42. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/embedded1.png +0 -0
  43. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/embedded2.png +0 -0
  44. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/extension_numpy.png +0 -0
  45. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/extension_numpy.py +0 -0
  46. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/extension_pandas.png +0 -0
  47. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/extension_pandas.py +0 -0
  48. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/extension_torch.png +0 -0
  49. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/extension_torch.py +0 -0
  50. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/factorial.gif +0 -0
  51. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/factorial.py +0 -0
  52. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/hash_set.gif +0 -0
  53. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/hash_set.png +0 -0
  54. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/hash_set.py +0 -0
  55. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/hidden_edges.png +0 -0
  56. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/hidden_edges.py +0 -0
  57. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/immutable.py +0 -0
  58. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/immutable1.png +0 -0
  59. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/immutable2.png +0 -0
  60. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/introspect_depth.png +0 -0
  61. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/introspect_depth.py +0 -0
  62. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/ipython.png +0 -0
  63. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/jupyter_example.png +0 -0
  64. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/linked_list.gif +0 -0
  65. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/linked_list.png +0 -0
  66. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/linked_list.py +0 -0
  67. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/many_types.png +0 -0
  68. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/many_types.py +0 -0
  69. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/marimo_example.png +0 -0
  70. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/memory_graph_web_debugger.png +0 -0
  71. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/mutable.py +0 -0
  72. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/mutable1.png +0 -0
  73. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/mutable2.png +0 -0
  74. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/name_rebinding.py +0 -0
  75. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/not_node_types.py +0 -0
  76. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/power_set.gif +0 -0
  77. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/power_set.py +0 -0
  78. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/rebinding1.png +0 -0
  79. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/rebinding2.png +0 -0
  80. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/uva.png +0 -0
  81. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/vscode_copying.gif +0 -0
  82. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/wrap_int.png +0 -0
  83. {memory_graph-0.3.58 → memory_graph-0.3.59}/images/wrap_int.py +0 -0
  84. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/call_stack.py +0 -0
  85. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/config_helpers.py +0 -0
  86. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/extension_numpy.py +0 -0
  87. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/extension_pandas.py +0 -0
  88. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/extension_torch.py +0 -0
  89. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/html_table.py +0 -0
  90. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/list_view.py +0 -0
  91. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/node_base.py +0 -0
  92. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/node_key_value.py +0 -0
  93. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/node_leaf.py +0 -0
  94. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/node_linear.py +0 -0
  95. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/node_table.py +0 -0
  96. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/sequence.py +0 -0
  97. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/slicer.py +0 -0
  98. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/slices.py +0 -0
  99. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/slices_iterator.py +0 -0
  100. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/slices_table_iterator.py +0 -0
  101. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test.py +0 -0
  102. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_max_graph_depth.py +0 -0
  103. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_memory_graph.py +0 -0
  104. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_memory_to_nodes.py +0 -0
  105. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_sequence.py +0 -0
  106. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_slicer.py +0 -0
  107. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_slices.py +0 -0
  108. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/test_slices_iterator.py +0 -0
  109. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph/utils.py +0 -0
  110. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph.egg-info/SOURCES.txt +0 -0
  111. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph.egg-info/dependency_links.txt +0 -0
  112. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph.egg-info/requires.txt +0 -0
  113. {memory_graph-0.3.58 → memory_graph-0.3.59}/memory_graph.egg-info/top_level.txt +0 -0
  114. {memory_graph-0.3.58 → memory_graph-0.3.59}/setup.cfg +0 -0
  115. {memory_graph-0.3.58 → memory_graph-0.3.59}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memory_graph
3
- Version: 0.3.58
3
+ Version: 0.3.59
4
4
  Summary: Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.
5
5
  Author-email: Bas Terwijn <bterwijn@gmail.com>
6
6
  License-Expression: BSD-2-Clause
@@ -169,7 +169,7 @@ Learn the right **mental model** to think about Python data. The [Python Data Mo
169
169
 
170
170
 
171
171
  ## Immutable Type ##
172
- In the code below variable `a` and `b` both reference the same tuple value (4, 3, 2). A tuple is an immutable type and therefore when we change variable `b` its value **cannot** be mutated in place, and thus an automatic copy is made and `a` and `b` reference their own value afterwards.
172
+ In the code below variable `a` and `b` both reference the same tuple value (4, 3, 2). A tuple is an immutable type and therefore when we change variable `b` its value **cannot** be mutated in place, and thus an automatic copy is made and `a` and `b` each reference their own value afterwards.
173
173
 
174
174
  ```python
175
175
  import memory_graph as mg
@@ -203,7 +203,7 @@ mg.render(locals(), 'mutable2.png')
203
203
  |:-----------------------------------------------------------:|:-------------------------------------------------------------:|
204
204
  | mutable1.png | mutable2.png |
205
205
 
206
- One practical reason why Python makes the distinction between mutable and immutable types is that a value of a mutable type can be large, making it inefficient to copy each time we change it. Immutable values generally don't need to change as much, or are small making copying less of a concern.
206
+ One practical reason why Python makes the distinction between mutable and immutable types is that a value of a mutable type can be large, making it inefficient to copy each time we change it. Values of immutable type generally don't need to change as much, or are small, making copying less of a concern.
207
207
 
208
208
  ## Copying Values of Mutable Type ##
209
209
  Python offers three different "copy" options that we will demonstrate using a nested list:
@@ -666,6 +666,9 @@ Different aspects of memory_graph can be configured. The default configuration c
666
666
  - ***mg.config.render_filename*** : str
667
667
  - The default filename to render to, default 'memory_graph.pdf'.
668
668
 
669
+ - ***mg.config.type_labels*** : bool
670
+ - If True the type of each node is shown as label, default True.
671
+
669
672
  - ***mg.config.block_prints_location*** : bool
670
673
  - If True the source location is printed in block(), default True.
671
674
 
@@ -149,7 +149,7 @@ Learn the right **mental model** to think about Python data. The [Python Data Mo
149
149
 
150
150
 
151
151
  ## Immutable Type ##
152
- In the code below variable `a` and `b` both reference the same tuple value (4, 3, 2). A tuple is an immutable type and therefore when we change variable `b` its value **cannot** be mutated in place, and thus an automatic copy is made and `a` and `b` reference their own value afterwards.
152
+ In the code below variable `a` and `b` both reference the same tuple value (4, 3, 2). A tuple is an immutable type and therefore when we change variable `b` its value **cannot** be mutated in place, and thus an automatic copy is made and `a` and `b` each reference their own value afterwards.
153
153
 
154
154
  ```python
155
155
  import memory_graph as mg
@@ -183,7 +183,7 @@ mg.render(locals(), 'mutable2.png')
183
183
  |:-----------------------------------------------------------:|:-------------------------------------------------------------:|
184
184
  | mutable1.png | mutable2.png |
185
185
 
186
- One practical reason why Python makes the distinction between mutable and immutable types is that a value of a mutable type can be large, making it inefficient to copy each time we change it. Immutable values generally don't need to change as much, or are small making copying less of a concern.
186
+ One practical reason why Python makes the distinction between mutable and immutable types is that a value of a mutable type can be large, making it inefficient to copy each time we change it. Values of immutable type generally don't need to change as much, or are small, making copying less of a concern.
187
187
 
188
188
  ## Copying Values of Mutable Type ##
189
189
  Python offers three different "copy" options that we will demonstrate using a nested list:
@@ -646,6 +646,9 @@ Different aspects of memory_graph can be configured. The default configuration c
646
646
  - ***mg.config.render_filename*** : str
647
647
  - The default filename to render to, default 'memory_graph.pdf'.
648
648
 
649
+ - ***mg.config.type_labels*** : bool
650
+ - If True the type of each node is shown as label, default True.
651
+
649
652
  - ***mg.config.block_prints_location*** : bool
650
653
  - If True the source location is printed in block(), default True.
651
654
 
@@ -2,7 +2,7 @@
2
2
  # Copyright (c) 2023, Bas Terwijn.
3
3
  # SPDX-License-Identifier: BSD-2-Clause
4
4
 
5
- __version__ = "0.3.58"
5
+ __version__ = "0.3.59"
6
6
  __author__ = 'Bas Terwijn'
7
7
 
8
8
  import memory_graph.memory_to_nodes as memory_to_nodes
@@ -7,6 +7,8 @@
7
7
  reopen_viewer = None
8
8
  render_filename = None
9
9
 
10
+ type_lables = None
11
+
10
12
  block_prints_location = None
11
13
  press_enter_message = None
12
14
 
@@ -23,7 +23,10 @@ def reset():
23
23
 
24
24
  """ The default filename to render to. """
25
25
  config.render_filename = 'memory_graph.pdf'
26
-
26
+
27
+ """ Show the type of each node as label. """
28
+ config.type_labels = True
29
+
27
30
  """ Determines if the filename, line number and functions name is printed on mg.block(). """
28
31
  config.block_prints_location = True
29
32
 
@@ -210,16 +210,20 @@ def build_graph(graphviz_graph, nodes, root_id, id_to_slices):
210
210
  if len(new_node_names) > 1:
211
211
  graphviz_graph.body.append('subgraph { rank=same; '+ ' -> '.join(new_node_names) + '[weight='+str(config.graph_stability)+', style=invis]; }\n')
212
212
 
213
- def add_to_graphviz_graph(graphviz_graph, nodes, node, slices, id_to_slices, subgraphed_nodes, depth):
213
+ def add_to_graphviz_graph(graphviz_graph, nodes, node, slices, id_to_slices):
214
214
  """ Adds 'node' to 'graphviz_graph' with its children and edges. """
215
215
  html_table = node.get_html_table(nodes, slices, id_to_slices)
216
216
  edges = html_table.get_edges()
217
217
  color = config_helpers.get_color(node)
218
218
  border = 3 if node.is_root() else 1
219
- graphviz_graph.node(node.get_name(),
220
- html_table.to_string(border, color),
221
- xlabel=node.get_label(slices))
222
- # ------------ edges
219
+ if config.type_labels:
220
+ graphviz_graph.node(node.get_name(),
221
+ html_table.to_string(border, color),
222
+ xlabel=node.get_label(slices))
223
+ else:
224
+ graphviz_graph.node(node.get_name(),
225
+ html_table.to_string(border, color))
226
+ # ------------ edges
223
227
  for parent,child,dashed in edges:
224
228
  graphviz_graph.edge(parent, child+':table', style='dashed' if dashed else 'solid')
225
229
 
@@ -239,7 +243,7 @@ def build_graph(graphviz_graph, nodes, root_id, id_to_slices):
239
243
  child_id = id(children[index])
240
244
  build_graph_depth_first(graphviz_graph, nodes, child_id, id_to_slices, nodes_at_depth, subgraphed_nodes, depth+1)
241
245
  if not node.is_hidden_node():
242
- add_to_graphviz_graph(graphviz_graph, nodes, node, slices, id_to_slices, subgraphed_nodes, depth)
246
+ add_to_graphviz_graph(graphviz_graph, nodes, node, slices, id_to_slices)
243
247
 
244
248
  nodes_at_depth = {}
245
249
  build_graph_depth_first(graphviz_graph, nodes, root_id, id_to_slices, nodes_at_depth, set(), 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memory_graph
3
- Version: 0.3.58
3
+ Version: 0.3.59
4
4
  Summary: Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.
5
5
  Author-email: Bas Terwijn <bterwijn@gmail.com>
6
6
  License-Expression: BSD-2-Clause
@@ -169,7 +169,7 @@ Learn the right **mental model** to think about Python data. The [Python Data Mo
169
169
 
170
170
 
171
171
  ## Immutable Type ##
172
- In the code below variable `a` and `b` both reference the same tuple value (4, 3, 2). A tuple is an immutable type and therefore when we change variable `b` its value **cannot** be mutated in place, and thus an automatic copy is made and `a` and `b` reference their own value afterwards.
172
+ In the code below variable `a` and `b` both reference the same tuple value (4, 3, 2). A tuple is an immutable type and therefore when we change variable `b` its value **cannot** be mutated in place, and thus an automatic copy is made and `a` and `b` each reference their own value afterwards.
173
173
 
174
174
  ```python
175
175
  import memory_graph as mg
@@ -203,7 +203,7 @@ mg.render(locals(), 'mutable2.png')
203
203
  |:-----------------------------------------------------------:|:-------------------------------------------------------------:|
204
204
  | mutable1.png | mutable2.png |
205
205
 
206
- One practical reason why Python makes the distinction between mutable and immutable types is that a value of a mutable type can be large, making it inefficient to copy each time we change it. Immutable values generally don't need to change as much, or are small making copying less of a concern.
206
+ One practical reason why Python makes the distinction between mutable and immutable types is that a value of a mutable type can be large, making it inefficient to copy each time we change it. Values of immutable type generally don't need to change as much, or are small, making copying less of a concern.
207
207
 
208
208
  ## Copying Values of Mutable Type ##
209
209
  Python offers three different "copy" options that we will demonstrate using a nested list:
@@ -666,6 +666,9 @@ Different aspects of memory_graph can be configured. The default configuration c
666
666
  - ***mg.config.render_filename*** : str
667
667
  - The default filename to render to, default 'memory_graph.pdf'.
668
668
 
669
+ - ***mg.config.type_labels*** : bool
670
+ - If True the type of each node is shown as label, default True.
671
+
669
672
  - ***mg.config.block_prints_location*** : bool
670
673
  - If True the source location is printed in block(), default True.
671
674
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "memory_graph"
7
- version = "0.3.58"
7
+ version = "0.3.59"
8
8
  description = "Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy."
9
9
  authors = [
10
10
  {name = "Bas Terwijn", email = "bterwijn@gmail.com"}
File without changes
File without changes
File without changes
File without changes