memory-graph 0.3.88__tar.gz → 0.3.89__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {memory_graph-0.3.88 → memory_graph-0.3.89}/PKG-INFO +15 -6
- {memory_graph-0.3.88 → memory_graph-0.3.89}/README.md +14 -5
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/__init__.py +13 -1
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/config_default.py +5 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/utils.py +4 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph.egg-info/PKG-INFO +15 -6
- {memory_graph-0.3.88 → memory_graph-0.3.89}/pyproject.toml +1 -1
- {memory_graph-0.3.88 → memory_graph-0.3.89}/LICENSE.txt +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/call_stack.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/config.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/config_helpers.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/extension_numpy.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/extension_pandas.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/extension_torch.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/html_table.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/list_view.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/memory_to_nodes.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/node_base.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/node_key_value.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/node_leaf.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/node_linear.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/node_table.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/sequence.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/slicer.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/slices.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/slices_iterator.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/slices_table_iterator.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_max_graph_depth.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_memory_graph.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_memory_to_nodes.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_sequence.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_slicer.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_slices.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph/test_slices_iterator.py +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph.egg-info/SOURCES.txt +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph.egg-info/dependency_links.txt +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph.egg-info/requires.txt +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/memory_graph.egg-info/top_level.txt +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/setup.cfg +0 -0
- {memory_graph-0.3.88 → memory_graph-0.3.89}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.89
|
|
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
|
|
@@ -1191,7 +1191,13 @@ mg.show(locals())
|
|
|
1191
1191
|

|
|
1192
1192
|
|
|
1193
1193
|
## All attributes using dir() ##
|
|
1194
|
-
|
|
1194
|
+
Then first give it some color, show the its attributes using either of:
|
|
1195
|
+
|
|
1196
|
+
- mg.node_all_attributes(data)
|
|
1197
|
+
- mg.node_non_callable_attributes(data)
|
|
1198
|
+
- mg.node_non_dunder_attributes(data)
|
|
1199
|
+
|
|
1200
|
+
and set an empty Slicer to see all attributes.
|
|
1195
1201
|
|
|
1196
1202
|
```python
|
|
1197
1203
|
import memory_graph as mg
|
|
@@ -1205,15 +1211,16 @@ tree.insert(20, "twenty")
|
|
|
1205
1211
|
tree.insert(15, "fifteen")
|
|
1206
1212
|
|
|
1207
1213
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
1208
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1209
|
-
|
|
1214
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1215
|
+
mg.node_non_dunder_attributes(data)
|
|
1210
1216
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
1211
1217
|
|
|
1212
1218
|
mg.show(locals())
|
|
1213
1219
|
```
|
|
1214
|
-

|
|
1215
1220
|
|
|
1216
|
-
|
|
1221
|
+

|
|
1222
|
+
|
|
1223
|
+
Next figure out what the attributes are you actually want to graph and choose a Node type, there are four options:
|
|
1217
1224
|
|
|
1218
1225
|
## 1) Node_Leaf ##
|
|
1219
1226
|
Node_Leaf is a node with no children and shows just a single value.
|
|
@@ -1555,6 +1562,8 @@ mg.show(locals())
|
|
|
1555
1562
|
|
|
1556
1563
|
Or see it in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/mg_numpy.py&play).
|
|
1557
1564
|
|
|
1565
|
+
See this [introduction to numpy operations](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/numpy_operations.py×tep=0.5&play).
|
|
1566
|
+
|
|
1558
1567
|
## Pandas ##
|
|
1559
1568
|
For pandas types `Series` and `DataFrame`, use `mg.extend_pandas()`:
|
|
1560
1569
|
|
|
@@ -1171,7 +1171,13 @@ mg.show(locals())
|
|
|
1171
1171
|

|
|
1172
1172
|
|
|
1173
1173
|
## All attributes using dir() ##
|
|
1174
|
-
|
|
1174
|
+
Then first give it some color, show the its attributes using either of:
|
|
1175
|
+
|
|
1176
|
+
- mg.node_all_attributes(data)
|
|
1177
|
+
- mg.node_non_callable_attributes(data)
|
|
1178
|
+
- mg.node_non_dunder_attributes(data)
|
|
1179
|
+
|
|
1180
|
+
and set an empty Slicer to see all attributes.
|
|
1175
1181
|
|
|
1176
1182
|
```python
|
|
1177
1183
|
import memory_graph as mg
|
|
@@ -1185,15 +1191,16 @@ tree.insert(20, "twenty")
|
|
|
1185
1191
|
tree.insert(15, "fifteen")
|
|
1186
1192
|
|
|
1187
1193
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
1188
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1189
|
-
|
|
1194
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1195
|
+
mg.node_non_dunder_attributes(data)
|
|
1190
1196
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
1191
1197
|
|
|
1192
1198
|
mg.show(locals())
|
|
1193
1199
|
```
|
|
1194
|
-

|
|
1195
1200
|
|
|
1196
|
-
|
|
1201
|
+

|
|
1202
|
+
|
|
1203
|
+
Next figure out what the attributes are you actually want to graph and choose a Node type, there are four options:
|
|
1197
1204
|
|
|
1198
1205
|
## 1) Node_Leaf ##
|
|
1199
1206
|
Node_Leaf is a node with no children and shows just a single value.
|
|
@@ -1535,6 +1542,8 @@ mg.show(locals())
|
|
|
1535
1542
|
|
|
1536
1543
|
Or see it in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/mg_numpy.py&play).
|
|
1537
1544
|
|
|
1545
|
+
See this [introduction to numpy operations](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/numpy_operations.py×tep=0.5&play).
|
|
1546
|
+
|
|
1538
1547
|
## Pandas ##
|
|
1539
1548
|
For pandas types `Series` and `DataFrame`, use `mg.extend_pandas()`:
|
|
1540
1549
|
|
|
@@ -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.
|
|
5
|
+
__version__ = "0.3.89"
|
|
6
6
|
__author__ = 'Bas Terwijn'
|
|
7
7
|
|
|
8
8
|
import memory_graph.memory_to_nodes as memory_to_nodes
|
|
@@ -537,3 +537,15 @@ def collapse_type(type_name):
|
|
|
537
537
|
def reset_type(type_name):
|
|
538
538
|
del mg.config.type_to_node[type_name]
|
|
539
539
|
del mg.config.type_to_color[type_name]
|
|
540
|
+
|
|
541
|
+
# ------------ atributes to Node_Key_Value
|
|
542
|
+
|
|
543
|
+
def node_all_attributes(data):
|
|
544
|
+
return Node_Key_Value(data, [(attr, getattr(data, attr)) for attr in dir(data)])
|
|
545
|
+
|
|
546
|
+
def node_non_callable_attributes(data):
|
|
547
|
+
attr_values = [(attr, getattr(data, attr)) for attr in dir(data)]
|
|
548
|
+
return Node_Key_Value(data, [(attr, value) for attr, value in attr_values if not callable(value)])
|
|
549
|
+
|
|
550
|
+
def node_non_dunder_attributes(data):
|
|
551
|
+
return Node_Key_Value(data, [(attr, getattr(data, attr)) for attr in dir(data) if not attr.startswith('__')])
|
|
@@ -179,6 +179,11 @@ def reset():
|
|
|
179
179
|
call_stack: lambda data: Node_Key_Value(data, data.items()),
|
|
180
180
|
type: lambda data: Node_Key_Value(data, utils.filter_type_attributes(vars(data).items())),
|
|
181
181
|
range: lambda data: Node_Key_Value(data, {'start':data.start, 'stop':data.stop, 'step':data.step}.items()),
|
|
182
|
+
tuple: lambda data: (
|
|
183
|
+
Node_Key_Value(data, zip(data._fields, iter(data)))
|
|
184
|
+
if utils.is_namedtuple(data) else
|
|
185
|
+
Node_Linear(data, iter(data))
|
|
186
|
+
),
|
|
182
187
|
dict: lambda data: (
|
|
183
188
|
Node_Key_Value(data, utils.filter_dict(data) )
|
|
184
189
|
if dict in config.embedding_types else
|
|
@@ -165,6 +165,10 @@ def is_finite_iterable(data):
|
|
|
165
165
|
return True
|
|
166
166
|
except TypeError:
|
|
167
167
|
return False
|
|
168
|
+
|
|
169
|
+
def is_namedtuple(data):
|
|
170
|
+
""" Returns 'True' if 'data' is a namedtuple. """
|
|
171
|
+
return isinstance(data, tuple) and hasattr(data, '_fields')
|
|
168
172
|
|
|
169
173
|
def get_type_name(data):
|
|
170
174
|
""" Returns the name of the type of 'data'. """
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.89
|
|
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
|
|
@@ -1191,7 +1191,13 @@ mg.show(locals())
|
|
|
1191
1191
|

|
|
1192
1192
|
|
|
1193
1193
|
## All attributes using dir() ##
|
|
1194
|
-
|
|
1194
|
+
Then first give it some color, show the its attributes using either of:
|
|
1195
|
+
|
|
1196
|
+
- mg.node_all_attributes(data)
|
|
1197
|
+
- mg.node_non_callable_attributes(data)
|
|
1198
|
+
- mg.node_non_dunder_attributes(data)
|
|
1199
|
+
|
|
1200
|
+
and set an empty Slicer to see all attributes.
|
|
1195
1201
|
|
|
1196
1202
|
```python
|
|
1197
1203
|
import memory_graph as mg
|
|
@@ -1205,15 +1211,16 @@ tree.insert(20, "twenty")
|
|
|
1205
1211
|
tree.insert(15, "fifteen")
|
|
1206
1212
|
|
|
1207
1213
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
1208
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1209
|
-
|
|
1214
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1215
|
+
mg.node_non_dunder_attributes(data)
|
|
1210
1216
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
1211
1217
|
|
|
1212
1218
|
mg.show(locals())
|
|
1213
1219
|
```
|
|
1214
|
-

|
|
1215
1220
|
|
|
1216
|
-
|
|
1221
|
+

|
|
1222
|
+
|
|
1223
|
+
Next figure out what the attributes are you actually want to graph and choose a Node type, there are four options:
|
|
1217
1224
|
|
|
1218
1225
|
## 1) Node_Leaf ##
|
|
1219
1226
|
Node_Leaf is a node with no children and shows just a single value.
|
|
@@ -1555,6 +1562,8 @@ mg.show(locals())
|
|
|
1555
1562
|
|
|
1556
1563
|
Or see it in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/mg_numpy.py&play).
|
|
1557
1564
|
|
|
1565
|
+
See this [introduction to numpy operations](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/numpy_operations.py×tep=0.5&play).
|
|
1566
|
+
|
|
1558
1567
|
## Pandas ##
|
|
1559
1568
|
For pandas types `Series` and `DataFrame`, use `mg.extend_pandas()`:
|
|
1560
1569
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "memory_graph"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.89"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|