invocation-tree 0.0.20__tar.gz → 0.0.22__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.20/invocation_tree.egg-info → invocation_tree-0.0.22}/PKG-INFO +20 -6
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/README.md +19 -5
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/invocation_tree/__init__.py +24 -10
- {invocation_tree-0.0.20 → invocation_tree-0.0.22/invocation_tree.egg-info}/PKG-INFO +20 -6
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/pyproject.toml +1 -1
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/LICENSE.txt +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/MANIFEST.in +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/compute.gif +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/compute.py +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/create_gif.sh +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/create_images.sh +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/factorial.gif +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/factorial.py +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/permutations.gif +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/permutations.py +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/students.gif +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/students.py +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/images/vscode.png +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/invocation_tree.egg-info/SOURCES.txt +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/invocation_tree.egg-info/dependency_links.txt +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/invocation_tree.egg-info/requires.txt +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/invocation_tree.egg-info/top_level.txt +0 -0
- {invocation_tree-0.0.20 → invocation_tree-0.0.22}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: invocation_tree
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.22
|
|
4
4
|
Summary: Generates an invocation tree of functions calls.
|
|
5
5
|
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
6
|
License: BSD 2-Clause License
|
|
@@ -217,14 +217,28 @@ print(result) # all permutations of going Left or Right of length 2
|
|
|
217
217
|
['LL', 'LR', 'RL', 'RR']
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
##
|
|
221
|
-
|
|
220
|
+
## Hidding ##
|
|
221
|
+
It can be useful to hide certian variables or functions to avoid unnecessary complexity. This can for example be done with:
|
|
222
222
|
|
|
223
223
|
```python
|
|
224
224
|
tree = ivt.blocking()
|
|
225
|
-
tree.
|
|
226
|
-
tree.
|
|
227
|
-
tree.
|
|
225
|
+
tree.hide_vars.add('permutations.elements')
|
|
226
|
+
tree.hide_vars.add('permutations.element')
|
|
227
|
+
tree.hide_vars.add('permutations.all_perms')
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Or hide certain function calls:
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
tree = ivt.blocking()
|
|
234
|
+
tree.hide_calls.add('namespace.functionname')
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Or ignore certain function calls so that all it's children are hidden too:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
tree = ivt.blocking()
|
|
241
|
+
tree.ignore_calls.add('namespace.functionname')
|
|
228
242
|
```
|
|
229
243
|
|
|
230
244
|
# Configuration #
|
|
@@ -172,14 +172,28 @@ print(result) # all permutations of going Left or Right of length 2
|
|
|
172
172
|
['LL', 'LR', 'RL', 'RR']
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
##
|
|
176
|
-
|
|
175
|
+
## Hidding ##
|
|
176
|
+
It can be useful to hide certian variables or functions to avoid unnecessary complexity. This can for example be done with:
|
|
177
177
|
|
|
178
178
|
```python
|
|
179
179
|
tree = ivt.blocking()
|
|
180
|
-
tree.
|
|
181
|
-
tree.
|
|
182
|
-
tree.
|
|
180
|
+
tree.hide_vars.add('permutations.elements')
|
|
181
|
+
tree.hide_vars.add('permutations.element')
|
|
182
|
+
tree.hide_vars.add('permutations.all_perms')
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Or hide certain function calls:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
tree = ivt.blocking()
|
|
189
|
+
tree.hide_calls.add('namespace.functionname')
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Or ignore certain function calls so that all it's children are hidden too:
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
tree = ivt.blocking()
|
|
196
|
+
tree.ignore_calls.add('namespace.functionname')
|
|
183
197
|
```
|
|
184
198
|
|
|
185
199
|
# Configuration #
|
|
@@ -7,7 +7,7 @@ import html
|
|
|
7
7
|
import sys
|
|
8
8
|
import difflib
|
|
9
9
|
|
|
10
|
-
__version__ = "0.0.
|
|
10
|
+
__version__ = "0.0.22"
|
|
11
11
|
__author__ = 'Bas Terwijn'
|
|
12
12
|
|
|
13
13
|
def highlight_diff(str1, str2):
|
|
@@ -73,7 +73,7 @@ class Invocation_Tree:
|
|
|
73
73
|
color_active = '#ffffff',
|
|
74
74
|
color_returned = '#ffcccc',
|
|
75
75
|
to_string=None,
|
|
76
|
-
|
|
76
|
+
hide_vars=None,
|
|
77
77
|
cleanup=True,
|
|
78
78
|
quiet=True):
|
|
79
79
|
# --- config
|
|
@@ -93,9 +93,9 @@ class Invocation_Tree:
|
|
|
93
93
|
self.to_string = {}
|
|
94
94
|
if not to_string is None:
|
|
95
95
|
self.to_string = to_string
|
|
96
|
-
self.
|
|
97
|
-
if not
|
|
98
|
-
self.
|
|
96
|
+
self.hide_vars = set()
|
|
97
|
+
if not hide_vars is None:
|
|
98
|
+
self.hide_vars = hide_vars
|
|
99
99
|
self.cleanup = cleanup
|
|
100
100
|
self.quiet = quiet
|
|
101
101
|
# --- core
|
|
@@ -108,7 +108,9 @@ class Invocation_Tree:
|
|
|
108
108
|
self.is_highlighted = False
|
|
109
109
|
self.graph = None
|
|
110
110
|
self.prev_global_tracer = None
|
|
111
|
-
self.
|
|
111
|
+
self.hide_calls = {'Invocation_Tree.__exit__', 'Invocation_Tree.stop_trace'}
|
|
112
|
+
self.ignore_calls = set()
|
|
113
|
+
self.ignoring_call = None
|
|
112
114
|
|
|
113
115
|
def __repr__(self):
|
|
114
116
|
return f'Invocation_Tree(filename={repr(self.filename)}, show={self.show}, block={self.block}, each_line={self.each_line}, gifcount={self.gifcount})'
|
|
@@ -177,7 +179,7 @@ class Invocation_Tree:
|
|
|
177
179
|
for var,val in local_vars.items():
|
|
178
180
|
var_name = class_fun_name+'..'+var
|
|
179
181
|
val_name = class_fun_name+'.'+var
|
|
180
|
-
if filter_variables(var,val) and not val_name in self.
|
|
182
|
+
if filter_variables(var,val) and not val_name in self.hide_vars:
|
|
181
183
|
table += '</TR>\n <TR>'
|
|
182
184
|
hightlighted_var = self.get_hightlighted_content(tree_node, var_name, var, use_old_content)
|
|
183
185
|
hightlighted_val = self.get_hightlighted_content(tree_node, val_name, val, use_old_content, use_repr=True)
|
|
@@ -185,7 +187,7 @@ class Invocation_Tree:
|
|
|
185
187
|
table += '<TD ALIGN="left">'+ hightlighted_content +'</TD>'
|
|
186
188
|
if is_returned:
|
|
187
189
|
return_name = class_fun_name+'.return'
|
|
188
|
-
if not return_name in self.
|
|
190
|
+
if not return_name in self.hide_vars:
|
|
189
191
|
table += '</TR>\n <TR>'
|
|
190
192
|
hightlighted_content = self.get_hightlighted_content(tree_node, return_name, return_value, use_old_content, use_repr=True)
|
|
191
193
|
table += '<TD ALIGN="left">'+ 'return ' + hightlighted_content +'</TD>'
|
|
@@ -259,14 +261,24 @@ class Invocation_Tree:
|
|
|
259
261
|
|
|
260
262
|
def trace(self, frame, event, arg):
|
|
261
263
|
class_fun_name = get_class_function_name(frame)
|
|
262
|
-
if not class_fun_name in self.
|
|
264
|
+
if not class_fun_name in self.hide_calls:
|
|
265
|
+
skip_return = False
|
|
266
|
+
if event == 'call':
|
|
267
|
+
if class_fun_name in self.ignore_calls:
|
|
268
|
+
self.ignoring_call = class_fun_name
|
|
269
|
+
elif event == 'return':
|
|
270
|
+
if class_fun_name == self.ignoring_call:
|
|
271
|
+
self.ignoring_call = None
|
|
272
|
+
skip_return = True
|
|
273
|
+
if self.ignoring_call is not None:
|
|
274
|
+
return
|
|
263
275
|
if event == 'call':
|
|
264
276
|
self.stack.append(Tree_Node(self.node_id, frame, None))
|
|
265
277
|
self.node_id += 1
|
|
266
278
|
if len(self.stack)>1:
|
|
267
279
|
self.add_edge(self.stack[-2], self.stack[-1])
|
|
268
280
|
self.output_graph(frame, event)
|
|
269
|
-
elif event == 'return':
|
|
281
|
+
elif event == 'return' and not skip_return:
|
|
270
282
|
self.stack[-1].return_value = arg
|
|
271
283
|
self.returned.append(self.stack.pop())
|
|
272
284
|
self.output_graph(frame, event)
|
|
@@ -291,6 +303,8 @@ class Invocation_Tree:
|
|
|
291
303
|
if prev_local_tracer is not None:
|
|
292
304
|
# call previous local tracer if any existed and update it
|
|
293
305
|
prev_local_tracer = prev_local_tracer(frame, event, arg)
|
|
306
|
+
if prev_local_tracer is None:
|
|
307
|
+
return None # stop tracing if debugger stopped tracing
|
|
294
308
|
return local_multiplexer
|
|
295
309
|
|
|
296
310
|
return local_multiplexer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: invocation_tree
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.22
|
|
4
4
|
Summary: Generates an invocation tree of functions calls.
|
|
5
5
|
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
6
|
License: BSD 2-Clause License
|
|
@@ -217,14 +217,28 @@ print(result) # all permutations of going Left or Right of length 2
|
|
|
217
217
|
['LL', 'LR', 'RL', 'RR']
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
##
|
|
221
|
-
|
|
220
|
+
## Hidding ##
|
|
221
|
+
It can be useful to hide certian variables or functions to avoid unnecessary complexity. This can for example be done with:
|
|
222
222
|
|
|
223
223
|
```python
|
|
224
224
|
tree = ivt.blocking()
|
|
225
|
-
tree.
|
|
226
|
-
tree.
|
|
227
|
-
tree.
|
|
225
|
+
tree.hide_vars.add('permutations.elements')
|
|
226
|
+
tree.hide_vars.add('permutations.element')
|
|
227
|
+
tree.hide_vars.add('permutations.all_perms')
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Or hide certain function calls:
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
tree = ivt.blocking()
|
|
234
|
+
tree.hide_calls.add('namespace.functionname')
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Or ignore certain function calls so that all it's children are hidden too:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
tree = ivt.blocking()
|
|
241
|
+
tree.ignore_calls.add('namespace.functionname')
|
|
228
242
|
```
|
|
229
243
|
|
|
230
244
|
# Configuration #
|
|
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
|
{invocation_tree-0.0.20 → invocation_tree-0.0.22}/invocation_tree.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|