From 77b0b5b3fe869d6b790dfedfc2e2d5b8304ade36 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 5 Feb 2016 18:56:08 +0100 Subject: [PATCH] dot: add option C(COLOR) This fixes the output gliches visible in the previous patches, where highlighting a state would remove its fill color. * spot/twaalgos/dot.cc, spot/taalgos/dot.cc: Implement option C(COLOR). * bin/common_aoutput.cc, doc/org/oaut.org: Document it. * doc/org/.dir-locals.el.in, doc/org/init.el.in, python/spot/__init__.py: Use it. * tests/python/automata-io.ipynb, tests/python/automata.ipynb, tests/python/highlighting.ipynb: Test it. * tests/core/readsave.test: Adjust. * NEWS: Mention recent changes. --- NEWS | 30 ++++++---- bin/common_aoutput.cc | 10 +++- doc/org/.dir-locals.el.in | 4 +- doc/org/init.el.in | 5 +- doc/org/oaut.org | 13 +++-- python/spot/__init__.py | 10 ++-- spot/taalgos/dot.cc | 17 ++++++ spot/twaalgos/dot.cc | 31 +++++++++-- tests/core/readsave.test | 4 +- tests/python/automata-io.ipynb | 35 ++++++------ tests/python/automata.ipynb | 99 +++++++++++++++++---------------- tests/python/highlighting.ipynb | 12 ++-- 12 files changed, 163 insertions(+), 107 deletions(-) diff --git a/NEWS b/NEWS index 3bfcd22b7..7c6a06c90 100644 --- a/NEWS +++ b/NEWS @@ -12,20 +12,26 @@ New in spot 1.99.7a (not yet released) object can be queried about the supported variables and their types. - * print_dot() now accepts an option of the form " diff --git a/doc/org/oaut.org b/doc/org/oaut.org index 204348ddd..5ad6aa41a 100644 --- a/doc/org/oaut.org +++ b/doc/org/oaut.org @@ -579,10 +579,11 @@ acceptance condition to be shown as well. Option =b= causes sets to be ouput as bullets (e.g., ⓿ instead of ={0}=); option =r= (for rainbow) causes sets to be displayed in different colors, while option =R= also uses colors, but it chooses them depending on whether a set -is used with Fin-acceptance, Inf-acceptance, or both. Finally option -=f(FONT)= is used to select a fontname: it is often necessary when =b= -is used to ensure the characters ⓿, ❶, etc. are all selected from the -same font. +is used with Fin-acceptance, Inf-acceptance, or both. Option +=C(COLOR)= can be used to color all states using =COLOR=, and the +option =f(FONT)= is used to select a fontname: it is often necessary +when =b= is used to ensure the characters ⓿, ❶, etc. are all selected +from the same font. #+BEGIN_SRC sh :results verbatim :exports code ltl2tgba --dot=vcsna '(Ga -> Gb) W c' @@ -840,8 +841,8 @@ The dot output can also be customized via two environment variables: variables set: #+BEGIN_SRC sh :results verbatim :exports code -export SPOT_DOTDEFAULT='Brf(Lato)' -export SPOT_DOTEXTRA='node[style=filled, fillcolor="#ffffa0"] edge[arrowhead=vee, arrowsize=.7]' +export SPOT_DOTDEFAULT='Brf(Lato)C(#ffffa0)' +export SPOT_DOTEXTRA='edge[arrowhead=vee, arrowsize=.7]' #+END_SRC * Statistics diff --git a/python/spot/__init__.py b/python/spot/__init__.py index 8b523df5a..e5c9a1238 100644 --- a/python/spot/__init__.py +++ b/python/spot/__init__.py @@ -76,14 +76,14 @@ def setup(**kwargs): """ import os - s = ('size="{}" node[style=filled,fillcolor="{}"] ' - 'edge[arrowhead=vee, arrowsize=.7]') - os.environ['SPOT_DOTEXTRA'] = s.format(kwargs.get('size', '10.2,5'), - kwargs.get('fillcolor', '#ffffaa')) + s = ('size="{}" edge[arrowhead=vee, arrowsize=.7]') + os.environ['SPOT_DOTEXTRA'] = s.format(kwargs.get('size', '10.2,5')) bullets = 'B' if kwargs.get('bullets', True) else '' max_states = '<' + str(kwargs.get('max_states', 50)) - d = 'rf({})'.format(kwargs.get('font', 'Lato')) + bullets + max_states + d = 'rf({})C({}){}'.format(kwargs.get('font', 'Lato'), + kwargs.get('fillcolor', '#ffffaa'), + bullets + max_states) global _show_default _show_default = kwargs.get('show_default', None) os.environ['SPOT_DOTDEFAULT'] = d diff --git a/spot/taalgos/dot.cc b/spot/taalgos/dot.cc index b42ec87b2..fb20cc78a 100644 --- a/spot/taalgos/dot.cc +++ b/spot/taalgos/dot.cc @@ -65,6 +65,19 @@ namespace spot case 'c': opt_circles_ = true; break; + case 'C': + if (*options != '(') + throw std::runtime_error + ("invalid node color specification for print_dot()"); + { + auto* end = strchr(++options, ')'); + if (!end) + throw std::runtime_error + ("invalid node color specification for print_dot()"); + opt_node_color_ = std::string(options, end - options); + options = end + 1; + } + break; case 'h': opt_horizontal_ = true; break; @@ -136,6 +149,9 @@ namespace spot os_ << " rankdir=LR\n"; if (opt_circles_) os_ << " node [shape=\"circle\"]\n"; + if (!opt_node_color_.empty()) + os_ << " node [style=\"filled\", fillcolor=\"" + << opt_node_color_ << "\"]\n"; if (!opt_font_.empty()) os_ << " fontname=\"" << opt_font_ << "\"\n node [fontname=\"" << opt_font_ @@ -238,6 +254,7 @@ namespace spot bool opt_circles_ = false; bool opt_hide_sets_ = false; std::string opt_font_; + std::string opt_node_color_; }; } diff --git a/spot/twaalgos/dot.cc b/spot/twaalgos/dot.cc index a3d00975c..9acfcd2fd 100644 --- a/spot/twaalgos/dot.cc +++ b/spot/twaalgos/dot.cc @@ -75,6 +75,7 @@ namespace spot bool opt_want_state_names_ = true; unsigned opt_shift_sets_ = 0; std::string opt_font_; + std::string opt_node_color_; const char* const palette9[9] = { @@ -181,18 +182,31 @@ namespace spot case 'c': opt_shape_ = ShapeCircle; break; + case 'C': + if (*options != '(') + throw std::runtime_error + ("invalid node color specification for print_dot()"); + { + auto* end = strchr(++options, ')'); + if (!end) + throw std::runtime_error + ("invalid node color specification for print_dot()"); + opt_node_color_ = std::string(options, end - options); + options = end + 1; + } + break; case 'e': opt_shape_ = ShapeEllipse; break; case 'f': if (*options != '(') throw std::runtime_error - (std::string("invalid font specification for dotty()")); + ("invalid font specification for print_dot()"); { auto* end = strchr(++options, ')'); if (!end) throw std::runtime_error - (std::string("invalid font specification for dotty()")); + ("invalid font specification for print_dot()"); opt_font_ = std::string(options, end - options); options = end + 1; } @@ -406,6 +420,9 @@ namespace spot case ShapeAuto: SPOT_UNREACHABLE(); } + if (!opt_node_color_.empty()) + os_ << " node [style=\"filled\", fillcolor=\"" + << opt_node_color_ << "\"]\n"; if (!opt_font_.empty()) os_ << " fontname=\"" << opt_font_ << "\"\n node [fontname=\"" << opt_font_ @@ -511,9 +528,13 @@ namespace spot { auto iter = highlight_states_->find(s); if (iter != highlight_states_->end()) - os_ << ", style=bold, color=\"" - << palette[iter->second % palette_mod] - << '"'; + { + os_ << ", style=\"bold"; + if (!opt_node_color_.empty()) + os_ << ",filled"; + os_ << "\", color=\"" << palette[iter->second % palette_mod] + << '"'; + } } os_ << "]\n"; if (incomplete_ && incomplete_->find(s) != incomplete_->end()) diff --git a/tests/core/readsave.test b/tests/core/readsave.test index f37b8869d..a0eb63e59 100755 --- a/tests/core/readsave.test +++ b/tests/core/readsave.test @@ -993,12 +993,12 @@ digraph G { node [shape="circle"] I [label="", style=invis, width=0] I -> 2 - 0 [label="0", peripheries=2, style=bold, color="#5DA5DA"] + 0 [label="0", peripheries=2, style="bold", color="#5DA5DA"] 0 -> 0 [label="1", style=bold, color="#5DA5DA"] 1 [label="1"] 1 -> 0 [label="c", style=bold, color="#F17CB0"] 1 -> 1 [label="b & !c", style=bold, color="#FAA43A"] - 2 [label="2", style=bold, color="#B276B2"] + 2 [label="2", style="bold", color="#B276B2"] 2 -> 0 [label="c", style=bold, color="#B276B2"] 2 -> 1 [label="!a & b & !c"] 2 -> 2 [label="a & !c"] diff --git a/tests/python/automata-io.ipynb b/tests/python/automata-io.ipynb index a018a5a95..ccd65aa77 100644 --- a/tests/python/automata-io.ipynb +++ b/tests/python/automata-io.ipynb @@ -18,7 +18,7 @@ "version": "3.4.3+" }, "name": "", - "signature": "sha256:79ee85572b2a0147d88b2d3d355977e3f34dadb82bd7e8589bdbb2cf2a539b0b" + "signature": "sha256:d9763e3af9f29bca127bdbfb9c6b0bcfaf276a0c32d9f789d696bfbe4a563e57" }, "nbformat": 3, "nbformat_minor": 0, @@ -81,10 +81,11 @@ "digraph G {\n", " rankdir=LR\n", " node [shape=\"circle\"]\n", + " node [style=\"filled\", fillcolor=\"#ffffaa\"]\n", " fontname=\"Lato\"\n", " node [fontname=\"Lato\"]\n", " edge [fontname=\"Lato\"]\n", - " size=\"10.2,5\" node[style=filled,fillcolor=\"#ffffaa\"] edge[arrowhead=vee, arrowsize=.7]\n", + " size=\"10.2,5\" edge[arrowhead=vee, arrowsize=.7]\n", " I [label=\"\", style=invis, width=0]\n", " I -> 1\n", " 0 [label=\"0\", peripheries=2]\n", @@ -172,7 +173,7 @@ "\n" ], "text": [ - " *' at 0x7f4414147600> >" + " *' at 0x7f45201e0810> >" ] } ], @@ -283,7 +284,7 @@ "\n" ], "text": [ - " *' at 0x7f4414157570> >" + " *' at 0x7f45201e09c0> >" ] }, { @@ -340,7 +341,7 @@ "\n" ], "text": [ - " *' at 0x7f4414157660> >" + " *' at 0x7f45201ff1b0> >" ] } ], @@ -459,7 +460,7 @@ "\n" ], "text": [ - " *' at 0x7f441765be40> >" + " *' at 0x7f45201e0900> >" ] } ], @@ -554,7 +555,7 @@ "\n" ], "text": [ - " *' at 0x7f4414157690> >" + " *' at 0x7f45201ff1b0> >" ] }, { @@ -602,7 +603,7 @@ "\n" ], "text": [ - " *' at 0x7f441765be40> >" + " *' at 0x7f45201e0900> >" ] } ], @@ -717,7 +718,7 @@ "\n" ], "text": [ - " *' at 0x7f44141578d0> >" + " *' at 0x7f45201ff390> >" ] }, { @@ -789,7 +790,7 @@ "\n" ], "text": [ - " *' at 0x7f44141578a0> >" + " *' at 0x7f45201ff270> >" ] } ], @@ -811,8 +812,8 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'non-existing-cmd |'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/home/adl/git/spot/wrap/python/spot.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 404\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 405\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 406\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 407\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 408\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/home/adl/git/spot/wrap/python/spot.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, *sources)\u001b[0m\n\u001b[1;32m 395\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 396\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 397\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 398\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 399\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 471\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 472\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 473\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 474\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 475\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, debug, *sources)\u001b[0m\n\u001b[1;32m 456\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 457\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 458\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 459\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 460\u001b[0m \u001b[0;31m# reporting the following error: \"\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sleep 3; cat example.aut |'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/home/adl/git/spot/wrap/python/spot.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 404\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 405\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 406\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 407\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 408\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/home/adl/git/spot/wrap/python/spot.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, *sources)\u001b[0m\n\u001b[1;32m 366\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 367\u001b[0m out = subprocess.check_output(filename[:-1], shell=True,\n\u001b[0;32m--> 368\u001b[0;31m timeout=timeout)\n\u001b[0m\u001b[1;32m 369\u001b[0m \u001b[0mp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mautomaton_stream_parser\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 370\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0;34m'\\n'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/usr/lib/python3.4/subprocess.py\u001b[0m in \u001b[0;36mcheck_output\u001b[0;34m(timeout, *popenargs, **kwargs)\u001b[0m\n\u001b[1;32m 611\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkill\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 612\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0munused_err\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommunicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 613\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 614\u001b[0m \u001b[0;32mexcept\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 615\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkill\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 471\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 472\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 473\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 474\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 475\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, debug, *sources)\u001b[0m\n\u001b[1;32m 415\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 416\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 417\u001b[0;31m \u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommunicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 418\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 419\u001b[0m \u001b[0;31m# Using subprocess.check_output() with timeout\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3.5/subprocess.py\u001b[0m in \u001b[0;36mcommunicate\u001b[0;34m(self, input, timeout)\u001b[0m\n\u001b[1;32m 1063\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1064\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1065\u001b[0;31m \u001b[0mstdout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstderr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_communicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mendtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1066\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1067\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_communication_started\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3.5/subprocess.py\u001b[0m in \u001b[0;36m_communicate\u001b[0;34m(self, input, endtime, orig_timeout)\u001b[0m\n\u001b[1;32m 1698\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1699\u001b[0m \u001b[0mready\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mselector\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1700\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_timeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mendtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0morig_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1701\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1702\u001b[0m \u001b[0;31m# XXX Rewrite these to use non-blocking I/O on the file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/lib/python3.5/subprocess.py\u001b[0m in \u001b[0;36m_check_timeout\u001b[0;34m(self, endtime, orig_timeout)\u001b[0m\n\u001b[1;32m 1089\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1090\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_time\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0mendtime\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1091\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0morig_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1092\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1093\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mTimeoutExpired\u001b[0m: Command 'sleep 3; cat example.aut ' timed out after 1 seconds" ] } @@ -859,4 +862,4 @@ "metadata": {} } ] -} +} \ No newline at end of file diff --git a/tests/python/automata.ipynb b/tests/python/automata.ipynb index 8d32d9d05..8fda68e28 100644 --- a/tests/python/automata.ipynb +++ b/tests/python/automata.ipynb @@ -17,7 +17,8 @@ "pygments_lexer": "ipython3", "version": "3.4.3+" }, - "name": "" + "name": "", + "signature": "sha256:93ecf5f37287bb2a03dcd63d41faa06f0ed9d8bcc403c73b24d1bf10404b3b1c" }, "nbformat": 3, "nbformat_minor": 0, @@ -177,7 +178,7 @@ "\n" ], "text": [ - " *' at 0x7f3c25174540> >" + " *' at 0x7f7cfc093810> >" ] } ], @@ -211,7 +212,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "0\n", "\n", "\n", @@ -227,7 +228,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "\n", "1\n", "\n", @@ -239,7 +240,7 @@ "\n", "\n", "4\n", - "\n", + "\n", "4\n", "\n", "\n", @@ -256,7 +257,7 @@ "\n", "\n", "2\n", - "\n", + "\n", "2\n", "\n", "\n", @@ -267,7 +268,7 @@ "\n", "\n", "3\n", - "\n", + "\n", "3\n", "\n", "\n", @@ -316,7 +317,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -469,7 +470,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -569,7 +570,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b810> >" + " *' at 0x7f7cef37ee10> >" ] } ], @@ -639,7 +640,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b690> >" + " *' at 0x7f7cef37ecc0> >" ] } ], @@ -715,7 +716,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b6f0> >" + " *' at 0x7f7cef37ed50> >" ] } ], @@ -755,7 +756,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "f.translate('ba', 'small').show('v')" + "f.translate('ba', 'small').show('.v')" ], "language": "python", "metadata": {}, @@ -765,15 +766,15 @@ "output_type": "pyout", "prompt_number": 10, "svg": [ - "\n", + "\n", "\n", "G\n", - "\n", + "\n", "\n", "\n", "0\n", "\n", - "0\n", + "0\n", "\n", "\n", "I->0\n", @@ -784,61 +785,61 @@ "1\n", "\n", "\n", - "1\n", + "1\n", "\n", "\n", "0->1\n", "\n", "\n", - "a\n", + "a\n", "\n", "\n", "2\n", "\n", "\n", - "2\n", + "2\n", "\n", "\n", "0->2\n", "\n", "\n", - "b\n", + "b\n", "\n", "\n", "3\n", - "\n", - "\n", - "3\n", + "\n", + "\n", + "3\n", "\n", "\n", "0->3\n", - "\n", - "\n", - "c\n", + "\n", + "\n", + "c\n", "\n", "\n", "1->1\n", "\n", "\n", - "a\n", + "a\n", "\n", "\n", "2->2\n", "\n", "\n", - "b\n", + "b\n", "\n", "\n", "3->3\n", - "\n", - "\n", - "c\n", + "\n", + "\n", + "c\n", "\n", "\n", "" ], "text": [ - "" + "" ] } ], @@ -1028,7 +1029,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -1175,7 +1176,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515be10> >" + " *' at 0x7f7cef37ef60> >" ] } ], @@ -1276,7 +1277,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515bed0> >" + " *' at 0x7f7cef37ef30> >" ] } ], @@ -1394,7 +1395,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b630> >" + " *' at 0x7f7cef37ef00> >" ] } ], @@ -1493,7 +1494,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b6c0> >" + " *' at 0x7f7cef37ed20> >" ] } ], @@ -1963,7 +1964,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b450> >" + " *' at 0x7f7cef37ef90> >" ] } ], @@ -2160,7 +2161,7 @@ "" ], "text": [ - "" + "" ] }, { @@ -2285,7 +2286,7 @@ "" ], "text": [ - "" + "" ] }, { @@ -2427,7 +2428,7 @@ "" ], "text": [ - "" + "" ] }, { @@ -2578,7 +2579,7 @@ "\n" ], "text": [ - " *' at 0x7f3c2515b840> >" + " *' at 0x7f7cef37ecf0> >" ] } ], @@ -2734,7 +2735,7 @@ "\n" ], "text": [ - " *' at 0x7f3c250f61e0> >" + " *' at 0x7f7cef37eed0> >" ] } ], @@ -2804,7 +2805,7 @@ "\n" ], "text": [ - " *' at 0x7f3c250f6150> >" + " *' at 0x7f7cef37ecf0> >" ] } ], @@ -2876,7 +2877,7 @@ "" ], "text": [ - "" + "" ] }, { @@ -2929,7 +2930,7 @@ "" ], "text": [ - "" + "" ] }, { @@ -3041,7 +3042,7 @@ "" ], "text": [ - "" + "" ] }, { @@ -3153,7 +3154,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -3166,7 +3167,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": null + "prompt_number": 23 } ], "metadata": {} diff --git a/tests/python/highlighting.ipynb b/tests/python/highlighting.ipynb index 37132f41d..68d96658b 100644 --- a/tests/python/highlighting.ipynb +++ b/tests/python/highlighting.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:f1eb908ff21cb1cb844770da8e495a79965a4e6417793313eb447ba80378f4b4" + "signature": "sha256:c89800970357ab95bbed91a11bd8f6c61d1861b3fb1fb1edf133500904e3a355" }, "nbformat": 3, "nbformat_minor": 0, @@ -124,7 +124,7 @@ "" ], "text": [ - "" + "" ] } ], @@ -224,7 +224,7 @@ "\n" ], "text": [ - " *' at 0x7f29585c6810> >" + " *' at 0x7f6f600c1690> >" ] } ], @@ -283,7 +283,7 @@ "\n", "\n", "0\n", - "\n", + "\n", "\n", "0\n", "\n", @@ -295,7 +295,7 @@ "\n", "\n", "1\n", - "\n", + "\n", "1\n", "\n", "\n", @@ -326,7 +326,7 @@ "\n" ], "text": [ - " *' at 0x7f295853bcc0> >" + " *' at 0x7f6f60140b40> >" ] } ],