Skip to content

Commit c46d2c2

Browse files
BishalsarangBishal Sarangkoti
authored and
Bishal Sarangkoti
committed
Bugfix-25: Issue while running multiple instances #25
1 parent 92f8596 commit c46d2c2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

visualiser/visualiser.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,9 @@
1515

1616

1717
class Visualiser(object):
18-
# Total number of nodes
19-
node_count = 0
20-
graph = pydot.Dot(graph_type="digraph", bgcolor="#fff3af")
21-
# To track function call numbers
22-
stack = []
23-
edges = []
24-
nodes = []
25-
2618
def __init__(self, ignore_args=None, show_argument_name=True,
2719
show_return_value=True, node_properties_kwargs={}):
20+
self.init_graph()
2821
# If enabled shows keyword arguments ordered by keys
2922
self.show_argument_name = show_argument_name
3023
# If enables shows the return value at every nodes
@@ -114,6 +107,8 @@ def make_animation(cls, filename="out.gif", delay=3):
114107
except:
115108
print("Error saving gif.")
116109

110+
cls.init_graph()
111+
117112
def extract_arg_strings(self, *args, **kwargs):
118113
"""
119114
Returns function signature arguments function label arguments as
@@ -274,3 +269,13 @@ def wrapper(*args, **kwargs):
274269

275270
return result
276271
return wrapper
272+
273+
@classmethod
274+
def init_graph(cls):
275+
# Total number of nodes
276+
cls.node_count = 0
277+
cls.graph = pydot.Dot(graph_type="digraph", bgcolor="#fff3af")
278+
# To track function call numbers
279+
cls.stack = []
280+
cls.edges = []
281+
cls.nodes = []

0 commit comments

Comments
 (0)