Skip to content

Commit 6414320

Browse files
committed
fix existing race condition
Signed-off-by: Mark Halka <mark.halka2001@gmail.com>
1 parent 51017e7 commit 6414320

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

examples/01_basics/e3_show_graph.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ def my_graph():
2525
csp.print("spread2", s2)
2626

2727

28-
def main():
29-
# open in graphviz viewer
30-
# csp.show_graph(my_graph)
31-
# or output to file
32-
csp.show_graph(my_graph, graph_filename="tmp.png")
28+
def main(show_graph: bool = False):
29+
if show_graph:
30+
# open in graphviz viewer
31+
# csp.show_graph(my_graph)
32+
# or output to file
33+
csp.show_graph(my_graph, graph_filename="tmp.png")
3334
csp.run(my_graph, starttime=datetime(2020, 3, 1), endtime=timedelta(seconds=10))
3435

3536

3637
if __name__ == "__main__":
37-
main()
38+
main(show_graph=True)

examples/98_just_for_fun/e1_csp_nand_computer.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ def my_graph(bits: int = 16):
104104
csp.print("x+y_bits", basket_to_bitstring(add))
105105

106106

107-
def main():
108-
# Show graph with 4-bit ints to limit size
109-
csp.showgraph.show_graph(my_graph, 4)
107+
def main(show_graph: bool = False):
108+
if show_graph:
109+
# Show graph with 4-bit ints to limit size
110+
csp.showgraph.show_graph(my_graph, 4)
110111
csp.run(my_graph, starttime=datetime(2022, 6, 24))
111112

112113

113114
if __name__ == "__main__":
114-
main()
115+
main(show_graph=True)

0 commit comments

Comments
 (0)