memory-graph 0.3.89__tar.gz → 0.3.90__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.89 → memory_graph-0.3.90}/PKG-INFO +26 -10
- {memory_graph-0.3.89 → memory_graph-0.3.90}/README.md +25 -9
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/__init__.py +21 -10
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/utils.py +9 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph.egg-info/PKG-INFO +26 -10
- {memory_graph-0.3.89 → memory_graph-0.3.90}/pyproject.toml +1 -1
- {memory_graph-0.3.89 → memory_graph-0.3.90}/LICENSE.txt +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/call_stack.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/config.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/config_default.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/config_helpers.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/extension_numpy.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/extension_pandas.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/extension_torch.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/html_table.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/list_view.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/memory_to_nodes.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/node_base.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/node_key_value.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/node_leaf.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/node_linear.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/node_table.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/sequence.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/slicer.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/slices.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/slices_iterator.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/slices_table_iterator.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_max_graph_depth.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_memory_graph.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_memory_to_nodes.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_sequence.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_slicer.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_slices.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph/test_slices_iterator.py +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph.egg-info/SOURCES.txt +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph.egg-info/dependency_links.txt +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph.egg-info/requires.txt +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/memory_graph.egg-info/top_level.txt +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/setup.cfg +0 -0
- {memory_graph-0.3.89 → memory_graph-0.3.90}/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.90
|
|
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
|
|
@@ -1190,14 +1190,28 @@ mg.show(locals())
|
|
|
1190
1190
|
```
|
|
1191
1191
|

|
|
1192
1192
|
|
|
1193
|
-
##
|
|
1194
|
-
Then first give it some color, show
|
|
1193
|
+
## Show attributes using build_node() ##
|
|
1194
|
+
Then first give it some color, show its attributes using:
|
|
1195
1195
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1196
|
+
```python
|
|
1197
|
+
mg.build_node(data)
|
|
1198
|
+
```
|
|
1199
1199
|
|
|
1200
|
-
|
|
1200
|
+
optionally filter attributes using:
|
|
1201
|
+
|
|
1202
|
+
```python
|
|
1203
|
+
mg.build_node(data,
|
|
1204
|
+
filters=[mg.filter_non_callable,
|
|
1205
|
+
mg.filter_non_dunder,
|
|
1206
|
+
mg.filter_non_underscore
|
|
1207
|
+
mg.filter_names({'left', 'right'}),
|
|
1208
|
+
lambda kvs : ((k,v) for k,v in kvs
|
|
1209
|
+
if k in {'left', 'right'} and
|
|
1210
|
+
not callable(v))
|
|
1211
|
+
])
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
and set an empty Slicer to show all attributes even if the sequence is long.
|
|
1201
1215
|
|
|
1202
1216
|
```python
|
|
1203
1217
|
import memory_graph as mg
|
|
@@ -1211,8 +1225,8 @@ tree.insert(20, "twenty")
|
|
|
1211
1225
|
tree.insert(15, "fifteen")
|
|
1212
1226
|
|
|
1213
1227
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
1214
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1215
|
-
|
|
1228
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.build_node(data,
|
|
1229
|
+
filters=[mg.filter_non_dunder])
|
|
1216
1230
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
1217
1231
|
|
|
1218
1232
|
mg.show(locals())
|
|
@@ -1562,7 +1576,7 @@ mg.show(locals())
|
|
|
1562
1576
|
|
|
1563
1577
|
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).
|
|
1564
1578
|
|
|
1565
|
-
See this [introduction to
|
|
1579
|
+
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
1580
|
|
|
1567
1581
|
## Pandas ##
|
|
1568
1582
|
For pandas types `Series` and `DataFrame`, use `mg.extend_pandas()`:
|
|
@@ -1585,6 +1599,8 @@ mg.show(locals())
|
|
|
1585
1599
|
|
|
1586
1600
|
Or see it in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=pandas&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/mg_pandas.py&play).
|
|
1587
1601
|
|
|
1602
|
+
See this [introduction to Pandas operations](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/pandas_operations.py×tep=0.5&play).
|
|
1603
|
+
|
|
1588
1604
|
## PyTorch ##
|
|
1589
1605
|
For torch type `tensor`, use `mg.extend_torch()`:
|
|
1590
1606
|
|
|
@@ -1170,14 +1170,28 @@ mg.show(locals())
|
|
|
1170
1170
|
```
|
|
1171
1171
|

|
|
1172
1172
|
|
|
1173
|
-
##
|
|
1174
|
-
Then first give it some color, show
|
|
1173
|
+
## Show attributes using build_node() ##
|
|
1174
|
+
Then first give it some color, show its attributes using:
|
|
1175
1175
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1176
|
+
```python
|
|
1177
|
+
mg.build_node(data)
|
|
1178
|
+
```
|
|
1179
1179
|
|
|
1180
|
-
|
|
1180
|
+
optionally filter attributes using:
|
|
1181
|
+
|
|
1182
|
+
```python
|
|
1183
|
+
mg.build_node(data,
|
|
1184
|
+
filters=[mg.filter_non_callable,
|
|
1185
|
+
mg.filter_non_dunder,
|
|
1186
|
+
mg.filter_non_underscore
|
|
1187
|
+
mg.filter_names({'left', 'right'}),
|
|
1188
|
+
lambda kvs : ((k,v) for k,v in kvs
|
|
1189
|
+
if k in {'left', 'right'} and
|
|
1190
|
+
not callable(v))
|
|
1191
|
+
])
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
and set an empty Slicer to show all attributes even if the sequence is long.
|
|
1181
1195
|
|
|
1182
1196
|
```python
|
|
1183
1197
|
import memory_graph as mg
|
|
@@ -1191,8 +1205,8 @@ tree.insert(20, "twenty")
|
|
|
1191
1205
|
tree.insert(15, "fifteen")
|
|
1192
1206
|
|
|
1193
1207
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
1194
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1195
|
-
|
|
1208
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.build_node(data,
|
|
1209
|
+
filters=[mg.filter_non_dunder])
|
|
1196
1210
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
1197
1211
|
|
|
1198
1212
|
mg.show(locals())
|
|
@@ -1542,7 +1556,7 @@ mg.show(locals())
|
|
|
1542
1556
|
|
|
1543
1557
|
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).
|
|
1544
1558
|
|
|
1545
|
-
See this [introduction to
|
|
1559
|
+
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
1560
|
|
|
1547
1561
|
## Pandas ##
|
|
1548
1562
|
For pandas types `Series` and `DataFrame`, use `mg.extend_pandas()`:
|
|
@@ -1565,6 +1579,8 @@ mg.show(locals())
|
|
|
1565
1579
|
|
|
1566
1580
|
Or see it in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=pandas&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/mg_pandas.py&play).
|
|
1567
1581
|
|
|
1582
|
+
See this [introduction to Pandas operations](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/pandas_operations.py×tep=0.5&play).
|
|
1583
|
+
|
|
1568
1584
|
## PyTorch ##
|
|
1569
1585
|
For torch type `tensor`, use `mg.extend_torch()`:
|
|
1570
1586
|
|
|
@@ -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.90"
|
|
6
6
|
__author__ = 'Bas Terwijn'
|
|
7
7
|
|
|
8
8
|
import memory_graph.memory_to_nodes as memory_to_nodes
|
|
@@ -540,12 +540,23 @@ def reset_type(type_name):
|
|
|
540
540
|
|
|
541
541
|
# ------------ atributes to Node_Key_Value
|
|
542
542
|
|
|
543
|
-
def
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
return Node_Key_Value(data,
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
543
|
+
def build_node(data, filters=None):
|
|
544
|
+
attr_values = ((attr, utils.safe_getattr(data, attr)) for attr in dir(data))
|
|
545
|
+
if filters is not None:
|
|
546
|
+
for filter in filters:
|
|
547
|
+
attr_values = filter(attr_values)
|
|
548
|
+
return Node_Key_Value(data, ((attr, value)
|
|
549
|
+
for attr, value in attr_values
|
|
550
|
+
if value is not utils.SENTINEL
|
|
551
|
+
))
|
|
552
|
+
|
|
553
|
+
def filter_non_callable(tuples):
|
|
554
|
+
return ((k,v) for k, v in tuples if not callable(v))
|
|
555
|
+
def filter_non_dunder(tuples):
|
|
556
|
+
return ((k,v) for k, v in tuples if not k.startswith('__'))
|
|
557
|
+
def filter_non_underscore(tuples):
|
|
558
|
+
return ((k,v) for k, v in tuples if not k.startswith('_'))
|
|
559
|
+
def filter_names(names):
|
|
560
|
+
def filter(tuples):
|
|
561
|
+
return ((k,v) for k, v in tuples if k in names)
|
|
562
|
+
return filter
|
|
@@ -11,6 +11,14 @@ import html
|
|
|
11
11
|
|
|
12
12
|
import memory_graph.config as config
|
|
13
13
|
|
|
14
|
+
SENTINEL = object()
|
|
15
|
+
|
|
16
|
+
def safe_getattr(obj, attr):
|
|
17
|
+
try:
|
|
18
|
+
return getattr(obj, attr, SENTINEL)
|
|
19
|
+
except Exception:
|
|
20
|
+
return SENTINEL
|
|
21
|
+
|
|
14
22
|
class Base_Str():
|
|
15
23
|
def __init__(self, s):
|
|
16
24
|
self.s = s
|
|
@@ -198,3 +206,4 @@ def generator_has_data(generator):
|
|
|
198
206
|
return True
|
|
199
207
|
except StopIteration:
|
|
200
208
|
return False
|
|
209
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.90
|
|
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
|
|
@@ -1190,14 +1190,28 @@ mg.show(locals())
|
|
|
1190
1190
|
```
|
|
1191
1191
|

|
|
1192
1192
|
|
|
1193
|
-
##
|
|
1194
|
-
Then first give it some color, show
|
|
1193
|
+
## Show attributes using build_node() ##
|
|
1194
|
+
Then first give it some color, show its attributes using:
|
|
1195
1195
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1196
|
+
```python
|
|
1197
|
+
mg.build_node(data)
|
|
1198
|
+
```
|
|
1199
1199
|
|
|
1200
|
-
|
|
1200
|
+
optionally filter attributes using:
|
|
1201
|
+
|
|
1202
|
+
```python
|
|
1203
|
+
mg.build_node(data,
|
|
1204
|
+
filters=[mg.filter_non_callable,
|
|
1205
|
+
mg.filter_non_dunder,
|
|
1206
|
+
mg.filter_non_underscore
|
|
1207
|
+
mg.filter_names({'left', 'right'}),
|
|
1208
|
+
lambda kvs : ((k,v) for k,v in kvs
|
|
1209
|
+
if k in {'left', 'right'} and
|
|
1210
|
+
not callable(v))
|
|
1211
|
+
])
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
and set an empty Slicer to show all attributes even if the sequence is long.
|
|
1201
1215
|
|
|
1202
1216
|
```python
|
|
1203
1217
|
import memory_graph as mg
|
|
@@ -1211,8 +1225,8 @@ tree.insert(20, "twenty")
|
|
|
1211
1225
|
tree.insert(15, "fifteen")
|
|
1212
1226
|
|
|
1213
1227
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
1214
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data:
|
|
1215
|
-
|
|
1228
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.build_node(data,
|
|
1229
|
+
filters=[mg.filter_non_dunder])
|
|
1216
1230
|
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
1217
1231
|
|
|
1218
1232
|
mg.show(locals())
|
|
@@ -1562,7 +1576,7 @@ mg.show(locals())
|
|
|
1562
1576
|
|
|
1563
1577
|
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).
|
|
1564
1578
|
|
|
1565
|
-
See this [introduction to
|
|
1579
|
+
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
1580
|
|
|
1567
1581
|
## Pandas ##
|
|
1568
1582
|
For pandas types `Series` and `DataFrame`, use `mg.extend_pandas()`:
|
|
@@ -1585,6 +1599,8 @@ mg.show(locals())
|
|
|
1585
1599
|
|
|
1586
1600
|
Or see it in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=pandas&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/mg_pandas.py&play).
|
|
1587
1601
|
|
|
1602
|
+
See this [introduction to Pandas operations](https://memory-graph.com/#micropip=numpy&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/pandas_operations.py×tep=0.5&play).
|
|
1603
|
+
|
|
1588
1604
|
## PyTorch ##
|
|
1589
1605
|
For torch type `tensor`, use `mg.extend_torch()`:
|
|
1590
1606
|
|
|
@@ -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.90"
|
|
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
|
|
File without changes
|