memory-graph 0.3.8__tar.gz → 0.3.9__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 (86) hide show
  1. {memory_graph-0.3.8/memory_graph.egg-info → memory_graph-0.3.9}/PKG-INFO +20 -9
  2. {memory_graph-0.3.8 → memory_graph-0.3.9}/README.md +19 -8
  3. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/add_one.py +4 -0
  4. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree.py +4 -0
  5. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/bin_tree.py +4 -0
  6. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/copies.py +4 -0
  7. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/copy_method.py +4 -0
  8. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/debugging.py +4 -0
  9. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/extension_numpy.py +4 -0
  10. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/extension_pandas.py +4 -0
  11. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/factorial.py +4 -0
  12. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/hash_set.py +4 -0
  13. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/highlight.py +4 -0
  14. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/immutable.py +4 -0
  15. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/linked_list.py +4 -0
  16. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/many_types.py +4 -0
  17. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/mutable.py +4 -0
  18. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/power_set.py +4 -0
  19. {memory_graph-0.3.8 → memory_graph-0.3.9}/install.txt +2 -2
  20. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/__init__.py +84 -22
  21. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/config.py +4 -0
  22. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/config_default.py +4 -0
  23. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/config_helpers.py +4 -0
  24. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/extension_numpy.py +4 -0
  25. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/extension_pandas.py +4 -0
  26. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/html_table.py +4 -0
  27. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/list_view.py +4 -0
  28. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/memory_to_nodes.py +4 -0
  29. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/node_base.py +4 -0
  30. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/node_key_value.py +4 -0
  31. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/node_linear.py +4 -0
  32. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/node_table.py +4 -0
  33. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/sequence.py +4 -0
  34. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/slicer.py +4 -0
  35. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/slices.py +4 -0
  36. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/slices_iterator.py +4 -0
  37. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/slices_table_iterator.py +4 -0
  38. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test.py +4 -0
  39. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test_memory_graph.py +4 -0
  40. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test_memory_to_nodes.py +4 -0
  41. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test_sequence.py +4 -0
  42. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test_slicer.py +4 -0
  43. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test_slices.py +4 -0
  44. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/test_slices_iterator.py +4 -0
  45. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph/utils.py +4 -0
  46. {memory_graph-0.3.8 → memory_graph-0.3.9/memory_graph.egg-info}/PKG-INFO +20 -9
  47. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph.egg-info/SOURCES.txt +0 -2
  48. {memory_graph-0.3.8 → memory_graph-0.3.9}/setup.py +5 -1
  49. memory_graph-0.3.8/child_to_parent/main.py +0 -334
  50. memory_graph-0.3.8/memory_graph/t.py +0 -15
  51. {memory_graph-0.3.8 → memory_graph-0.3.9}/LICENSE.txt +0 -0
  52. {memory_graph-0.3.8 → memory_graph-0.3.9}/MANIFEST.in +0 -0
  53. {memory_graph-0.3.8 → memory_graph-0.3.9}/TODO.txt +0 -0
  54. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/add_one.png +0 -0
  55. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree_base.png +0 -0
  56. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree_dir.png +0 -0
  57. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree_fail.png +0 -0
  58. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree_key_value.png +0 -0
  59. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree_linear.png +0 -0
  60. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/avltree_table.png +0 -0
  61. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/bin_tree.png +0 -0
  62. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/copies.png +0 -0
  63. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/copy_method.png +0 -0
  64. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/create_gif.sh +0 -0
  65. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/create_images.sh +0 -0
  66. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/debugging.gif +0 -0
  67. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/extension_numpy.png +0 -0
  68. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/extension_pandas.png +0 -0
  69. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/factorial.gif +0 -0
  70. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/hash_set.png +0 -0
  71. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/highlight.png +0 -0
  72. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/immutable1.png +0 -0
  73. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/immutable2.png +0 -0
  74. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/jupyter_example.ipynb +0 -0
  75. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/jupyter_example.png +0 -0
  76. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/linked_list.png +0 -0
  77. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/many_types.png +0 -0
  78. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/mutable1.png +0 -0
  79. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/mutable2.png +0 -0
  80. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/power_set.gif +0 -0
  81. {memory_graph-0.3.8 → memory_graph-0.3.9}/images/uva.png +0 -0
  82. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph.egg-info/dependency_links.txt +0 -0
  83. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph.egg-info/requires.txt +0 -0
  84. {memory_graph-0.3.8 → memory_graph-0.3.9}/memory_graph.egg-info/top_level.txt +0 -0
  85. {memory_graph-0.3.8 → memory_graph-0.3.9}/setup.cfg +0 -0
  86. {memory_graph-0.3.8 → memory_graph-0.3.9}/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.8
3
+ Version: 0.3.9
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
@@ -91,6 +91,7 @@ mg.render(data, "my_graph.pdf")
91
91
  mg.render(data, "my_graph.svg")
92
92
  mg.render(data, "my_graph.png")
93
93
  mg.render(data, "my_graph.gv") # Graphviz DOT file
94
+ mg.render(data) # renders to 'mg.render_filename' (default value: 'memory_graph.pdf')
94
95
  ```
95
96
 
96
97
  # Chapters #
@@ -250,10 +251,12 @@ This is because `b` is of immutable type 'tuple' so its value gets copied automa
250
251
  It is often helpful to temporarily block program execution to inspect the graph. For this, you can use the `mg.block()` function:
251
252
 
252
253
  ```python
253
- mg.block(fun, arg1, arg2, ..., loc=True)
254
+ mg.block(fun, arg1, arg2, ...)
254
255
  ```
255
256
 
256
- This function first executes `fun(arg1, arg2, ...)`, then prints the current source location in the program, and blocks execution until the <Enter> key is pressed. To skip printing the source location, set `loc=False`.
257
+ This function first executes `fun(arg1, arg2, ...)`, then prints the current source location in the program, and blocks execution until the <Enter> key is pressed.
258
+ Set `mg.block_shows_location = False` to skip printing the source location.
259
+ Set `mg.press_enter_message = None` to skip printing "Press <Enter> to continue...".
257
260
 
258
261
  ### Recursion ###
259
262
  The call stack is also helpful to visualize how recursion works. Here we use `mg.block()` to show each step of how recursively ```factorial(3)``` is computed:
@@ -336,12 +339,20 @@ mg.get_call_stack_after_up_to(after_function, up_to_function="<module>")
336
339
 
337
340
  ### Debugging without Debugger Tool ###
338
341
 
339
- To simplify debugging without a debugger tool, we offer these blocking alias functions that you can insert into your code at a specific point to visualize a graph:
342
+ To simplify debugging without a debugger tool, we offer these alias functions that you can insert into your code at the point where you want to visualize a graph:
340
343
 
341
344
  | alias | purpose | function call |
342
345
  |:---|:---|:---|
343
- | `mg.l()` | graph **l**ocal variables and block | `mg.block(mg.show, locals())` |
344
- | `mg.s()` | graph the call **s**tack and block | `mg.block(mg.show, mg.get_call_stack())` |
346
+ | `mg.sl()` | **s**how **l**ocal variables | `mg.show(locals())` |
347
+ | `mg.ss()` | **s**how the call **s**tack | `mg.show(mg.get_call_stack())` |
348
+ | `mg.bsl()` | **b**lock after **s**howing **l**ocal variables | `mg.block(mg.show, locals())` |
349
+ | `mg.bss()` | **b**lock after **s**howing the call **s**tack | `mg.block(mg.show, mg.get_call_stack())` |
350
+ | `mg.rl()` | **r**ender **l**ocal variables | `mg.render(locals())` |
351
+ | `mg.rs()` | **r**ender the call **s**tack | `mg.render(mg.get_call_stack())` |
352
+ | `mg.brl()` | **b**lock after **r**endering **l**ocal variables | `mg.block(mg.render, locals())` |
353
+ | `mg.brs()` | **b**lock after **r**endering the call **s**tack | `mg.block(mg.render, mg.get_call_stack())` |
354
+ | `mg.l()` | same as `mg.bsl()` | |
355
+ | `mg.s()` | same as `mg.bss()` | |
345
356
 
346
357
  For example, executing this program:
347
358
 
@@ -353,7 +364,7 @@ squares_collector = []
353
364
  for i in range(1, 6):
354
365
  squares.append(i**2)
355
366
  squares_collector.append(squares.copy())
356
- mg.l() # graph local variables
367
+ mg.l() # block after showing local variables
357
368
  ```
358
369
  and pressing &lt;Enter&gt; a number of times, results in:
359
370
 
@@ -568,7 +579,7 @@ mg.show(locals())
568
579
  ![extension_pandas.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_pandas.png)
569
580
 
570
581
  ## Introspection ##
571
- This section is likely to change. Sometimes the introspection fails or is not as desired. For example the `bintrees.avltree.Node` object doesn't show any attributes in the graph below:
582
+ This section is likely to change. Sometimes the introspection fails or is not as desired. For example the `bintrees.avltree.Node` object doesn't show any attributes in the graph below.
572
583
 
573
584
  ```python
574
585
  import memory_graph as mg
@@ -587,7 +598,7 @@ mg.show(locals())
587
598
 
588
599
 
589
600
  ### dir() ###
590
- A usefull start is to give it some color, show the list of all its attributes using `dir()`, and setting an empty Slicer to see the attribute list in full.
601
+ A useful start is to give it some color, show the list of all its attributes using `dir()`, and setting an empty Slicer to see the attribute list in full.
591
602
 
592
603
  ```python
593
604
  import memory_graph as mg
@@ -72,6 +72,7 @@ mg.render(data, "my_graph.pdf")
72
72
  mg.render(data, "my_graph.svg")
73
73
  mg.render(data, "my_graph.png")
74
74
  mg.render(data, "my_graph.gv") # Graphviz DOT file
75
+ mg.render(data) # renders to 'mg.render_filename' (default value: 'memory_graph.pdf')
75
76
  ```
76
77
 
77
78
  # Chapters #
@@ -231,10 +232,12 @@ This is because `b` is of immutable type 'tuple' so its value gets copied automa
231
232
  It is often helpful to temporarily block program execution to inspect the graph. For this, you can use the `mg.block()` function:
232
233
 
233
234
  ```python
234
- mg.block(fun, arg1, arg2, ..., loc=True)
235
+ mg.block(fun, arg1, arg2, ...)
235
236
  ```
236
237
 
237
- This function first executes `fun(arg1, arg2, ...)`, then prints the current source location in the program, and blocks execution until the &lt;Enter&gt; key is pressed. To skip printing the source location, set `loc=False`.
238
+ This function first executes `fun(arg1, arg2, ...)`, then prints the current source location in the program, and blocks execution until the &lt;Enter&gt; key is pressed.
239
+ Set `mg.block_shows_location = False` to skip printing the source location.
240
+ Set `mg.press_enter_message = None` to skip printing "Press <Enter> to continue...".
238
241
 
239
242
  ### Recursion ###
240
243
  The call stack is also helpful to visualize how recursion works. Here we use `mg.block()` to show each step of how recursively ```factorial(3)``` is computed:
@@ -317,12 +320,20 @@ mg.get_call_stack_after_up_to(after_function, up_to_function="<module>")
317
320
 
318
321
  ### Debugging without Debugger Tool ###
319
322
 
320
- To simplify debugging without a debugger tool, we offer these blocking alias functions that you can insert into your code at a specific point to visualize a graph:
323
+ To simplify debugging without a debugger tool, we offer these alias functions that you can insert into your code at the point where you want to visualize a graph:
321
324
 
322
325
  | alias | purpose | function call |
323
326
  |:---|:---|:---|
324
- | `mg.l()` | graph **l**ocal variables and block | `mg.block(mg.show, locals())` |
325
- | `mg.s()` | graph the call **s**tack and block | `mg.block(mg.show, mg.get_call_stack())` |
327
+ | `mg.sl()` | **s**how **l**ocal variables | `mg.show(locals())` |
328
+ | `mg.ss()` | **s**how the call **s**tack | `mg.show(mg.get_call_stack())` |
329
+ | `mg.bsl()` | **b**lock after **s**howing **l**ocal variables | `mg.block(mg.show, locals())` |
330
+ | `mg.bss()` | **b**lock after **s**howing the call **s**tack | `mg.block(mg.show, mg.get_call_stack())` |
331
+ | `mg.rl()` | **r**ender **l**ocal variables | `mg.render(locals())` |
332
+ | `mg.rs()` | **r**ender the call **s**tack | `mg.render(mg.get_call_stack())` |
333
+ | `mg.brl()` | **b**lock after **r**endering **l**ocal variables | `mg.block(mg.render, locals())` |
334
+ | `mg.brs()` | **b**lock after **r**endering the call **s**tack | `mg.block(mg.render, mg.get_call_stack())` |
335
+ | `mg.l()` | same as `mg.bsl()` | |
336
+ | `mg.s()` | same as `mg.bss()` | |
326
337
 
327
338
  For example, executing this program:
328
339
 
@@ -334,7 +345,7 @@ squares_collector = []
334
345
  for i in range(1, 6):
335
346
  squares.append(i**2)
336
347
  squares_collector.append(squares.copy())
337
- mg.l() # graph local variables
348
+ mg.l() # block after showing local variables
338
349
  ```
339
350
  and pressing &lt;Enter&gt; a number of times, results in:
340
351
 
@@ -549,7 +560,7 @@ mg.show(locals())
549
560
  ![extension_pandas.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_pandas.png)
550
561
 
551
562
  ## Introspection ##
552
- This section is likely to change. Sometimes the introspection fails or is not as desired. For example the `bintrees.avltree.Node` object doesn't show any attributes in the graph below:
563
+ This section is likely to change. Sometimes the introspection fails or is not as desired. For example the `bintrees.avltree.Node` object doesn't show any attributes in the graph below.
553
564
 
554
565
  ```python
555
566
  import memory_graph as mg
@@ -568,7 +579,7 @@ mg.show(locals())
568
579
 
569
580
 
570
581
  ### dir() ###
571
- A usefull start is to give it some color, show the list of all its attributes using `dir()`, and setting an empty Slicer to see the attribute list in full.
582
+ A useful start is to give it some color, show the list of all its attributes using `dir()`, and setting an empty Slicer to see the attribute list in full.
572
583
 
573
584
  ```python
574
585
  import memory_graph as mg
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  def add_one(a, b, c):
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import bintrees
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import random
3
7
  random.seed(0) # use same random numbers each run
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import copy
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import copy
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  image=0
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import numpy as np
3
7
  import memory_graph.extension_numpy
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import pandas as pd
3
7
  import memory_graph.extension_pandas
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  image=0
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import random
3
7
  random.seed(0) # use same random numbers each run
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  from memory_graph.slicer import Slicer
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  a = (4, 3, 2)
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
  import random
3
7
  random.seed(0) # use same random numbers each run
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  class MyClass:
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  a = [4, 3, 2]
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph as mg
2
6
 
3
7
  image = 1
@@ -14,10 +14,10 @@ pip install --upgrade .
14
14
 
15
15
 
16
16
  # ===== prepare packages for upload
17
- # - increase version number in setup.py and memory_graph/__init__.py before each upload
17
+ # - increase version number in: setup.py memory_graph/__init__.py
18
18
  # - update images:
19
19
  cd images; bash create_images.sh; cd ..
20
- # - git commit -am "version X.X.X"
20
+ # - git commit -am "version X.X.X" && git push
21
21
  rm -f ./dist/*
22
22
  python setup.py check
23
23
  python setup.py sdist
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph.memory_to_nodes as memory_to_nodes
2
6
  import memory_graph.config as config
3
7
  import memory_graph.config_default
@@ -9,8 +13,11 @@ import sys
9
13
 
10
14
  import graphviz
11
15
 
12
- __version__ = "0.3.08"
16
+ __version__ = "0.3.09"
13
17
  __author__ = 'Bas Terwijn'
18
+ render_filename = 'memory_graph.pdf'
19
+ block_shows_location = True
20
+ press_enter_message = "Press <Enter> to continue..."
14
21
 
15
22
  def get_source_location(stack_index):
16
23
  """ Helper function to get the source location of the stack with 'stack_index' of the call stack. """
@@ -18,27 +25,24 @@ def get_source_location(stack_index):
18
25
  filename= frameInfo.filename
19
26
  line_nr= frameInfo.lineno
20
27
  function = frameInfo.function
21
- return f'blocked at {filename}:{line_nr} function:"{function}"'
28
+ return f'{filename}:{line_nr} function:"{function}"'
22
29
 
23
30
  def block(fun=None, *args, **kwargs):
24
31
  """
25
32
  Calls the given function `fun` with specified arguments and keyword arguments,
26
33
  waits for the user to press Enter, and returns the result of `fun`.
27
34
  """
28
- loc=True
29
- stack_index=2
30
- if 'loc' in kwargs:
31
- loc = kwargs['loc']
32
- del kwargs['loc']
33
35
  if 'stack_index' in kwargs:
34
36
  stack_index = kwargs['stack_index']
35
37
  del kwargs['stack_index']
36
38
  result = None
37
39
  if callable(fun):
38
40
  result = fun(*args, **kwargs)
39
- if loc:
40
- print(get_source_location(stack_index),end=', ')
41
- input("Press <Enter> to continue...")
41
+ if memory_graph.block_shows_location:
42
+ print('blocked at ' + get_source_location(stack_index), end=', ')
43
+ if memory_graph.press_enter_message:
44
+ print(memory_graph.press_enter_message)
45
+ input()
42
46
  return result
43
47
 
44
48
  def block_deprecated_message():
@@ -68,38 +72,96 @@ def render(data, outfile=None, block=False,
68
72
  colors = None,
69
73
  vertical_orientations = None,
70
74
  slicers = None):
71
- """ Renders the graph of 'data' to 'output_filename' and optionally blocks. """
75
+ """ Renders the graph of 'data' to 'outfile' and optionally blocks. """
76
+ if outfile is None:
77
+ outfile = memory_graph.render_filename
72
78
  graph = create_graph(data, colors, vertical_orientations, slicers)
73
- filename = outfile if outfile else graph.filename+".pdf"
74
- graph.render(outfile=filename)
79
+ graph.render(outfile=outfile)
75
80
  if block:
76
81
  block_deprecated_message()
77
82
 
78
- def l(loc=True, stack_index=2, colors = None, vertical_orientations = None, slicers = None):
83
+ # ------------ aliases
84
+
85
+ def sl(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
86
+ """
87
+ Shows the graph of locals() and blocks.
88
+ """
89
+ data = get_locals_from_calling_frame(stack_index=stack_index)
90
+ memory_graph.show(data, colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
91
+
92
+ def ss(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
93
+ """
94
+ Shows the graph of mg.get_call_stack() and blocks.
95
+ """
96
+ data = get_call_stack(stack_index=stack_index)
97
+ memory_graph.show(data, colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
98
+
99
+ def bsl(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
100
+ """
101
+ Shows the graph of locals() and blocks.
102
+ """
103
+ data = get_locals_from_calling_frame(stack_index=stack_index)
104
+ memory_graph.block(memory_graph.show, data, stack_index=stack_index+1, block=False,
105
+ colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
106
+
107
+ def bss(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
108
+ """
109
+ Shows the graph of mg.get_call_stack() and blocks.
110
+ """
111
+ data = get_call_stack(stack_index=stack_index)
112
+ memory_graph.block(memory_graph.show, data, stack_index=stack_index+1, block=False,
113
+ colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
114
+
115
+ def rl(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
116
+ """
117
+ Shows the graph of locals() and blocks.
118
+ """
119
+ data = get_locals_from_calling_frame(stack_index=stack_index)
120
+ memory_graph.render(data, block=False, colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
121
+
122
+ def rs(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
123
+ """
124
+ Shows the graph of mg.get_call_stack() and blocks.
125
+ """
126
+ data = get_call_stack(stack_index=stack_index)
127
+ memory_graph.render(data, block=False, colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
128
+
129
+ def brl(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
79
130
  """
80
- Shows the graph of 'data' or the locals of the calling frame, and blocks.
131
+ Shows the graph of locals() and blocks.
81
132
  """
82
133
  data = get_locals_from_calling_frame(stack_index=stack_index)
83
- memory_graph.block(memory_graph.show, data, loc=loc, stack_index=stack_index+1, block=False,
134
+ memory_graph.block(memory_graph.render, data, stack_index=stack_index+1, block=False,
84
135
  colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
85
136
 
86
- def s(loc=True, stack_index=2, colors = None, vertical_orientations = None, slicers = None):
137
+ def brs(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
87
138
  """
88
- Shows the graph of and optionally prints the call stack, and optionally blocks.
139
+ Shows the graph of mg.get_call_stack() and blocks.
89
140
  """
90
141
  data = get_call_stack(stack_index=stack_index)
91
- memory_graph.block(memory_graph.show, data, loc=loc, stack_index=stack_index+1, block=False,
142
+ memory_graph.block(memory_graph.render, data, stack_index=stack_index+1, block=False,
92
143
  colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
93
144
 
94
- # ------------ locals
145
+ def l(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
146
+ """
147
+ Shows the graph of locals() and blocks.
148
+ """
149
+ bsl(stack_index=stack_index+1, colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
150
+
151
+ def s(stack_index=2, colors = None, vertical_orientations = None, slicers = None):
152
+ """
153
+ Shows the graph of mg.get_call_stack() and blocks.
154
+ """
155
+ bss(stack_index=stack_index+1, colors=colors, vertical_orientations=vertical_orientations, slicers=slicers)
156
+
157
+
158
+ # ------------ call stack
95
159
 
96
160
  def get_locals_from_calling_frame(stack_index=1):
97
161
  """ Helper function to get locals of the stack with 'stack_inex' of the call stack. """
98
162
  frameInfo = inspect.stack()[stack_index] # get frameInfo of calling frame
99
163
  return frameInfo.frame.f_locals
100
164
 
101
- # ------------ call stack
102
-
103
165
  def stack_frames_to_dict(frames):
104
166
  """ Returns a dictionary representing the data on the call stack.
105
167
  Each key is the stack level and function name, each value is the locals of the frame at that level.
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  """ Configuration file for the graph visualizer. The configuration values are set later by the 'config_default.py' file. """
2
6
 
3
7
  max_tree_depth = None
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  """ Sets the default configuration values for the memory graph. """
2
6
  from memory_graph.node_base import Node_Base
3
7
  from memory_graph.node_linear import Node_Linear
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  """ This module provides helper functions to access the configuration of the memory graph. """
2
6
  from memory_graph.slicer import Slicer
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  """ Extension to add the memory graph configuration for Numpy types. """
2
6
  from memory_graph.node_linear import Node_Linear
3
7
  from memory_graph.node_table import Node_Table
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  """ Extension to add the memory graph configuration for Pandas type. """
2
6
  from memory_graph.node_linear import Node_Linear
3
7
  from memory_graph.node_table import Node_Table
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from memory_graph.node_base import Node_Base
2
6
  import memory_graph.node_base
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
 
2
6
  class List_View:
3
7
  def __init__(self, base_list, begin, end):
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from memory_graph.node_base import Node_Base
2
6
  from memory_graph.node_linear import Node_Linear
3
7
  from memory_graph.node_key_value import Node_Key_Value
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph.utils as utils
2
6
  import memory_graph.config as config
3
7
  import memory_graph.config_helpers as config_helpers
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from memory_graph.node_base import Node_Base
2
6
  from memory_graph.sequence import Sequence1D
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from memory_graph.node_base import Node_Base
2
6
  from memory_graph.sequence import Sequence1D
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from memory_graph.node_base import Node_Base
2
6
  from memory_graph.sequence import Sequence2D
3
7
  from memory_graph.list_view import List_View
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from abc import ABC, abstractmethod
2
6
 
3
7
  from memory_graph.slices import Slices1D, Slices2D
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from memory_graph.slices import Slices1D
2
6
  import memory_graph.utils as utils
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from abc import ABC, abstractmethod
2
6
 
3
7
  import bisect
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
 
2
6
  from abc import ABC, abstractmethod
3
7
 
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  from abc import ABC, abstractmethod
2
6
 
3
7
  class Slices_Table_Iterator(ABC):
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  """ Some test data to make memory graph of for test purposes. """
2
6
  import memory_graph.utils as utils
3
7
  import memory_graph.config as config
@@ -1,3 +1,7 @@
1
+ # This file is part of memory_graph.
2
+ # Copyright (c) 2023, Bas Terwijn.
3
+ # SPDX-License-Identifier: BSD-2-Clause
4
+
1
5
  import memory_graph
2
6
 
3
7
  import memory_graph.test as test