memory-graph 0.3.91__tar.gz → 0.3.93__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 (43) hide show
  1. {memory_graph-0.3.91 → memory_graph-0.3.93}/PKG-INFO +5 -4
  2. {memory_graph-0.3.91 → memory_graph-0.3.93}/README.md +4 -3
  3. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/__init__.py +1 -1
  4. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/extension_sqlite3.py +45 -30
  5. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/memory_to_nodes.py +17 -3
  6. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/sequence.py +2 -0
  7. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph.egg-info/PKG-INFO +5 -4
  8. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph.egg-info/SOURCES.txt +0 -1
  9. {memory_graph-0.3.91 → memory_graph-0.3.93}/pyproject.toml +1 -1
  10. memory_graph-0.3.91/setup.py +0 -7
  11. {memory_graph-0.3.91 → memory_graph-0.3.93}/LICENSE.txt +0 -0
  12. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/call_stack.py +0 -0
  13. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/config.py +0 -0
  14. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/config_default.py +0 -0
  15. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/config_helpers.py +0 -0
  16. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/extension_numpy.py +0 -0
  17. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/extension_pandas.py +0 -0
  18. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/extension_polars.py +0 -0
  19. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/extension_torch.py +0 -0
  20. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/html_table.py +0 -0
  21. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/list_view.py +0 -0
  22. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/node_base.py +0 -0
  23. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/node_key_value.py +0 -0
  24. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/node_leaf.py +0 -0
  25. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/node_linear.py +0 -0
  26. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/node_table.py +0 -0
  27. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/slicer.py +0 -0
  28. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/slices.py +0 -0
  29. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/slices_iterator.py +0 -0
  30. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/slices_table_iterator.py +0 -0
  31. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test.py +0 -0
  32. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_max_graph_depth.py +0 -0
  33. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_memory_graph.py +0 -0
  34. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_memory_to_nodes.py +0 -0
  35. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_sequence.py +0 -0
  36. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_slicer.py +0 -0
  37. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_slices.py +0 -0
  38. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/test_slices_iterator.py +0 -0
  39. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph/utils.py +0 -0
  40. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph.egg-info/dependency_links.txt +0 -0
  41. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph.egg-info/requires.txt +0 -0
  42. {memory_graph-0.3.91 → memory_graph-0.3.93}/memory_graph.egg-info/top_level.txt +0 -0
  43. {memory_graph-0.3.91 → memory_graph-0.3.93}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memory_graph
3
- Version: 0.3.91
3
+ Version: 0.3.93
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
@@ -1574,7 +1574,7 @@ mg.show(locals())
1574
1574
  ```
1575
1575
  ![extension_numpy.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_numpy.png)
1576
1576
 
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).
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&timestep=0.5&play).
1578
1578
 
1579
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&timestep=0.5&play).
1580
1580
 
@@ -1597,9 +1597,9 @@ mg.show(locals())
1597
1597
  ```
1598
1598
  ![extension_pandas.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_pandas.png)
1599
1599
 
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).
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&timestep=0.5&play).
1601
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&timestep=0.5&play).
1602
+ See this [introduction to Pandas operations](https://memory-graph.com/#micropip=numpy,pandas&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/pandas_operations.py&timestep=0.5&play).
1603
1603
 
1604
1604
  ## Polars ##
1605
1605
  For Polars types `DataFrame`, use `mg.extend_polars()`:
@@ -1671,6 +1671,7 @@ conn.close()
1671
1671
  ```
1672
1672
  ![extension_sqlite3.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_sqlite3.png)
1673
1673
 
1674
+ Or see this larger example in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=sqlite3&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/sqlite3_example.py&timestep=0.2&play).
1674
1675
 
1675
1676
  # Memory Graph Web Debugger #
1676
1677
  The <a href="https://memory-graph.com/#play" target="_blank">Memory Graph Web Debugger</a> lets us use memory_graph without any installation.
@@ -1554,7 +1554,7 @@ mg.show(locals())
1554
1554
  ```
1555
1555
  ![extension_numpy.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_numpy.png)
1556
1556
 
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).
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&timestep=0.5&play).
1558
1558
 
1559
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&timestep=0.5&play).
1560
1560
 
@@ -1577,9 +1577,9 @@ mg.show(locals())
1577
1577
  ```
1578
1578
  ![extension_pandas.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_pandas.png)
1579
1579
 
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).
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&timestep=0.5&play).
1581
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&timestep=0.5&play).
1582
+ See this [introduction to Pandas operations](https://memory-graph.com/#micropip=numpy,pandas&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/pandas_operations.py&timestep=0.5&play).
1583
1583
 
1584
1584
  ## Polars ##
1585
1585
  For Polars types `DataFrame`, use `mg.extend_polars()`:
@@ -1651,6 +1651,7 @@ conn.close()
1651
1651
  ```
1652
1652
  ![extension_sqlite3.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_sqlite3.png)
1653
1653
 
1654
+ Or see this larger example in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=sqlite3&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/sqlite3_example.py&timestep=0.2&play).
1654
1655
 
1655
1656
  # Memory Graph Web Debugger #
1656
1657
  The <a href="https://memory-graph.com/#play" target="_blank">Memory Graph Web Debugger</a> lets us use memory_graph without any installation.
@@ -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.91"
5
+ __version__ = "0.3.93"
6
6
  __author__ = 'Bas Terwijn'
7
7
 
8
8
  import memory_graph.memory_to_nodes as memory_to_nodes
@@ -2,7 +2,7 @@
2
2
  # Copyright (c) 2023, Bas Terwijn.
3
3
  # SPDX-License-Identifier: BSD-2-Clause
4
4
 
5
- """ Extension to add the memory graph configuration for Numpy types. """
5
+ """ Extension to add the memory graph configuration for SQLite3 types. """
6
6
  from memory_graph.node_key_value import Node_Key_Value
7
7
  from memory_graph.node_table import Node_Table
8
8
 
@@ -50,38 +50,53 @@ def get_table(conn, table_name):
50
50
 
51
51
 
52
52
  def get_tables(conn):
53
- table_names = (
54
- row[0] for row in conn.execute(
55
- "SELECT name FROM sqlite_master "
56
- "WHERE type = 'table' AND name NOT LIKE 'sqlite_%'"
53
+ import sqlite3
54
+ try:
55
+ table_names = (
56
+ row[0] for row in conn.execute(
57
+ "SELECT name FROM sqlite_master "
58
+ "WHERE type = 'table' AND name NOT LIKE 'sqlite_%'"
59
+ )
57
60
  )
58
- )
59
- tables = {name: get_table(conn, name) for name in table_names}
60
- return tables
61
-
61
+ tables = {name: get_table(conn, name) for name in table_names}
62
+ return tables
63
+ except sqlite3.Error as e:
64
+ typename= type(e).__name__
65
+ error_msg = str(e)
66
+ tables = {typename: error_msg}
67
+ return tables
62
68
 
63
69
  def sqlite_table_node(d):
64
- headers = []
65
- for name in d.header:
66
- labels = []
67
- # Declared SQLite column type
68
- column_type = d.column_types.get(name)
69
- if column_type:
70
- labels.append(column_type)
71
- # Primary key
72
- if name in d.primary_keys:
73
- labels.append("PK")
74
- # Foreign key
75
- if any(fk[0] == name for fk in d.foreign_keys):
76
- labels.append("FK")
77
-
78
- suffix = f" ({', '.join(labels)})" if labels else ""
79
- headers.append(name + suffix)
80
- return Node_Table(
81
- d,
82
- list(d.rows),
83
- col_names=headers
84
- )
70
+ import sqlite3
71
+ try:
72
+ headers = []
73
+ for name in d.header:
74
+ labels = []
75
+ # Declared SQLite column type
76
+ column_type = d.column_types.get(name)
77
+ if column_type:
78
+ labels.append(column_type)
79
+ # Primary key
80
+ if name in d.primary_keys:
81
+ labels.append("PK")
82
+ # Foreign key
83
+ if any(fk[0] == name for fk in d.foreign_keys):
84
+ labels.append("FK")
85
+
86
+ suffix = f" ({', '.join(labels)})" if labels else ""
87
+ headers.append(name + suffix)
88
+ return Node_Table(
89
+ d,
90
+ list(d.rows),
91
+ col_names=headers
92
+ )
93
+ except sqlite3.Error as e:
94
+ typename= type(e).__name__
95
+ error_msg = str(e)
96
+ return Node_Table(
97
+ d,
98
+ [[typename, error_msg]],
99
+ )
85
100
 
86
101
  def extend_sqlite3():
87
102
  import sqlite3
@@ -262,9 +262,23 @@ def memory_to_nodes(data):
262
262
  id_to_slices = add_missing_edges(nodes, id_to_slices, config.max_missing_edges)
263
263
  #print('id_to_slices:',id_to_slices)
264
264
  embed_keys_in_key_value_nodes(nodes, nodes_key_value, id_to_slices)
265
- graphviz_graph_attr = {'fontname': config.fontname, 'fontsize': config.fontsize, 'fontcolor': config.foreground_color, 'bgcolor': config.background_color}
266
- graphviz_node_attr = {'fontname': config.fontname, 'fontsize': config.fontsize, 'shape': 'plaintext', 'fontcolor': config.foreground_color}
267
- graphviz_edge_attr = {'fontname': config.fontname, 'fontsize': config.fontsize, 'fontcolor': config.foreground_color, 'color': config.foreground_color}
265
+ graphviz_graph_attr = {'fontname': config.fontname,
266
+ 'fontsize': config.fontsize,
267
+ 'fontcolor': config.foreground_color,
268
+ 'bgcolor': config.background_color,
269
+ #'splines': 'polyline',
270
+ #'ordering': 'out',
271
+ }
272
+ graphviz_node_attr = {'fontname': config.fontname,
273
+ 'fontsize': config.fontsize,
274
+ 'shape': 'plaintext',
275
+ 'fontcolor': config.foreground_color
276
+ }
277
+ graphviz_edge_attr = {'fontname': config.fontname,
278
+ 'fontsize': config.fontsize,
279
+ 'fontcolor': config.foreground_color,
280
+ 'color': config.foreground_color
281
+ }
268
282
  graphviz_graph=graphviz.Digraph('memory_graph',
269
283
  graph_attr=graphviz_graph_attr,
270
284
  node_attr=graphviz_node_attr,
@@ -55,6 +55,8 @@ class Sequence1D(Sequence):
55
55
  return Slices1D()
56
56
 
57
57
  def slice(self, slicer):
58
+ if type(slicer) is tuple: # (row, column) slicer for a type that is sometimes 1D, use the first
59
+ slicer = slicer[0]
58
60
  return slicer.get_slices( len(self.data) )
59
61
 
60
62
  def indices_all(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memory_graph
3
- Version: 0.3.91
3
+ Version: 0.3.93
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
@@ -1574,7 +1574,7 @@ mg.show(locals())
1574
1574
  ```
1575
1575
  ![extension_numpy.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_numpy.png)
1576
1576
 
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).
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&timestep=0.5&play).
1578
1578
 
1579
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&timestep=0.5&play).
1580
1580
 
@@ -1597,9 +1597,9 @@ mg.show(locals())
1597
1597
  ```
1598
1598
  ![extension_pandas.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_pandas.png)
1599
1599
 
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).
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&timestep=0.5&play).
1601
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&timestep=0.5&play).
1602
+ See this [introduction to Pandas operations](https://memory-graph.com/#micropip=numpy,pandas&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/pandas_operations.py&timestep=0.5&play).
1603
1603
 
1604
1604
  ## Polars ##
1605
1605
  For Polars types `DataFrame`, use `mg.extend_polars()`:
@@ -1671,6 +1671,7 @@ conn.close()
1671
1671
  ```
1672
1672
  ![extension_sqlite3.png](https://raw.githubusercontent.com/bterwijn/memory_graph/main/images/extension_sqlite3.png)
1673
1673
 
1674
+ Or see this larger example in the [Memory Graph Web Debugger](https://memory-graph.com/#micropip=sqlite3&codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/sqlite3_example.py&timestep=0.2&play).
1674
1675
 
1675
1676
  # Memory Graph Web Debugger #
1676
1677
  The <a href="https://memory-graph.com/#play" target="_blank">Memory Graph Web Debugger</a> lets us use memory_graph without any installation.
@@ -1,7 +1,6 @@
1
1
  LICENSE.txt
2
2
  README.md
3
3
  pyproject.toml
4
- setup.py
5
4
  memory_graph/__init__.py
6
5
  memory_graph/call_stack.py
7
6
  memory_graph/config.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "memory_graph"
7
- version = "0.3.91"
7
+ version = "0.3.93"
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"}
@@ -1,7 +0,0 @@
1
- from setuptools import setup
2
-
3
- setup(
4
- name="memory-graph",
5
- version="0.3.30",
6
- packages=["memory_graph"],
7
- )
File without changes
File without changes