memory-graph 0.3.10__tar.gz → 0.3.11__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 (90) hide show
  1. {memory_graph-0.3.10/memory_graph.egg-info → memory_graph-0.3.11}/PKG-INFO +8 -6
  2. {memory_graph-0.3.10 → memory_graph-0.3.11}/README.md +7 -5
  3. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/__init__.py +1 -1
  4. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/config.py +2 -1
  5. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/config_default.py +2 -2
  6. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/html_table.py +1 -1
  7. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/memory_to_nodes.py +7 -7
  8. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test.py +1 -1
  9. memory_graph-0.3.11/memory_graph/test_max_graph_depth.py +27 -0
  10. {memory_graph-0.3.10 → memory_graph-0.3.11/memory_graph.egg-info}/PKG-INFO +8 -6
  11. memory_graph-0.3.11/memory_graph.egg-info/SOURCES.txt +36 -0
  12. {memory_graph-0.3.10 → memory_graph-0.3.11}/setup.py +1 -1
  13. memory_graph-0.3.10/TODO.txt +0 -9
  14. memory_graph-0.3.10/images/add_one.png +0 -0
  15. memory_graph-0.3.10/images/add_one.py +0 -18
  16. memory_graph-0.3.10/images/avltree.py +0 -43
  17. memory_graph-0.3.10/images/avltree_base.png +0 -0
  18. memory_graph-0.3.10/images/avltree_dir.png +0 -0
  19. memory_graph-0.3.10/images/avltree_fail.png +0 -0
  20. memory_graph-0.3.10/images/avltree_key_value.png +0 -0
  21. memory_graph-0.3.10/images/avltree_linear.png +0 -0
  22. memory_graph-0.3.10/images/avltree_table.png +0 -0
  23. memory_graph-0.3.10/images/bin_tree.png +0 -0
  24. memory_graph-0.3.10/images/bin_tree.py +0 -47
  25. memory_graph-0.3.10/images/copies.png +0 -0
  26. memory_graph-0.3.10/images/copies.py +0 -15
  27. memory_graph-0.3.10/images/copy_method.png +0 -0
  28. memory_graph-0.3.10/images/copy_method.py +0 -22
  29. memory_graph-0.3.10/images/create_gif.sh +0 -19
  30. memory_graph-0.3.10/images/create_images.sh +0 -34
  31. memory_graph-0.3.10/images/debugging.gif +0 -0
  32. memory_graph-0.3.10/images/debugging.py +0 -19
  33. memory_graph-0.3.10/images/extension_numpy.png +0 -0
  34. memory_graph-0.3.10/images/extension_numpy.py +0 -14
  35. memory_graph-0.3.10/images/extension_pandas.png +0 -0
  36. memory_graph-0.3.10/images/extension_pandas.py +0 -17
  37. memory_graph-0.3.10/images/factorial.gif +0 -0
  38. memory_graph-0.3.10/images/factorial.py +0 -24
  39. memory_graph-0.3.10/images/hash_set.png +0 -0
  40. memory_graph-0.3.10/images/hash_set.py +0 -39
  41. memory_graph-0.3.10/images/highlight.png +0 -0
  42. memory_graph-0.3.10/images/highlight.py +0 -15
  43. memory_graph-0.3.10/images/immutable.py +0 -11
  44. memory_graph-0.3.10/images/immutable1.png +0 -0
  45. memory_graph-0.3.10/images/immutable2.png +0 -0
  46. memory_graph-0.3.10/images/ipython.png +0 -0
  47. memory_graph-0.3.10/images/jupyter_example.ipynb +0 -85
  48. memory_graph-0.3.10/images/jupyter_example.png +0 -0
  49. memory_graph-0.3.10/images/linked_list.png +0 -0
  50. memory_graph-0.3.10/images/linked_list.py +0 -39
  51. memory_graph-0.3.10/images/many_types.png +0 -0
  52. memory_graph-0.3.10/images/many_types.py +0 -13
  53. memory_graph-0.3.10/images/mutable.py +0 -11
  54. memory_graph-0.3.10/images/mutable1.png +0 -0
  55. memory_graph-0.3.10/images/mutable2.png +0 -0
  56. memory_graph-0.3.10/images/power_set.gif +0 -0
  57. memory_graph-0.3.10/images/power_set.py +0 -28
  58. memory_graph-0.3.10/images/pyodide.png +0 -0
  59. memory_graph-0.3.10/images/uva.png +0 -0
  60. memory_graph-0.3.10/install.txt +0 -31
  61. memory_graph-0.3.10/memory_graph.egg-info/SOURCES.txt +0 -86
  62. memory_graph-0.3.10/src/auto_memory_graph.py +0 -18
  63. memory_graph-0.3.10/src/pyodide.html +0 -179
  64. memory_graph-0.3.10/uml/memory_graph.uxf +0 -322
  65. {memory_graph-0.3.10 → memory_graph-0.3.11}/LICENSE.txt +0 -0
  66. {memory_graph-0.3.10 → memory_graph-0.3.11}/MANIFEST.in +0 -0
  67. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/config_helpers.py +0 -0
  68. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/extension_numpy.py +0 -0
  69. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/extension_pandas.py +0 -0
  70. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/list_view.py +0 -0
  71. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/node_base.py +0 -0
  72. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/node_key_value.py +0 -0
  73. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/node_linear.py +0 -0
  74. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/node_table.py +0 -0
  75. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/sequence.py +0 -0
  76. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/slicer.py +0 -0
  77. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/slices.py +0 -0
  78. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/slices_iterator.py +0 -0
  79. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/slices_table_iterator.py +0 -0
  80. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test_memory_graph.py +0 -0
  81. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test_memory_to_nodes.py +0 -0
  82. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test_sequence.py +0 -0
  83. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test_slicer.py +0 -0
  84. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test_slices.py +0 -0
  85. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/test_slices_iterator.py +0 -0
  86. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph/utils.py +0 -0
  87. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph.egg-info/dependency_links.txt +0 -0
  88. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph.egg-info/requires.txt +0 -0
  89. {memory_graph-0.3.10 → memory_graph-0.3.11}/memory_graph.egg-info/top_level.txt +0 -0
  90. {memory_graph-0.3.10 → memory_graph-0.3.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: memory_graph
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Draws a graph of your data to analyze its structure.
5
5
  Home-page: https://github.com/bterwijn/memory_graph
6
6
  Author: Bas Terwijn
@@ -171,7 +171,7 @@ mg.render(locals(), 'mutable2.png')
171
171
  |:-----------------------------------------------------------:|:-------------------------------------------------------------:|
172
172
  | mutable1.png | mutable2.png |
173
173
 
174
- 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 which makes copying less of a concern.
174
+ 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.
175
175
 
176
176
  ### Copying ###
177
177
  Python offers three different "copy" options that we will demonstrate using a nested list:
@@ -337,6 +337,8 @@ The ```mg.get_call_stack()``` doesn't work well in *watch* context in most debug
337
337
  | **Visual Studio Code** | `mg.get_call_stack_vscode()` |
338
338
  | **Pycharm** | `mg.get_call_stack_pycharm()` |
339
339
 
340
+ ![debug_vscode.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/debug_vscode.png)
341
+
340
342
  #### Other Debuggers ####
341
343
  For other debuggers, invoke this function within the *watch* context. Then, in the "call_stack.txt" file, identify the slice of functions you wish to include in the call stack.
342
344
  ```
@@ -508,8 +510,8 @@ for i in range(n):
508
510
  ## Configuration ##
509
511
  Different aspects of memory_graph can be configured. The default configuration is reset by importing 'memory_graph.config_default'.
510
512
 
511
- - ***mg.config.max_tree_depth*** : int
512
- - The maxium depth of the graph. A `★` symbol indictes where the graph is cut short.
513
+ - ***mg.config.max_graph_depth*** : int
514
+ - The maxium depth of the graph with default value 12. A `✂` (scissor) symbol indicates where the graph is cut short.
513
515
 
514
516
  - ***mg.config.max_string_length*** : int
515
517
  - The maximum length of strings shown in the graph. Longer strings will be truncated.
@@ -554,7 +556,7 @@ mg.show( locals(),
554
556
  Different extensions are available for types from other Python packages.
555
557
 
556
558
  ### Numpy ###
557
- Numpy types `arrray` and `matrix` and `ndarray` can be graphed with "memory_graph.extension_numpy":
559
+ Numpy types `array` and `matrix` and `ndarray` can be graphed with "memory_graph.extension_numpy":
558
560
 
559
561
  ```python
560
562
  import memory_graph as mg
@@ -740,7 +742,7 @@ See for example [jupyter_example.ipynb](https://raw.githubusercontent.com/bterwi
740
742
  ## ipython ##
741
743
  In ipython `locals()` has additional variables that cause problems in the graph, use `mg.locals_ipython()` to get the local variables with these problematic variables filtered out. Use `mg.get_call_stack_ipython()` to get the whole call stack with these variables filtered out.
742
744
 
743
- Additionally install file [auto_memory_graph.py](https://raw.githubusercontent.com/bterwijn/memory_graph/main/sc/auto_memory_graph.py) in the ipython startup directory:
745
+ Additionally install file [auto_memory_graph.py](https://raw.githubusercontent.com/bterwijn/memory_graph/main/src/auto_memory_graph.py) in the ipython startup directory:
744
746
  * Linux/Mac: ~/.ipython/profile_default/startup/
745
747
  * Windows: %USERPROFILE%\.ipython\profile_default\startup\
746
748
 
@@ -152,7 +152,7 @@ mg.render(locals(), 'mutable2.png')
152
152
  |:-----------------------------------------------------------:|:-------------------------------------------------------------:|
153
153
  | mutable1.png | mutable2.png |
154
154
 
155
- 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 which makes copying less of a concern.
155
+ 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.
156
156
 
157
157
  ### Copying ###
158
158
  Python offers three different "copy" options that we will demonstrate using a nested list:
@@ -318,6 +318,8 @@ The ```mg.get_call_stack()``` doesn't work well in *watch* context in most debug
318
318
  | **Visual Studio Code** | `mg.get_call_stack_vscode()` |
319
319
  | **Pycharm** | `mg.get_call_stack_pycharm()` |
320
320
 
321
+ ![debug_vscode.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/debug_vscode.png)
322
+
321
323
  #### Other Debuggers ####
322
324
  For other debuggers, invoke this function within the *watch* context. Then, in the "call_stack.txt" file, identify the slice of functions you wish to include in the call stack.
323
325
  ```
@@ -489,8 +491,8 @@ for i in range(n):
489
491
  ## Configuration ##
490
492
  Different aspects of memory_graph can be configured. The default configuration is reset by importing 'memory_graph.config_default'.
491
493
 
492
- - ***mg.config.max_tree_depth*** : int
493
- - The maxium depth of the graph. A `★` symbol indictes where the graph is cut short.
494
+ - ***mg.config.max_graph_depth*** : int
495
+ - The maxium depth of the graph with default value 12. A `✂` (scissor) symbol indicates where the graph is cut short.
494
496
 
495
497
  - ***mg.config.max_string_length*** : int
496
498
  - The maximum length of strings shown in the graph. Longer strings will be truncated.
@@ -535,7 +537,7 @@ mg.show( locals(),
535
537
  Different extensions are available for types from other Python packages.
536
538
 
537
539
  ### Numpy ###
538
- Numpy types `arrray` and `matrix` and `ndarray` can be graphed with "memory_graph.extension_numpy":
540
+ Numpy types `array` and `matrix` and `ndarray` can be graphed with "memory_graph.extension_numpy":
539
541
 
540
542
  ```python
541
543
  import memory_graph as mg
@@ -721,7 +723,7 @@ See for example [jupyter_example.ipynb](https://raw.githubusercontent.com/bterwi
721
723
  ## ipython ##
722
724
  In ipython `locals()` has additional variables that cause problems in the graph, use `mg.locals_ipython()` to get the local variables with these problematic variables filtered out. Use `mg.get_call_stack_ipython()` to get the whole call stack with these variables filtered out.
723
725
 
724
- Additionally install file [auto_memory_graph.py](https://raw.githubusercontent.com/bterwijn/memory_graph/main/sc/auto_memory_graph.py) in the ipython startup directory:
726
+ Additionally install file [auto_memory_graph.py](https://raw.githubusercontent.com/bterwijn/memory_graph/main/src/auto_memory_graph.py) in the ipython startup directory:
725
727
  * Linux/Mac: ~/.ipython/profile_default/startup/
726
728
  * Windows: %USERPROFILE%\.ipython\profile_default\startup\
727
729
 
@@ -13,7 +13,7 @@ import sys
13
13
 
14
14
  import graphviz
15
15
 
16
- __version__ = "0.3.10"
16
+ __version__ = "0.3.11"
17
17
  __author__ = 'Bas Terwijn'
18
18
  render_filename = 'memory_graph.pdf'
19
19
  block_prints_location = True
@@ -4,7 +4,8 @@
4
4
 
5
5
  """ Configuration file for the graph visualizer. The configuration values are set later by the 'config_default.py' file. """
6
6
 
7
- max_tree_depth = None
7
+ max_graph_depth = None
8
+ graph_cut_symbol = None
8
9
  max_missing_edges = None
9
10
  max_string_length = None
10
11
  graph_stability = None
@@ -16,8 +16,8 @@ import memory_graph.utils as utils
16
16
  import types
17
17
 
18
18
  """ The maximum depth of nodes in the graph. When the graph gets too big set this to a small positive number. A `✂` symbol indictes where the graph is cut short. """
19
- config.max_tree_depth = -1
20
-
19
+ config.max_graph_depth = 12
20
+ config.graph_cut_symbol = '✂'
21
21
  config.max_missing_edges = 3
22
22
 
23
23
  """ The maximum length of strings shown in the graph. Longer strings will be truncated. """
@@ -80,7 +80,7 @@ class HTML_Table:
80
80
  if child_id in id_to_slices:
81
81
  self.add_reference(node, child, rounded, border, dashed)
82
82
  else:
83
- self.add_value("✂", rounded, border)
83
+ self.add_value(config.graph_cut_symbol, rounded, border)
84
84
  else:
85
85
  self.add_value(child, rounded, border)
86
86
 
@@ -45,10 +45,10 @@ def read_nodes(data):
45
45
 
46
46
  # --------------------------------------------------------------------------------------------
47
47
 
48
- def slice_nodes(nodes, root_id, max_tree_depth):
48
+ def slice_nodes(nodes, root_id, max_graph_depth):
49
49
 
50
- def slice_nodes_recursive(nodes, node_id, id_to_slices, max_tree_depth):
51
- if max_tree_depth == 0 or node_id in id_to_slices:
50
+ def slice_nodes_recursive(nodes, node_id, id_to_slices, max_graph_depth):
51
+ if max_graph_depth == 0 or node_id in id_to_slices:
52
52
  return
53
53
  if node_id in nodes:
54
54
  node = nodes[node_id]
@@ -60,11 +60,11 @@ def slice_nodes(nodes, root_id, max_tree_depth):
60
60
  slices = children.slice(slicer)
61
61
  id_to_slices[node_id] = slices
62
62
  if not node.is_hidden_node():
63
- max_tree_depth -= 1
63
+ max_graph_depth -= 1
64
64
  for index in slices:
65
- slice_nodes_recursive(nodes, id(children[index]), id_to_slices, max_tree_depth)
65
+ slice_nodes_recursive(nodes, id(children[index]), id_to_slices, max_graph_depth)
66
66
  id_to_slices = {}
67
- slice_nodes_recursive(nodes, root_id, id_to_slices, max_tree_depth)
67
+ slice_nodes_recursive(nodes, root_id, id_to_slices, max_graph_depth)
68
68
  return id_to_slices
69
69
 
70
70
  # --------------------------------------------------------------------------------------------
@@ -175,7 +175,7 @@ def build_graph(graphviz_graph, nodes, root_id, id_to_slices):
175
175
  def memory_to_nodes(data):
176
176
  nodes, root_id = read_nodes(data)
177
177
  #print('nodes:',nodes,'root_id:',root_id)
178
- id_to_slices = slice_nodes(nodes, root_id, config.max_tree_depth)
178
+ id_to_slices = slice_nodes(nodes, root_id, config.max_graph_depth)
179
179
  #print('id_to_slices:',id_to_slices)
180
180
  id_to_slices = add_missing_edges(nodes, id_to_slices, config.max_missing_edges)
181
181
  #print('id_to_slices:',id_to_slices)
@@ -214,7 +214,7 @@ class BinTree:
214
214
 
215
215
  def test_missing_edges(fun):
216
216
  random.seed(0)
217
- config.max_tree_depth = 7
217
+ config.max_graph_depth = 7
218
218
  config.max_missing_edges = 5
219
219
  tree = BinTree()
220
220
  last_node = None
@@ -0,0 +1,27 @@
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 build_nested_list(depth = 15):
8
+ first = [1,2]
9
+ last = first
10
+ if depth>0:
11
+ first2, last = build_nested_list(depth-1)
12
+ first.append(first2)
13
+ return first, last
14
+
15
+ first,last = build_nested_list(15)
16
+ for i in range(20):
17
+ last.append('X')
18
+
19
+ child = ('who', 'are', 'my', 'parents?')
20
+ last[4] = child
21
+ last[5] = child
22
+ last[6] = child
23
+ last[7] = child
24
+ last[8] = child
25
+
26
+ mg.show([first,child])
27
+ #mg.show([first])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: memory_graph
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Draws a graph of your data to analyze its structure.
5
5
  Home-page: https://github.com/bterwijn/memory_graph
6
6
  Author: Bas Terwijn
@@ -171,7 +171,7 @@ mg.render(locals(), 'mutable2.png')
171
171
  |:-----------------------------------------------------------:|:-------------------------------------------------------------:|
172
172
  | mutable1.png | mutable2.png |
173
173
 
174
- 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 which makes copying less of a concern.
174
+ 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.
175
175
 
176
176
  ### Copying ###
177
177
  Python offers three different "copy" options that we will demonstrate using a nested list:
@@ -337,6 +337,8 @@ The ```mg.get_call_stack()``` doesn't work well in *watch* context in most debug
337
337
  | **Visual Studio Code** | `mg.get_call_stack_vscode()` |
338
338
  | **Pycharm** | `mg.get_call_stack_pycharm()` |
339
339
 
340
+ ![debug_vscode.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/debug_vscode.png)
341
+
340
342
  #### Other Debuggers ####
341
343
  For other debuggers, invoke this function within the *watch* context. Then, in the "call_stack.txt" file, identify the slice of functions you wish to include in the call stack.
342
344
  ```
@@ -508,8 +510,8 @@ for i in range(n):
508
510
  ## Configuration ##
509
511
  Different aspects of memory_graph can be configured. The default configuration is reset by importing 'memory_graph.config_default'.
510
512
 
511
- - ***mg.config.max_tree_depth*** : int
512
- - The maxium depth of the graph. A `★` symbol indictes where the graph is cut short.
513
+ - ***mg.config.max_graph_depth*** : int
514
+ - The maxium depth of the graph with default value 12. A `✂` (scissor) symbol indicates where the graph is cut short.
513
515
 
514
516
  - ***mg.config.max_string_length*** : int
515
517
  - The maximum length of strings shown in the graph. Longer strings will be truncated.
@@ -554,7 +556,7 @@ mg.show( locals(),
554
556
  Different extensions are available for types from other Python packages.
555
557
 
556
558
  ### Numpy ###
557
- Numpy types `arrray` and `matrix` and `ndarray` can be graphed with "memory_graph.extension_numpy":
559
+ Numpy types `array` and `matrix` and `ndarray` can be graphed with "memory_graph.extension_numpy":
558
560
 
559
561
  ```python
560
562
  import memory_graph as mg
@@ -740,7 +742,7 @@ See for example [jupyter_example.ipynb](https://raw.githubusercontent.com/bterwi
740
742
  ## ipython ##
741
743
  In ipython `locals()` has additional variables that cause problems in the graph, use `mg.locals_ipython()` to get the local variables with these problematic variables filtered out. Use `mg.get_call_stack_ipython()` to get the whole call stack with these variables filtered out.
742
744
 
743
- Additionally install file [auto_memory_graph.py](https://raw.githubusercontent.com/bterwijn/memory_graph/main/sc/auto_memory_graph.py) in the ipython startup directory:
745
+ Additionally install file [auto_memory_graph.py](https://raw.githubusercontent.com/bterwijn/memory_graph/main/src/auto_memory_graph.py) in the ipython startup directory:
744
746
  * Linux/Mac: ~/.ipython/profile_default/startup/
745
747
  * Windows: %USERPROFILE%\.ipython\profile_default\startup\
746
748
 
@@ -0,0 +1,36 @@
1
+ LICENSE.txt
2
+ MANIFEST.in
3
+ README.md
4
+ setup.py
5
+ memory_graph/__init__.py
6
+ memory_graph/config.py
7
+ memory_graph/config_default.py
8
+ memory_graph/config_helpers.py
9
+ memory_graph/extension_numpy.py
10
+ memory_graph/extension_pandas.py
11
+ memory_graph/html_table.py
12
+ memory_graph/list_view.py
13
+ memory_graph/memory_to_nodes.py
14
+ memory_graph/node_base.py
15
+ memory_graph/node_key_value.py
16
+ memory_graph/node_linear.py
17
+ memory_graph/node_table.py
18
+ memory_graph/sequence.py
19
+ memory_graph/slicer.py
20
+ memory_graph/slices.py
21
+ memory_graph/slices_iterator.py
22
+ memory_graph/slices_table_iterator.py
23
+ memory_graph/test.py
24
+ memory_graph/test_max_graph_depth.py
25
+ memory_graph/test_memory_graph.py
26
+ memory_graph/test_memory_to_nodes.py
27
+ memory_graph/test_sequence.py
28
+ memory_graph/test_slicer.py
29
+ memory_graph/test_slices.py
30
+ memory_graph/test_slices_iterator.py
31
+ memory_graph/utils.py
32
+ memory_graph.egg-info/PKG-INFO
33
+ memory_graph.egg-info/SOURCES.txt
34
+ memory_graph.egg-info/dependency_links.txt
35
+ memory_graph.egg-info/requires.txt
36
+ memory_graph.egg-info/top_level.txt
@@ -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.10',
14
+ version = '0.3.11',
15
15
  description = 'Draws a graph of your data to analyze its structure.',
16
16
  long_description = long_description_from_readme,
17
17
  long_description_content_type = 'text/markdown',
@@ -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
@@ -1,18 +0,0 @@
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, c):
8
- a += [1]
9
- b += (1,)
10
- c += [1]
11
- mg.render( mg.get_call_stack(), "add_one.png")
12
-
13
- a = [4, 3, 2]
14
- b = (4, 3, 2)
15
- c = [4, 3, 2]
16
-
17
- add_one(a, b, c.copy())
18
- print(f"a:{a} b:{b} c:{c}")
@@ -1,43 +0,0 @@
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
- import bintrees
7
-
8
- # Create an AVL tree
9
- tree = bintrees.AVLTree()
10
- tree.insert(10, "ten")
11
- tree.insert(5, "five")
12
- tree.insert(20, "twenty")
13
- tree.insert(15, "fifteen")
14
-
15
- # mg.render(locals(), 'avltree_fail.png') # id keeps changing
16
-
17
- mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
18
- mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_linear.Node_Linear(data, dir(data))
19
- mg.config.type_to_slicer[bintrees.avltree.Node] = mg.slicer.Slicer()
20
- mg.render(locals(), 'avltree_dir.png')
21
-
22
- mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_base.Node_Base(f"key:{data.key} value:{data.value}")
23
- mg.render(locals(), 'avltree_base.png')
24
-
25
- mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_linear.Node_Linear(data,
26
- ['left:', data.left,
27
- 'key:', data.key,
28
- 'value:', data.value,
29
- 'right:', data.right])
30
- mg.render(locals(), 'avltree_linear.png')
31
-
32
- mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_key_value.Node_Key_Value(data,
33
- {'left': data.left,
34
- 'key': data.key,
35
- 'value': data.value,
36
- 'right': data.right}.items())
37
- mg.render(locals(), 'avltree_key_value.png')
38
-
39
- mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.node_table.Node_Table(data,
40
- [[data.key, data.value],
41
- [data.left, data.right]]
42
- )
43
- mg.render(locals(), 'avltree_table.png')
Binary file
Binary file
Binary file
Binary file
@@ -1,47 +0,0 @@
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
- import random
7
- random.seed(0) # use same random numbers each run
8
-
9
- class Node:
10
-
11
- def __init__(self, value):
12
- self.smaller = None
13
- self.value = value
14
- self.larger = None
15
-
16
- class BinTree:
17
-
18
- def __init__(self):
19
- self.root = None
20
-
21
- def add_recursive(self, new_value, node):
22
- if new_value < node.value:
23
- if node.smaller is None:
24
- node.smaller = Node(new_value)
25
- else:
26
- self.add_recursive(new_value, node.smaller)
27
- else:
28
- if node.larger is None:
29
- node.larger = Node(new_value)
30
- else:
31
- self.add_recursive(new_value, node.larger)
32
- if new_value == 51:
33
- mg.render(locals(), f"bin_tree.png")
34
- exit(0)
35
-
36
- def add(self, value):
37
- if self.root is None:
38
- self.root = Node(value)
39
- else:
40
- self.add_recursive(value, self.root)
41
-
42
- tree = BinTree()
43
- n = 100
44
- for i in range(n):
45
- new_value = random.randrange(n)
46
- tree.add(new_value)
47
-
Binary file
@@ -1,15 +0,0 @@
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
- import copy
7
-
8
- a = [ [1, 2], ['x', 'y'] ] # a nested list (a list containing lists)
9
-
10
- # three different ways to make a "copy" of 'a':
11
- c1 = a
12
- c2 = copy.copy(a) # equivalent to: a.copy() a[:] list(a)
13
- c3 = copy.deepcopy(a)
14
-
15
- mg.render(locals(), 'copies.png')
Binary file
@@ -1,22 +0,0 @@
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
- import copy
7
-
8
- class My_Class:
9
-
10
- def __init__(self):
11
- self.digits = [1, 2]
12
- self.letters = ['x', 'y']
13
-
14
- def copy(self): # custom copy method copies the digits but shares the letters
15
- c = copy.copy(self)
16
- c.digits = copy.copy(self.digits)
17
- return c
18
-
19
- a = My_Class()
20
- b = a.copy()
21
-
22
- mg.render(locals(), 'copy_method.png')
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # install:
4
- #
5
- # sudo apt install imagemagick
6
-
7
- name="$1"
8
- files=$(ls -v $name*.png)
9
- echo "creating gif with:"
10
- echo "$files"
11
-
12
- largest_size=$(identify -format "%Wx%H %f\n" $name*.png | sort -nr | head -n1)
13
- echo "largest_size: $largest_size"
14
-
15
- echo "resizing images"
16
- mogrify -resize $largest_size -background white -gravity center -extent $largest_size $files
17
- echo "creating file: $name.gif"
18
- convert -delay 150 -loop 0 $files $name.gif
19
- echo "done"
@@ -1,34 +0,0 @@
1
- # intro
2
- python many_types.py
3
-
4
- # debugging
5
- python debugging.py
6
- bash create_gif.sh debugging
7
-
8
- # data model
9
- python immutable.py
10
- python mutable.py
11
- python copies.py
12
- python copy_method.py
13
-
14
- # call stack
15
- python add_one.py
16
- python factorial.py
17
- bash create_gif.sh factorial
18
- python power_set.py
19
- bash create_gif.sh power_set
20
-
21
- # datastructures
22
- python linked_list.py
23
- python bin_tree.py
24
- python hash_set.py
25
-
26
- # configuration
27
- python highlight.py
28
-
29
- # extensions
30
- python extension_numpy.py
31
- python extension_pandas.py
32
-
33
- # introspection
34
- python avltree.py
Binary file
@@ -1,19 +0,0 @@
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
- image=0
8
- def get_fac_name():
9
- global image
10
- image+=1
11
- return f"debugging{image:02d}.png"
12
-
13
- squares = []
14
- squares_collector = []
15
- for i in range(1,6):
16
- squares.append(i**2)
17
- squares_collector.append(squares.copy())
18
- mg.render(locals(), get_fac_name())
19
- mg.render(locals(), get_fac_name())
@@ -1,14 +0,0 @@
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
- import numpy as np
7
- import memory_graph.extension_numpy
8
- np.random.seed(0) # use same random numbers each run
9
-
10
- array = np.array([1.1, 2, 3, 4, 5])
11
- matrix = np.matrix([[i*20+j for j in range(20)] for i in range(20)])
12
- ndarray = np.random.rand(20,20)
13
-
14
- mg.render( locals(), "extension_numpy.png")
@@ -1,17 +0,0 @@
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
- import pandas as pd
7
- import memory_graph.extension_pandas
8
-
9
- series = pd.Series( [i for i in range(20)] )
10
- dataframe1 = pd.DataFrame({ "calories": [420, 380, 390],
11
- "duration": [50, 40, 45] })
12
- dataframe2 = pd.DataFrame({ 'Name' : [ 'Tom', 'Anna', 'Steve', 'Lisa'],
13
- 'Age' : [ 28, 34, 29, 42],
14
- 'Length' : [ 1.70, 1.66, 1.82, 1.73] },
15
- index=['one', 'two', 'three', 'four']) # with row names
16
-
17
- mg.render( locals(), "extension_pandas.png")
Binary file