memory-graph 0.3.55__tar.gz → 0.3.56__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 (146) hide show
  1. {memory_graph-0.3.55/memory_graph.egg-info → memory_graph-0.3.56}/PKG-INFO +26 -2
  2. {memory_graph-0.3.55 → memory_graph-0.3.56}/README.md +25 -1
  3. memory_graph-0.3.56/images/add_one.png +0 -0
  4. memory_graph-0.3.56/images/avltree_key_value.png +0 -0
  5. memory_graph-0.3.56/images/avltree_leaf.png +0 -0
  6. memory_graph-0.3.56/images/avltree_linear.png +0 -0
  7. memory_graph-0.3.56/images/avltree_table.png +0 -0
  8. memory_graph-0.3.56/images/bin_search.png +0 -0
  9. memory_graph-0.3.56/images/bin_search_linear.png +0 -0
  10. memory_graph-0.3.56/images/bin_tree.png +0 -0
  11. memory_graph-0.3.56/images/binary.gif +0 -0
  12. memory_graph-0.3.56/images/copy_immutable.png +0 -0
  13. memory_graph-0.3.56/images/copy_method.png +0 -0
  14. memory_graph-0.3.56/images/copy_mix.png +0 -0
  15. memory_graph-0.3.56/images/copy_mutable.png +0 -0
  16. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/create_images.sh +1 -0
  17. memory_graph-0.3.56/images/debugging.gif +0 -0
  18. memory_graph-0.3.56/images/embedded1.png +0 -0
  19. memory_graph-0.3.56/images/embedded2.png +0 -0
  20. memory_graph-0.3.56/images/extension_numpy.png +0 -0
  21. memory_graph-0.3.56/images/extension_pandas.png +0 -0
  22. memory_graph-0.3.56/images/factorial.gif +0 -0
  23. memory_graph-0.3.56/images/hash_set.png +0 -0
  24. memory_graph-0.3.56/images/hidden_edges.png +0 -0
  25. memory_graph-0.3.56/images/immutable1.png +0 -0
  26. memory_graph-0.3.56/images/immutable2.png +0 -0
  27. memory_graph-0.3.56/images/introspect_depth.png +0 -0
  28. memory_graph-0.3.56/images/linked_list.png +0 -0
  29. memory_graph-0.3.56/images/many_types.png +0 -0
  30. memory_graph-0.3.56/images/mutable1.png +0 -0
  31. memory_graph-0.3.56/images/mutable2.png +0 -0
  32. memory_graph-0.3.56/images/power_set.gif +0 -0
  33. memory_graph-0.3.56/images/rebinding1.png +0 -0
  34. memory_graph-0.3.56/images/rebinding2.png +0 -0
  35. memory_graph-0.3.56/images/wrap_int.png +0 -0
  36. memory_graph-0.3.56/images/wrap_int.py +16 -0
  37. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/__init__.py +1 -1
  38. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/memory_to_nodes.py +3 -3
  39. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/utils.py +1 -1
  40. {memory_graph-0.3.55 → memory_graph-0.3.56/memory_graph.egg-info}/PKG-INFO +26 -2
  41. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph.egg-info/SOURCES.txt +2 -0
  42. {memory_graph-0.3.55 → memory_graph-0.3.56}/pyproject.toml +1 -1
  43. memory_graph-0.3.55/images/add_one.png +0 -0
  44. memory_graph-0.3.55/images/avltree_key_value.png +0 -0
  45. memory_graph-0.3.55/images/avltree_leaf.png +0 -0
  46. memory_graph-0.3.55/images/avltree_linear.png +0 -0
  47. memory_graph-0.3.55/images/avltree_table.png +0 -0
  48. memory_graph-0.3.55/images/bin_search.png +0 -0
  49. memory_graph-0.3.55/images/bin_search_linear.png +0 -0
  50. memory_graph-0.3.55/images/bin_tree.png +0 -0
  51. memory_graph-0.3.55/images/binary.gif +0 -0
  52. memory_graph-0.3.55/images/copy_immutable.png +0 -0
  53. memory_graph-0.3.55/images/copy_method.png +0 -0
  54. memory_graph-0.3.55/images/copy_mix.png +0 -0
  55. memory_graph-0.3.55/images/copy_mutable.png +0 -0
  56. memory_graph-0.3.55/images/debugging.gif +0 -0
  57. memory_graph-0.3.55/images/embedded1.png +0 -0
  58. memory_graph-0.3.55/images/embedded2.png +0 -0
  59. memory_graph-0.3.55/images/extension_numpy.png +0 -0
  60. memory_graph-0.3.55/images/extension_pandas.png +0 -0
  61. memory_graph-0.3.55/images/factorial.gif +0 -0
  62. memory_graph-0.3.55/images/hash_set.png +0 -0
  63. memory_graph-0.3.55/images/hidden_edges.png +0 -0
  64. memory_graph-0.3.55/images/immutable1.png +0 -0
  65. memory_graph-0.3.55/images/immutable2.png +0 -0
  66. memory_graph-0.3.55/images/introspect_depth.png +0 -0
  67. memory_graph-0.3.55/images/linked_list.png +0 -0
  68. memory_graph-0.3.55/images/many_types.png +0 -0
  69. memory_graph-0.3.55/images/mutable1.png +0 -0
  70. memory_graph-0.3.55/images/mutable2.png +0 -0
  71. memory_graph-0.3.55/images/power_set.gif +0 -0
  72. memory_graph-0.3.55/images/rebinding1.png +0 -0
  73. memory_graph-0.3.55/images/rebinding2.png +0 -0
  74. {memory_graph-0.3.55 → memory_graph-0.3.56}/LICENSE.txt +0 -0
  75. {memory_graph-0.3.55 → memory_graph-0.3.56}/MANIFEST.in +0 -0
  76. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/add_one.py +0 -0
  77. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/avltree.py +0 -0
  78. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/avltree_dir.png +0 -0
  79. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/avltree_fail.png +0 -0
  80. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/bin_search.py +0 -0
  81. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/bin_tree.gif +0 -0
  82. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/bin_tree.py +0 -0
  83. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/binary.py +0 -0
  84. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/colab_example.png +0 -0
  85. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/copy_immutable.py +0 -0
  86. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/copy_method.py +0 -0
  87. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/copy_mix.py +0 -0
  88. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/copy_mutable.py +0 -0
  89. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/create_gif.sh +0 -0
  90. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/debug_vscode.png +0 -0
  91. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/debugging.py +0 -0
  92. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/extension_numpy.py +0 -0
  93. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/extension_pandas.py +0 -0
  94. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/extension_torch.png +0 -0
  95. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/extension_torch.py +0 -0
  96. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/factorial.py +0 -0
  97. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/hash_set.gif +0 -0
  98. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/hash_set.py +0 -0
  99. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/hidden_edges.py +0 -0
  100. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/immutable.py +0 -0
  101. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/introspect_depth.py +0 -0
  102. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/ipython.png +0 -0
  103. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/jupyter_example.png +0 -0
  104. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/linked_list.gif +0 -0
  105. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/linked_list.py +0 -0
  106. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/many_types.py +0 -0
  107. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/marimo_example.png +0 -0
  108. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/memory_graph_web_debugger.png +0 -0
  109. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/mutable.py +0 -0
  110. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/name_rebinding.py +0 -0
  111. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/not_node_types.py +0 -0
  112. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/power_set.py +0 -0
  113. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/uva.png +0 -0
  114. {memory_graph-0.3.55 → memory_graph-0.3.56}/images/vscode_copying.gif +0 -0
  115. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/call_stack.py +0 -0
  116. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/config.py +0 -0
  117. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/config_default.py +0 -0
  118. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/config_helpers.py +0 -0
  119. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/extension_numpy.py +0 -0
  120. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/extension_pandas.py +0 -0
  121. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/extension_torch.py +0 -0
  122. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/html_table.py +0 -0
  123. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/list_view.py +0 -0
  124. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/node_base.py +0 -0
  125. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/node_key_value.py +0 -0
  126. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/node_leaf.py +0 -0
  127. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/node_linear.py +0 -0
  128. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/node_table.py +0 -0
  129. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/sequence.py +0 -0
  130. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/slicer.py +0 -0
  131. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/slices.py +0 -0
  132. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/slices_iterator.py +0 -0
  133. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/slices_table_iterator.py +0 -0
  134. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test.py +0 -0
  135. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_max_graph_depth.py +0 -0
  136. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_memory_graph.py +0 -0
  137. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_memory_to_nodes.py +0 -0
  138. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_sequence.py +0 -0
  139. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_slicer.py +0 -0
  140. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_slices.py +0 -0
  141. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph/test_slices_iterator.py +0 -0
  142. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph.egg-info/dependency_links.txt +0 -0
  143. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph.egg-info/requires.txt +0 -0
  144. {memory_graph-0.3.55 → memory_graph-0.3.56}/memory_graph.egg-info/top_level.txt +0 -0
  145. {memory_graph-0.3.55 → memory_graph-0.3.56}/setup.cfg +0 -0
  146. {memory_graph-0.3.55 → memory_graph-0.3.56}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memory_graph
3
- Version: 0.3.55
3
+ Version: 0.3.56
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: BSD 2-Clause License
@@ -362,9 +362,33 @@ In the printed output only `a` is changed as a result of the function call:
362
362
  ```
363
363
  a:[4, 3, 2, 1] b:(4, 3, 2) c:[4, 3, 2]
364
364
  ```
365
-
366
365
  This is because `b` is of immutable type 'tuple' so its value gets copied automatically when it is changed. And because the function is called with a copy of `c`, its original value is not changed by the function. The value of variable `a` is the only value of mutable type that is shared between the root stack frame **'0: \<module>'** and the **'1: add_one'** stack frame of the function so only that variable is affected as a result of the function call. The other changes remain confined to the local variables of the ```add_one()``` function.
367
366
 
367
+ ## Function Call That Changes 'int' Value ##
368
+ Even though `int` is an immutable type, so an `int` value can not be changed by directly passing it to a function, we can still change it by wrapping it in a mutable container.
369
+
370
+ ```python
371
+ import memory_graph as mg
372
+
373
+ def add_one(a, b):
374
+ a += 1 # change remains confined to 'a' in the add_one function
375
+ b[0] += 1 # change also effects 'b' outside of the add_one function
376
+ mg.show(mg.stack())
377
+
378
+ a = 10
379
+ b = [10] # wrap in a value of mutable type list
380
+ add_one(a, b)
381
+
382
+ print(f"a:{a} b:{b[0]}")
383
+ ```
384
+ ![wap_int.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/wrap_int.png)
385
+ ```
386
+ a:10 b:11
387
+ ```
388
+ Calling `add_one()` does not effect the `int` value of `a` but does effect the `int` value of `b` because it's wrapped in a mutable container.
389
+
390
+ ## Exercises ##
391
+
368
392
  Now is a good time to practice the Python Data Model. Here are [some exercises](https://github.com/bterwijn/memory_graph_videos/blob/main/exercises/exercises.md) on references, mutability, copies, and function calls.
369
393
 
370
394
  ## Block ##
@@ -317,9 +317,33 @@ In the printed output only `a` is changed as a result of the function call:
317
317
  ```
318
318
  a:[4, 3, 2, 1] b:(4, 3, 2) c:[4, 3, 2]
319
319
  ```
320
-
321
320
  This is because `b` is of immutable type 'tuple' so its value gets copied automatically when it is changed. And because the function is called with a copy of `c`, its original value is not changed by the function. The value of variable `a` is the only value of mutable type that is shared between the root stack frame **'0: \<module>'** and the **'1: add_one'** stack frame of the function so only that variable is affected as a result of the function call. The other changes remain confined to the local variables of the ```add_one()``` function.
322
321
 
322
+ ## Function Call That Changes 'int' Value ##
323
+ Even though `int` is an immutable type, so an `int` value can not be changed by directly passing it to a function, we can still change it by wrapping it in a mutable container.
324
+
325
+ ```python
326
+ import memory_graph as mg
327
+
328
+ def add_one(a, b):
329
+ a += 1 # change remains confined to 'a' in the add_one function
330
+ b[0] += 1 # change also effects 'b' outside of the add_one function
331
+ mg.show(mg.stack())
332
+
333
+ a = 10
334
+ b = [10] # wrap in a value of mutable type list
335
+ add_one(a, b)
336
+
337
+ print(f"a:{a} b:{b[0]}")
338
+ ```
339
+ ![wap_int.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/wrap_int.png)
340
+ ```
341
+ a:10 b:11
342
+ ```
343
+ Calling `add_one()` does not effect the `int` value of `a` but does effect the `int` value of `b` because it's wrapped in a mutable container.
344
+
345
+ ## Exercises ##
346
+
323
347
  Now is a good time to practice the Python Data Model. Here are [some exercises](https://github.com/bterwijn/memory_graph_videos/blob/main/exercises/exercises.md) on references, mutability, copies, and function calls.
324
348
 
325
349
  ## Block ##
Binary file
Binary file
Binary file
Binary file
@@ -16,6 +16,7 @@ python name_rebinding.py
16
16
 
17
17
  # call stack
18
18
  python add_one.py
19
+ python wrap_int.py
19
20
  python factorial.py
20
21
  bash create_gif.sh factorial -d
21
22
  python binary.py
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
5
+ import memory_graph as mg
6
+
7
+ def add_one(a, b):
8
+ a += 1
9
+ b[0] += 1
10
+ mg.render( mg.stack(), "wrap_int.png")
11
+
12
+ a = 10
13
+ b = [10]
14
+
15
+ add_one(a, b)
16
+ print(f"a:{a} b:{b[0]}")
@@ -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.55"
5
+ __version__ = "0.3.56"
6
6
  __author__ = 'Bas Terwijn'
7
7
 
8
8
  import memory_graph.memory_to_nodes as memory_to_nodes
@@ -257,9 +257,9 @@ def memory_to_nodes(data):
257
257
  id_to_slices = add_missing_edges(nodes, id_to_slices, config.max_missing_edges)
258
258
  #print('id_to_slices:',id_to_slices)
259
259
  embed_keys_in_key_value_nodes(nodes, nodes_key_value, id_to_slices)
260
- graphviz_graph_attr = {}
261
- graphviz_node_attr = {'shape':'plaintext'}
262
- graphviz_edge_attr = {}
260
+ graphviz_graph_attr = {'fontname': 'Courier', 'fontsize': '14'}
261
+ graphviz_node_attr = {'fontname': 'Courier', 'fontsize': '14', 'shape': 'plaintext'}
262
+ graphviz_edge_attr = {'fontname': 'Courier', 'fontsize': '14'}
263
263
  graphviz_graph=graphviz.Digraph('memory_graph',
264
264
  graph_attr=graphviz_graph_attr,
265
265
  node_attr=graphviz_node_attr,
@@ -20,7 +20,7 @@ def is_function(obj):
20
20
 
21
21
  def filter_dict(dictionary):
22
22
  """ Filters out the unwanted dict attributes. """
23
- if '__name__' in dictionary: # only filter stack frames, for example locals()
23
+ if '__name__' in dictionary: # filter stack frames in global scope
24
24
  return [
25
25
  (k,v) for k, v in dictionary.items() if
26
26
  not (type(k) is str and k.startswith('__')) and
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memory_graph
3
- Version: 0.3.55
3
+ Version: 0.3.56
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: BSD 2-Clause License
@@ -362,9 +362,33 @@ In the printed output only `a` is changed as a result of the function call:
362
362
  ```
363
363
  a:[4, 3, 2, 1] b:(4, 3, 2) c:[4, 3, 2]
364
364
  ```
365
-
366
365
  This is because `b` is of immutable type 'tuple' so its value gets copied automatically when it is changed. And because the function is called with a copy of `c`, its original value is not changed by the function. The value of variable `a` is the only value of mutable type that is shared between the root stack frame **'0: \<module>'** and the **'1: add_one'** stack frame of the function so only that variable is affected as a result of the function call. The other changes remain confined to the local variables of the ```add_one()``` function.
367
366
 
367
+ ## Function Call That Changes 'int' Value ##
368
+ Even though `int` is an immutable type, so an `int` value can not be changed by directly passing it to a function, we can still change it by wrapping it in a mutable container.
369
+
370
+ ```python
371
+ import memory_graph as mg
372
+
373
+ def add_one(a, b):
374
+ a += 1 # change remains confined to 'a' in the add_one function
375
+ b[0] += 1 # change also effects 'b' outside of the add_one function
376
+ mg.show(mg.stack())
377
+
378
+ a = 10
379
+ b = [10] # wrap in a value of mutable type list
380
+ add_one(a, b)
381
+
382
+ print(f"a:{a} b:{b[0]}")
383
+ ```
384
+ ![wap_int.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/wrap_int.png)
385
+ ```
386
+ a:10 b:11
387
+ ```
388
+ Calling `add_one()` does not effect the `int` value of `a` but does effect the `int` value of `b` because it's wrapped in a mutable container.
389
+
390
+ ## Exercises ##
391
+
368
392
  Now is a good time to practice the Python Data Model. Here are [some exercises](https://github.com/bterwijn/memory_graph_videos/blob/main/exercises/exercises.md) on references, mutability, copies, and function calls.
369
393
 
370
394
  ## Block ##
@@ -74,6 +74,8 @@ images/rebinding1.png
74
74
  images/rebinding2.png
75
75
  images/uva.png
76
76
  images/vscode_copying.gif
77
+ images/wrap_int.png
78
+ images/wrap_int.py
77
79
  memory_graph/__init__.py
78
80
  memory_graph/call_stack.py
79
81
  memory_graph/config.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "memory_graph"
7
- version = "0.3.55"
7
+ version = "0.3.56"
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"}
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
File without changes
File without changes
File without changes
File without changes