invocation-tree 0.0.36__tar.gz → 0.0.38__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.
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/PKG-INFO +1 -1
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree/__init__.py +53 -18
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree.egg-info/PKG-INFO +1 -1
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/pyproject.toml +1 -1
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/LICENSE.txt +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/README.md +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree/regex_set.py +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree.egg-info/SOURCES.txt +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree.egg-info/dependency_links.txt +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree.egg-info/requires.txt +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree.egg-info/top_level.txt +0 -0
- {invocation_tree-0.0.36 → invocation_tree-0.0.38}/setup.cfg +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2023, Bas Terwijn.
|
|
3
3
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
4
4
|
|
|
5
|
-
from graphviz import Digraph
|
|
5
|
+
from graphviz import Digraph, Source
|
|
6
6
|
import html
|
|
7
7
|
import sys
|
|
8
8
|
import difflib
|
|
@@ -10,7 +10,7 @@ import functools
|
|
|
10
10
|
|
|
11
11
|
import invocation_tree.regex_set as regset
|
|
12
12
|
|
|
13
|
-
__version__ = "0.0.
|
|
13
|
+
__version__ = "0.0.38"
|
|
14
14
|
__author__ = 'Bas Terwijn'
|
|
15
15
|
|
|
16
16
|
# colors dark
|
|
@@ -27,6 +27,13 @@ color_paused_dark = '#779977'
|
|
|
27
27
|
color_active_dark = '#1d1d1d'
|
|
28
28
|
color_returned_dark = '#997777'
|
|
29
29
|
|
|
30
|
+
# color placeholders
|
|
31
|
+
foreground_color_PH = '<foreground_color_PH>'
|
|
32
|
+
background_color_PH = '<background_color_PH>'
|
|
33
|
+
color_paused_PH = '<color_paused_PH>'
|
|
34
|
+
color_active_PH = '<color_active_PH>'
|
|
35
|
+
color_returned_PH = '<color_returned_PH>'
|
|
36
|
+
|
|
30
37
|
|
|
31
38
|
def highlight_diff(str1, str2):
|
|
32
39
|
matcher = difflib.SequenceMatcher(None, str1, str2)
|
|
@@ -133,6 +140,7 @@ class Invocation_Tree:
|
|
|
133
140
|
self.is_highlighted = False
|
|
134
141
|
self.graph = None
|
|
135
142
|
self.prev_global_tracer = None
|
|
143
|
+
self.uncolored_graph = None
|
|
136
144
|
|
|
137
145
|
def __repr__(self):
|
|
138
146
|
return f'Invocation_Tree(filename={repr(self.filename)}, show={self.show}, block={self.block}, each_line={self.each_line}, gifcount={self.gifcount})'
|
|
@@ -224,14 +232,14 @@ class Invocation_Tree:
|
|
|
224
232
|
tree_node.is_returned = is_returned
|
|
225
233
|
return_value = tree_node.return_value
|
|
226
234
|
border = 1
|
|
227
|
-
color =
|
|
235
|
+
color = color_paused_PH
|
|
228
236
|
if active:
|
|
229
|
-
color =
|
|
237
|
+
color = color_active_PH
|
|
230
238
|
border = 3
|
|
231
239
|
if is_returned:
|
|
232
|
-
color =
|
|
233
|
-
alignment = 'ALIGN="
|
|
234
|
-
table = f'<\n<TABLE BORDER="{str(border)}" COLOR=
|
|
240
|
+
color = color_returned_PH
|
|
241
|
+
alignment = 'ALIGN="LEFT" BALIGN="LEFT"'
|
|
242
|
+
table = f'<\n<TABLE BORDER="{str(border)}" COLOR={foreground_color_PH} CELLBORDER="0" CELLSPACING="0" BGCOLOR={color}>\n <TR>'
|
|
235
243
|
class_fun_name = get_class_function_name(tree_node.frame)
|
|
236
244
|
local_vars = tree_node.frame.f_locals
|
|
237
245
|
hightlighted_content = self.get_hightlighted_content(tree_node, class_fun_name, class_fun_name, use_old_content)
|
|
@@ -270,29 +278,59 @@ class Invocation_Tree:
|
|
|
270
278
|
return '.'.join(splits)
|
|
271
279
|
return self.filename
|
|
272
280
|
|
|
273
|
-
def
|
|
281
|
+
def graph_header(self):
|
|
274
282
|
graphviz_graph_attr = {
|
|
275
283
|
'fontname': self.fontname,
|
|
276
284
|
'fontsize': str(self.fontsize),
|
|
277
|
-
'fontcolor':
|
|
278
|
-
'bgcolor':
|
|
285
|
+
'fontcolor': foreground_color_PH,
|
|
286
|
+
'bgcolor': background_color_PH,
|
|
279
287
|
}
|
|
280
288
|
graphviz_node_attr = {
|
|
281
289
|
'fontname': self.fontname,
|
|
282
290
|
'fontsize': str(self.fontsize),
|
|
283
291
|
'shape':'plaintext',
|
|
284
|
-
'fontcolor':
|
|
292
|
+
'fontcolor': foreground_color_PH
|
|
285
293
|
}
|
|
286
294
|
graphviz_edge_attr = {
|
|
287
295
|
'fontname': self.fontname,
|
|
288
296
|
'fontsize': str(self.fontsize),
|
|
289
|
-
'fontcolor':
|
|
290
|
-
'color':
|
|
297
|
+
'fontcolor': foreground_color_PH,
|
|
298
|
+
'color': foreground_color_PH
|
|
291
299
|
}
|
|
292
300
|
graph = Digraph('invocation_tree',
|
|
293
301
|
graph_attr=graphviz_graph_attr,
|
|
294
302
|
node_attr=graphviz_node_attr,
|
|
295
303
|
edge_attr=graphviz_edge_attr)
|
|
304
|
+
return graph
|
|
305
|
+
|
|
306
|
+
def build_graph_from_nodes(self):
|
|
307
|
+
# add nodes and edges to graph
|
|
308
|
+
graph = self.graph_header()
|
|
309
|
+
for nid, table in self.node_id_to_table.items():
|
|
310
|
+
graph.node(nid, label=table)
|
|
311
|
+
for nid1, nid2 in self.edges:
|
|
312
|
+
graph.edge(nid1, nid2)
|
|
313
|
+
return graph
|
|
314
|
+
|
|
315
|
+
def recolor_last_graph(self):
|
|
316
|
+
if not self.uncolored_graph:
|
|
317
|
+
return self.uncolored_graph
|
|
318
|
+
graph_str = self.uncolored_graph.source
|
|
319
|
+
|
|
320
|
+
def replace_color(token, value):
|
|
321
|
+
return graph_str.replace(f'{token}', f'"{value}"')
|
|
322
|
+
|
|
323
|
+
graph_str = replace_color(foreground_color_PH, self.foreground_color)
|
|
324
|
+
graph_str = replace_color(background_color_PH, self.background_color)
|
|
325
|
+
graph_str = replace_color(color_paused_PH, self.color_paused)
|
|
326
|
+
graph_str = replace_color(color_active_PH, self.color_active)
|
|
327
|
+
graph_str = replace_color(color_returned_PH, self.color_returned)
|
|
328
|
+
graph = Source(graph_str)
|
|
329
|
+
graph.engine = self.uncolored_graph.engine
|
|
330
|
+
graph.format = self.uncolored_graph.format
|
|
331
|
+
return graph
|
|
332
|
+
|
|
333
|
+
def create_graph(self):
|
|
296
334
|
# update returned nodes
|
|
297
335
|
for node in self.prev_returned:
|
|
298
336
|
self.update_node(node, use_old_content=True)
|
|
@@ -312,11 +350,8 @@ class Invocation_Tree:
|
|
|
312
350
|
self.update_node(node, active=False, use_old_content=True)
|
|
313
351
|
self.prev_paused = self.paused.copy()
|
|
314
352
|
self.paused = []
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
graph.node(nid, label=table)
|
|
318
|
-
for nid1, nid2 in self.edges:
|
|
319
|
-
graph.edge(nid1, nid2)
|
|
353
|
+
self.uncolored_graph = self.build_graph_from_nodes()
|
|
354
|
+
graph = self.recolor_last_graph()
|
|
320
355
|
return graph
|
|
321
356
|
|
|
322
357
|
def render_graph(self, graph):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invocation_tree-0.0.36 → invocation_tree-0.0.38}/invocation_tree.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|