invocation-tree 0.0.15__tar.gz → 0.0.16__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.15/invocation_tree.egg-info → invocation_tree-0.0.16}/PKG-INFO +29 -4
- invocation_tree-0.0.16/images/compute.gif +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/create_gif.sh +8 -2
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/create_images.sh +4 -4
- invocation_tree-0.0.16/images/factorial.gif +0 -0
- invocation_tree-0.0.16/images/permutations.gif +0 -0
- invocation_tree-0.0.16/images/students.gif +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/invocation_tree/__init__.py +17 -6
- {invocation_tree-0.0.15 → invocation_tree-0.0.16/invocation_tree.egg-info}/PKG-INFO +29 -4
- invocation_tree-0.0.16/invocation_tree.egg-info/SOURCES.txt +21 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/pyproject.toml +4 -4
- invocation_tree-0.0.15/images/#generator_function.py# +0 -13
- invocation_tree-0.0.15/images/compute.gif +0 -0
- invocation_tree-0.0.15/images/compute.py~ +0 -22
- invocation_tree-0.0.15/images/compute1.png +0 -0
- invocation_tree-0.0.15/images/compute2.png +0 -0
- invocation_tree-0.0.15/images/compute3.png +0 -0
- invocation_tree-0.0.15/images/compute4.png +0 -0
- invocation_tree-0.0.15/images/compute5.png +0 -0
- invocation_tree-0.0.15/images/compute6.png +0 -0
- invocation_tree-0.0.15/images/compute7.png +0 -0
- invocation_tree-0.0.15/images/compute8.png +0 -0
- invocation_tree-0.0.15/images/compute9.png +0 -0
- invocation_tree-0.0.15/images/create_images.sh~ +0 -4
- invocation_tree-0.0.15/images/eager_pipeline.py~ +0 -28
- invocation_tree-0.0.15/images/eager_pipeline1.png +0 -0
- invocation_tree-0.0.15/images/eager_pipeline2.png +0 -0
- invocation_tree-0.0.15/images/eager_pipeline3.png +0 -0
- invocation_tree-0.0.15/images/eager_pipeline4.png +0 -0
- invocation_tree-0.0.15/images/eager_pipeline5.png +0 -0
- invocation_tree-0.0.15/images/eager_pipeline6.png +0 -0
- invocation_tree-0.0.15/images/eager_pipeline7.png +0 -0
- invocation_tree-0.0.15/images/factorial.gif +0 -0
- invocation_tree-0.0.15/images/factorial.py~ +0 -11
- invocation_tree-0.0.15/images/factorial1.png +0 -0
- invocation_tree-0.0.15/images/factorial2.png +0 -0
- invocation_tree-0.0.15/images/factorial3.png +0 -0
- invocation_tree-0.0.15/images/factorial4.png +0 -0
- invocation_tree-0.0.15/images/factorial5.png +0 -0
- invocation_tree-0.0.15/images/factorial6.png +0 -0
- invocation_tree-0.0.15/images/factorial7.png +0 -0
- invocation_tree-0.0.15/images/generator_expression.py~ +0 -9
- invocation_tree-0.0.15/images/generator_expression1.png +0 -0
- invocation_tree-0.0.15/images/generator_expression2.png +0 -0
- invocation_tree-0.0.15/images/generator_expression3.png +0 -0
- invocation_tree-0.0.15/images/generator_expression4.png +0 -0
- invocation_tree-0.0.15/images/generator_expression5.png +0 -0
- invocation_tree-0.0.15/images/generator_expression6.png +0 -0
- invocation_tree-0.0.15/images/generator_expression7.png +0 -0
- invocation_tree-0.0.15/images/generator_expression8.png +0 -0
- invocation_tree-0.0.15/images/generator_expression9.png +0 -0
- invocation_tree-0.0.15/images/generator_function1.png +0 -0
- invocation_tree-0.0.15/images/generator_function2.png +0 -0
- invocation_tree-0.0.15/images/generator_function3.png +0 -0
- invocation_tree-0.0.15/images/generator_function4.png +0 -0
- invocation_tree-0.0.15/images/generator_function5.png +0 -0
- invocation_tree-0.0.15/images/generator_function6.png +0 -0
- invocation_tree-0.0.15/images/generator_function7.png +0 -0
- invocation_tree-0.0.15/images/generator_function8.png +0 -0
- invocation_tree-0.0.15/images/generator_function9.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline.py~ +0 -26
- invocation_tree-0.0.15/images/generator_pipeline1.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline10.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline11.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline12.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline13.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline14.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline15.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline16.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline17.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline18.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline19.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline2.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline20.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline21.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline22.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline23.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline24.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline25.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline26.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline27.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline3.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline4.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline5.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline6.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline7.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline8.png +0 -0
- invocation_tree-0.0.15/images/generator_pipeline9.png +0 -0
- invocation_tree-0.0.15/images/invocation_tree.pdf +0 -0
- invocation_tree-0.0.15/images/invocation_tree0.pdf +0 -0
- invocation_tree-0.0.15/images/iterable.py +0 -44
- invocation_tree-0.0.15/images/iterable.py~ +0 -31
- invocation_tree-0.0.15/images/my_list.py +0 -20
- invocation_tree-0.0.15/images/my_list.py~ +0 -4
- invocation_tree-0.0.15/images/my_range.py~ +0 -14
- invocation_tree-0.0.15/images/my_range0.png +0 -0
- invocation_tree-0.0.15/images/my_range1.png +0 -0
- invocation_tree-0.0.15/images/my_range10.png +0 -0
- invocation_tree-0.0.15/images/my_range11.png +0 -0
- invocation_tree-0.0.15/images/my_range12.png +0 -0
- invocation_tree-0.0.15/images/my_range13.png +0 -0
- invocation_tree-0.0.15/images/my_range14.png +0 -0
- invocation_tree-0.0.15/images/my_range15.png +0 -0
- invocation_tree-0.0.15/images/my_range2.png +0 -0
- invocation_tree-0.0.15/images/my_range3.png +0 -0
- invocation_tree-0.0.15/images/my_range4.png +0 -0
- invocation_tree-0.0.15/images/my_range5.png +0 -0
- invocation_tree-0.0.15/images/my_range6.png +0 -0
- invocation_tree-0.0.15/images/my_range7.png +0 -0
- invocation_tree-0.0.15/images/my_range8.png +0 -0
- invocation_tree-0.0.15/images/my_range9.png +0 -0
- invocation_tree-0.0.15/images/out.txt +0 -8
- invocation_tree-0.0.15/images/permutations.gif +0 -0
- invocation_tree-0.0.15/images/permutations.py~ +0 -8
- invocation_tree-0.0.15/images/permutations1.png +0 -0
- invocation_tree-0.0.15/images/permutations10.png +0 -0
- invocation_tree-0.0.15/images/permutations11.png +0 -0
- invocation_tree-0.0.15/images/permutations12.png +0 -0
- invocation_tree-0.0.15/images/permutations13.png +0 -0
- invocation_tree-0.0.15/images/permutations2.png +0 -0
- invocation_tree-0.0.15/images/permutations22.png~ +0 -0
- invocation_tree-0.0.15/images/permutations3.png +0 -0
- invocation_tree-0.0.15/images/permutations4.png +0 -0
- invocation_tree-0.0.15/images/permutations5.png +0 -0
- invocation_tree-0.0.15/images/permutations6.png +0 -0
- invocation_tree-0.0.15/images/permutations7.png +0 -0
- invocation_tree-0.0.15/images/permutations8.png +0 -0
- invocation_tree-0.0.15/images/permutations9.png +0 -0
- invocation_tree-0.0.15/images/student.gif +0 -0
- invocation_tree-0.0.15/images/students.gif +0 -0
- invocation_tree-0.0.15/images/students.py~ +0 -30
- invocation_tree-0.0.15/images/students1.png +0 -0
- invocation_tree-0.0.15/images/students10.png +0 -0
- invocation_tree-0.0.15/images/students11.png +0 -0
- invocation_tree-0.0.15/images/students12.png +0 -0
- invocation_tree-0.0.15/images/students13.png +0 -0
- invocation_tree-0.0.15/images/students14.png +0 -0
- invocation_tree-0.0.15/images/students15.png +0 -0
- invocation_tree-0.0.15/images/students2.png +0 -0
- invocation_tree-0.0.15/images/students3.png +0 -0
- invocation_tree-0.0.15/images/students4.png +0 -0
- invocation_tree-0.0.15/images/students5.png +0 -0
- invocation_tree-0.0.15/images/students6.png +0 -0
- invocation_tree-0.0.15/images/students7.png +0 -0
- invocation_tree-0.0.15/images/students8.png +0 -0
- invocation_tree-0.0.15/images/students9.png +0 -0
- invocation_tree-0.0.15/images/test.py +0 -15
- invocation_tree-0.0.15/images/tree.gv~ +0 -22
- invocation_tree-0.0.15/images/tree.pdf +0 -0
- invocation_tree-0.0.15/invocation_tree.egg-info/SOURCES.txt +0 -155
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/LICENSE.txt +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/MANIFEST.in +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/README.md +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/compute.py +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/factorial.py +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/permutations.py +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/students.py +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/images/vscode.png +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/invocation_tree.egg-info/dependency_links.txt +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/invocation_tree.egg-info/requires.txt +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/invocation_tree.egg-info/top_level.txt +0 -0
- {invocation_tree-0.0.15 → invocation_tree-0.0.16}/setup.cfg +0 -0
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: invocation_tree
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: Generates an invocation tree of functions calls.
|
|
5
5
|
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
|
-
License
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
License: BSD 2-Clause License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017, pyexample
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
|
19
|
+
and/or other materials provided with the distribution.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
|
|
32
|
+
Project-URL: Homepage, https://github.com/bterwijn/invocation_tree
|
|
33
|
+
Project-URL: Repository, https://github.com/bterwijn/invocation_tree.git
|
|
9
34
|
Classifier: Development Status :: 4 - Beta
|
|
10
35
|
Classifier: Intended Audience :: Education
|
|
11
36
|
Classifier: Intended Audience :: Developers
|
|
Binary file
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# sudo apt install imagemagick
|
|
6
6
|
|
|
7
7
|
name="$1"
|
|
8
|
-
files=$(ls -v $name*.png)
|
|
8
|
+
files=$(ls -v $name*.png | tr '\n' ' ')
|
|
9
9
|
echo "creating gif with:"
|
|
10
10
|
echo "$files"
|
|
11
11
|
|
|
@@ -15,5 +15,11 @@ echo "largest_size: $largest_size"
|
|
|
15
15
|
echo "resizing images"
|
|
16
16
|
mogrify -resize $largest_size -background white -gravity North -extent $largest_size $files
|
|
17
17
|
echo "creating file: $name.gif"
|
|
18
|
-
convert -delay 150 -loop 0 $files $name.gif
|
|
18
|
+
convert -delay 150 -dither None -loop 0 $files $name.gif
|
|
19
|
+
|
|
20
|
+
if [ "$2" = "-d" ]; then
|
|
21
|
+
echo "deleting: $files"
|
|
22
|
+
rm $files
|
|
23
|
+
fi
|
|
24
|
+
|
|
19
25
|
echo "done"
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
rm -f compute*.png
|
|
3
3
|
python compute.py
|
|
4
4
|
rm -f compute0.png
|
|
5
|
-
bash create_gif.sh compute
|
|
5
|
+
bash create_gif.sh compute -d
|
|
6
6
|
|
|
7
7
|
rm -f students*.png
|
|
8
8
|
python students.py
|
|
9
9
|
rm -f students0.png
|
|
10
|
-
bash create_gif.sh students
|
|
10
|
+
bash create_gif.sh students -d
|
|
11
11
|
|
|
12
12
|
rm -f factorial*.png
|
|
13
13
|
python factorial.py
|
|
14
14
|
rm -f factorial0.png
|
|
15
|
-
bash create_gif.sh factorial
|
|
15
|
+
bash create_gif.sh factorial -d
|
|
16
16
|
|
|
17
17
|
rm -f permutations*.png
|
|
18
18
|
python permutations.py
|
|
19
19
|
rm -f permutations0.png
|
|
20
|
-
bash create_gif.sh permutations
|
|
20
|
+
bash create_gif.sh permutations -d
|
|
21
21
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,7 +7,7 @@ import html
|
|
|
7
7
|
import sys
|
|
8
8
|
import difflib
|
|
9
9
|
|
|
10
|
-
__version__ = "0.0.
|
|
10
|
+
__version__ = "0.0.16"
|
|
11
11
|
__author__ = 'Bas Terwijn'
|
|
12
12
|
|
|
13
13
|
def highlight_diff(str1, str2):
|
|
@@ -60,7 +60,8 @@ class Tree_Node:
|
|
|
60
60
|
class Invocation_Tree:
|
|
61
61
|
|
|
62
62
|
def __init__(self,
|
|
63
|
-
filename='tree.pdf',
|
|
63
|
+
filename='tree.pdf',
|
|
64
|
+
render=True,
|
|
64
65
|
show=True,
|
|
65
66
|
block=True,
|
|
66
67
|
src_loc=True,
|
|
@@ -78,6 +79,7 @@ class Invocation_Tree:
|
|
|
78
79
|
# --- config
|
|
79
80
|
self.filename = filename
|
|
80
81
|
self.prev_filename = None
|
|
82
|
+
self.render = render
|
|
81
83
|
self.show = show
|
|
82
84
|
self.block = block
|
|
83
85
|
self.src_loc = src_loc
|
|
@@ -104,6 +106,7 @@ class Invocation_Tree:
|
|
|
104
106
|
self.node_id_to_table = {}
|
|
105
107
|
self.edges = []
|
|
106
108
|
self.is_highlighted = False
|
|
109
|
+
self.graph = None
|
|
107
110
|
self.ignore_calls = {'Invocation_Tree.__exit__', 'Invocation_Tree.stop_trace'}
|
|
108
111
|
|
|
109
112
|
def __repr__(self):
|
|
@@ -234,9 +237,10 @@ class Invocation_Tree:
|
|
|
234
237
|
def output_graph(self, frame, event):
|
|
235
238
|
if self.block or self.gifcount >= 0:
|
|
236
239
|
self.is_highlighted = False
|
|
237
|
-
graph = self.create_graph()
|
|
240
|
+
self.graph = self.create_graph()
|
|
238
241
|
if self.is_highlighted:
|
|
239
|
-
self.
|
|
242
|
+
if self.render:
|
|
243
|
+
self.render_graph(self.graph)
|
|
240
244
|
if self.block:
|
|
241
245
|
if self.src_loc:
|
|
242
246
|
filename = frame.f_code.co_filename
|
|
@@ -244,8 +248,12 @@ class Invocation_Tree:
|
|
|
244
248
|
print(f'{event.capitalize()} at {filename}:{line_nr}', end='. ')
|
|
245
249
|
input('Press <Enter> to continue...')
|
|
246
250
|
else:
|
|
247
|
-
graph = self.create_graph()
|
|
248
|
-
self.
|
|
251
|
+
self.graph = self.create_graph()
|
|
252
|
+
if self.render:
|
|
253
|
+
self.render_graph(self.graph)
|
|
254
|
+
|
|
255
|
+
def get_graph(self):
|
|
256
|
+
return self.graph
|
|
249
257
|
|
|
250
258
|
def trace_calls(self, frame, event, arg):
|
|
251
259
|
class_fun_name = get_class_function_name(frame)
|
|
@@ -273,6 +281,9 @@ def blocking_each_change(filename='tree.pdf'):
|
|
|
273
281
|
def debugger(filename='tree.pdf'):
|
|
274
282
|
return Invocation_Tree(filename=filename, show=False, block=False, each_line=True)
|
|
275
283
|
|
|
284
|
+
def debugger_no_render(filename='tree.pdf'):
|
|
285
|
+
return Invocation_Tree(filename=filename, render=False, show=False, block=False, each_line=True)
|
|
286
|
+
|
|
276
287
|
def gif(filename='tree.png'):
|
|
277
288
|
return Invocation_Tree(filename=filename, show=False, block=False, gifcount=0)
|
|
278
289
|
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: invocation_tree
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: Generates an invocation tree of functions calls.
|
|
5
5
|
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
|
-
License
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
License: BSD 2-Clause License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017, pyexample
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
15
|
+
list of conditions and the following disclaimer.
|
|
16
|
+
|
|
17
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
|
19
|
+
and/or other materials provided with the distribution.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
|
|
32
|
+
Project-URL: Homepage, https://github.com/bterwijn/invocation_tree
|
|
33
|
+
Project-URL: Repository, https://github.com/bterwijn/invocation_tree.git
|
|
9
34
|
Classifier: Development Status :: 4 - Beta
|
|
10
35
|
Classifier: Intended Audience :: Education
|
|
11
36
|
Classifier: Intended Audience :: Developers
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
images/compute.gif
|
|
6
|
+
images/compute.py
|
|
7
|
+
images/create_gif.sh
|
|
8
|
+
images/create_images.sh
|
|
9
|
+
images/factorial.gif
|
|
10
|
+
images/factorial.py
|
|
11
|
+
images/permutations.gif
|
|
12
|
+
images/permutations.py
|
|
13
|
+
images/students.gif
|
|
14
|
+
images/students.py
|
|
15
|
+
images/vscode.png
|
|
16
|
+
invocation_tree/__init__.py
|
|
17
|
+
invocation_tree.egg-info/PKG-INFO
|
|
18
|
+
invocation_tree.egg-info/SOURCES.txt
|
|
19
|
+
invocation_tree.egg-info/dependency_links.txt
|
|
20
|
+
invocation_tree.egg-info/requires.txt
|
|
21
|
+
invocation_tree.egg-info/top_level.txt
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "invocation_tree"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.16"
|
|
8
8
|
description = "Generates an invocation tree of functions calls."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Bas Terwijn", email = "bterwijn@gmail.com"}
|
|
11
11
|
]
|
|
12
12
|
#license = { text = "BSD-2-Clause" } # needed for python <=3.8
|
|
13
|
-
license = "
|
|
13
|
+
license = { file = "LICENSE.txt" }
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.7"
|
|
16
16
|
classifiers = [
|
|
@@ -26,8 +26,8 @@ dependencies = [
|
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.urls]
|
|
29
|
-
Homepage = "https://github.com/bterwijn/
|
|
30
|
-
Repository = "https://github.com/bterwijn/
|
|
29
|
+
Homepage = "https://github.com/bterwijn/invocation_tree"
|
|
30
|
+
Repository = "https://github.com/bterwijn/invocation_tree.git"
|
|
31
31
|
|
|
32
32
|
[tool.setuptools]
|
|
33
33
|
packages = ["invocation_tree"]
|
|
Binary file
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import invocation_tree as invo_tree
|
|
2
|
-
|
|
3
|
-
def main():
|
|
4
|
-
a = 10
|
|
5
|
-
a = expression(a)
|
|
6
|
-
return multiply(a, 6)
|
|
7
|
-
|
|
8
|
-
def expression(a):
|
|
9
|
-
a = subtract(a, 5)
|
|
10
|
-
return add(a, 2)
|
|
11
|
-
|
|
12
|
-
def subtract(a, b):
|
|
13
|
-
return a - b
|
|
14
|
-
|
|
15
|
-
def add(a, b):
|
|
16
|
-
return a + b
|
|
17
|
-
|
|
18
|
-
def multiply(a, b):
|
|
19
|
-
return a * b
|
|
20
|
-
|
|
21
|
-
tree = invo_tree.gif('compute.png')
|
|
22
|
-
print( tree(main) )
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import invocation_tree as invo_tree
|
|
2
|
-
|
|
3
|
-
def subtract(pipeline):
|
|
4
|
-
for a in pipeline:
|
|
5
|
-
yield a - 3
|
|
6
|
-
|
|
7
|
-
def multiply(pipeline):
|
|
8
|
-
for a in pipeline:
|
|
9
|
-
yield a * 6
|
|
10
|
-
|
|
11
|
-
def my_sum(pipeline):
|
|
12
|
-
total = 0
|
|
13
|
-
for i in pipeline:
|
|
14
|
-
total += i
|
|
15
|
-
return total # return not yield, so not lazy
|
|
16
|
-
|
|
17
|
-
def main():
|
|
18
|
-
pipeline = range(1,4)
|
|
19
|
-
pipeline = subtract(pipeline)
|
|
20
|
-
pipeline = (a + 9 for a in pipeline)
|
|
21
|
-
pipeline = multiply(pipeline)
|
|
22
|
-
return my_sum(pipeline)
|
|
23
|
-
|
|
24
|
-
tree = invo_tree.blocking()
|
|
25
|
-
import types
|
|
26
|
-
tree.to_string[types.GeneratorType] = lambda x: 'generator' # short name for generators
|
|
27
|
-
tree.to_string[type(iter(range(0)))] = lambda x: 'iterator' # short name for iterator
|
|
28
|
-
print( tree(main) )
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import invocation_tree as invo_tree
|
|
2
|
-
|
|
3
|
-
def subtract(pipeline):
|
|
4
|
-
for a in pipeline:
|
|
5
|
-
yield a - 7
|
|
6
|
-
|
|
7
|
-
def add(pipeline):
|
|
8
|
-
for a in pipeline:
|
|
9
|
-
yield a + 2
|
|
10
|
-
|
|
11
|
-
def multiply(pipeline):
|
|
12
|
-
for a in pipeline:
|
|
13
|
-
yield a * 6
|
|
14
|
-
|
|
15
|
-
def main():
|
|
16
|
-
pipeline = range(1,4)
|
|
17
|
-
pipeline = subtract(pipeline)
|
|
18
|
-
pipeline = (a+2 for a in pipeline)
|
|
19
|
-
pipeline = multiply(pipeline)
|
|
20
|
-
return list(pipeline)
|
|
21
|
-
|
|
22
|
-
tree = invo_tree.blocking() # gif('generator_pipeline.png')
|
|
23
|
-
import types
|
|
24
|
-
tree.to_string[types.GeneratorType] = lambda x: 'generator' # short name for generators
|
|
25
|
-
tree.to_string[type(iter(range(0)))] = lambda x: 'range_iterator' # short name for range_iterator
|
|
26
|
-
print( tree(main) )
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import invocation_tree as ivt
|
|
2
|
-
|
|
3
|
-
class My_Iterator:
|
|
4
|
-
|
|
5
|
-
def __init__(self, my_iterable):
|
|
6
|
-
self.value = my_iterable.start
|
|
7
|
-
self.my_iterable = my_iterable
|
|
8
|
-
|
|
9
|
-
def __repr__(self):
|
|
10
|
-
return f'My_Iterator value:{self.value}'
|
|
11
|
-
|
|
12
|
-
def __next__(self):
|
|
13
|
-
prev = self.value
|
|
14
|
-
self.value += self.my_iterable.step
|
|
15
|
-
if prev < self.my_iterable.stop:
|
|
16
|
-
return prev
|
|
17
|
-
raise StopIteration()
|
|
18
|
-
|
|
19
|
-
class My_Iterable:
|
|
20
|
-
|
|
21
|
-
def __init__(self, stop, start=0, step=1):
|
|
22
|
-
self.stop = stop
|
|
23
|
-
self.step = step
|
|
24
|
-
self.start = start
|
|
25
|
-
print('self:',self)
|
|
26
|
-
|
|
27
|
-
def __repr__(self):
|
|
28
|
-
return f'My_Iterable start:{self.start} stop:{self.stop} step:{self.step}'
|
|
29
|
-
|
|
30
|
-
def __iter__(self):
|
|
31
|
-
return My_Iterator(self)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def main():
|
|
35
|
-
iterable = My_Iterable(start=1, stop=3)
|
|
36
|
-
for i in iterable:
|
|
37
|
-
print(i)
|
|
38
|
-
|
|
39
|
-
tree = ivt.blocking() # gif('genexp.png')
|
|
40
|
-
#tree.to_string[type(iter(range(0)))] = lambda ri: 'iterator' # short name for iterator
|
|
41
|
-
#tree.to_string[types.GeneratorType] = lambda gen: 'generator' # short name for generators
|
|
42
|
-
tree.cleanup = False
|
|
43
|
-
print('sum:', tree(main))
|
|
44
|
-
#print('sum:', main())
|