OSDN Git Service

autopep8
[ftg/ftg.git] / ftg / formatter / graphviz_tb.py
index 13307a9..2583a67 100755 (executable)
@@ -28,7 +28,7 @@ class GraphvizTBFormatter(BaseFormatter):
     TABLE_TO_TABLE_FORMAT_INVISIBLE = '"end${old_table_no}" -> "start${table_no}" [ ltail=cluster_t${old_table_no}, lhead=cluster_t${table_no}, color ="transparent", label="" ]'
     INSTRUCTION_TO_RESUBMIT_FORMAT = '"l${table_no}_${priority_no}_${entry_no}_${instruction_no}" -> "resubmit${table_no}" [ dirType="none", arrowhead=none, style="dotted", color="#0000CC", fontcolor="#663333", label = "" ]'
     INSTRUCTION_TO_RESUBMIT_TABLE_FORMAT = '"l${table_no}_${priority_no}_${entry_no}_${instruction_no}" -> "resubmit_from${table_no}_to${resubmit_table_no}" [ dirType="none", arrowhead=none, style="dashed", color="#0000CC", fontcolor="#663333", label = "" ];'
-    
+
     RESUBMIT_TO_START_FORMAT = '"resubmit${table_no}" -> "start${table_no}" [ style="dotted", color="#0000CC", fontcolor="#663333", label = "" ]'
     RESUBMIT_TO_TABLE_FORMAT = '"l${table_no}_${priority_no}_${entry_no}_${instruction_no}" -> "resubmit_to_t${resubmit_table_no}" [ dirType="none", arrowhead=none, style="dotted", color="#0000CC", fontcolor="#663333", label = "" ]'
 
@@ -83,7 +83,7 @@ node [
     style=dashed;
     penwidth=2;
     """
-    
+
     TABLE_END = '  }'
 
     PRIORITY_START = """
@@ -102,7 +102,7 @@ node [
         label="";
         color = "transparent";
     """
-    
+
     PRIORITY_BLOCK_END = '      }'
 
     SUMMARY_START = """
@@ -142,38 +142,58 @@ node [
 
     def set_entries_per_block(self, entries_per_block):
         self.entries_per_block = entries_per_block
-    
+
     def _initialize_templates(self):
         self.start_template = string.Template(self.START_FORMAT)
         self.end_template = string.Template(self.END_FORMAT)
         self.table_start_template = string.Template(self.TABLE_START)
         self.priority_start_template = string.Template(self.PRIORITY_START)
-        self.priority_block_start_template = string.Template(self.PRIORITY_BLOCK_START)
+        self.priority_block_start_template = string.Template(
+            self.PRIORITY_BLOCK_START)
         self.match_template = string.Template(self.MATCH_FORMAT)
-        self.instruction_output_template = string.Template(self.INSTRUCTION_OUTPUT_FORMAT)
-        self.instruction_controller_template = string.Template(self.INSTRUCTION_CONTROLLER_FORMAT)
-        self.instruction_resubmit_template = string.Template(self.INSTRUCTION_RESUBMIT_FORMAT)
-        self.instruction_drop_template = string.Template(self.INSTRUCTION_DROP_FORMAT)
-        self.instruction_other_template = string.Template(self.INSTRUCTION_OTHER_FORMAT)
-        self.match_to_instruction_template = string.Template(self.MATCH_TO_INSTRUCTION_FORMAT)
-        self.start_to_priority_template = string.Template(self.START_TO_PRIORITY_FORMAT)
-        self.priority_to_end_template = string.Template(self.PRIORITY_TO_END_FORMAT)
-        self.table_to_table_template = string.Template(self.TABLE_TO_TABLE_FORMAT)
-        self.table_to_table_invisible_template = string.Template(self.TABLE_TO_TABLE_FORMAT_INVISIBLE)
+        self.instruction_output_template = string.Template(
+            self.INSTRUCTION_OUTPUT_FORMAT)
+        self.instruction_controller_template = string.Template(
+            self.INSTRUCTION_CONTROLLER_FORMAT)
+        self.instruction_resubmit_template = string.Template(
+            self.INSTRUCTION_RESUBMIT_FORMAT)
+        self.instruction_drop_template = string.Template(
+            self.INSTRUCTION_DROP_FORMAT)
+        self.instruction_other_template = string.Template(
+            self.INSTRUCTION_OTHER_FORMAT)
+        self.match_to_instruction_template = string.Template(
+            self.MATCH_TO_INSTRUCTION_FORMAT)
+        self.start_to_priority_template = string.Template(
+            self.START_TO_PRIORITY_FORMAT)
+        self.priority_to_end_template = string.Template(
+            self.PRIORITY_TO_END_FORMAT)
+        self.table_to_table_template = string.Template(
+            self.TABLE_TO_TABLE_FORMAT)
+        self.table_to_table_invisible_template = string.Template(
+            self.TABLE_TO_TABLE_FORMAT_INVISIBLE)
         self.resubmit_template = string.Template(self.RESUBMIT_FORMAT)
-        self.resubmit_table_template = string.Template(self.RESUBMIT_TABLE_FORMAT)
-        self.block_to_block_template = string.Template(self.BLOCK_TO_BLOCK_FORMAT)
-        self.priority_to_priority_template = string.Template(self.PRIORITY_TO_PRIORITY_FORMAT)
-        self.instruction_to_resubmit_template = string.Template(self.INSTRUCTION_TO_RESUBMIT_FORMAT)
-        self.instruction_to_resubmit_table_template = string.Template(self.INSTRUCTION_TO_RESUBMIT_TABLE_FORMAT)
-        self.resubmit_to_start_template = string.Template(self.RESUBMIT_TO_START_FORMAT)
-        self.resubmit_to_table_template = string.Template(self.RESUBMIT_TO_TABLE_FORMAT)
+        self.resubmit_table_template = string.Template(
+            self.RESUBMIT_TABLE_FORMAT)
+        self.block_to_block_template = string.Template(
+            self.BLOCK_TO_BLOCK_FORMAT)
+        self.priority_to_priority_template = string.Template(
+            self.PRIORITY_TO_PRIORITY_FORMAT)
+        self.instruction_to_resubmit_template = string.Template(
+            self.INSTRUCTION_TO_RESUBMIT_FORMAT)
+        self.instruction_to_resubmit_table_template = string.Template(
+            self.INSTRUCTION_TO_RESUBMIT_TABLE_FORMAT)
+        self.resubmit_to_start_template = string.Template(
+            self.RESUBMIT_TO_START_FORMAT)
+        self.resubmit_to_table_template = string.Template(
+            self.RESUBMIT_TO_TABLE_FORMAT)
         self.group_template = string.Template(self.GROUP_FORMAT)
         self.summary_start_template = string.Template(self.SUMMARY_START)
         self.summary_end_template = string.Template(self.SUMMARY_END)
-        self.summary_table_template = string.Template(self.SUMMARY_TABLE_FORMAT)
-        self.summary_table2_template = string.Template(self.SUMMARY_TABLE2_FORMAT)
-        
+        self.summary_table_template = string.Template(
+            self.SUMMARY_TABLE_FORMAT)
+        self.summary_table2_template = string.Template(
+            self.SUMMARY_TABLE2_FORMAT)
+
     def format(self):
         formatted_flow = []
         formatted_flow.append(self.get_header())
@@ -191,13 +211,13 @@ node [
             if self.output_target_tables != []:
                 if not t_no in self.output_target_tables:
                     continue
-                    
+
             n_priority_in_table = 0
             self.resubmit_loop = False
             self.resubmit_edges = []
             self.resubmit_tables = []
             self.ranks_in_table = []
-            formatted_flow.extend( [
+            formatted_flow.extend([
                 self._format_table_start(t_no),
                 self._format_start(t_no)])
             priorities = self._tables[t_no].get_priorities()
@@ -217,10 +237,11 @@ node [
                             self._format_priority_block_start(t_no, p_no, b_no))
                         b_no += 1
                     elif (n_entry_in_priority % self.entries_per_block) == 0:
-                        formatted_flow.extend( [
+                        formatted_flow.extend([
                             self._format_priority_block_end(),
-                            self._format_block_to_block(t_no, p_no, b_no, n_entry_in_priority, self.entries_per_block),
-                            self._format_priority_block_start(t_no, p_no, b_no) ])
+                            self._format_block_to_block(
+                                t_no, p_no, b_no, n_entry_in_priority, self.entries_per_block),
+                            self._format_priority_block_start(t_no, p_no, b_no)])
                         b_no += 1
                     formatted_flow.append(
                         self._format_entry(t_no, p_no, n_entry_in_priority, ent.match_exp, ent.instructions))
@@ -228,9 +249,9 @@ node [
                 self.ranks_in_table.append(
                     self._generate_instruction_name(t_no, p_no, n_entry_in_priority - 1, "0"))
 
-                formatted_flow.extend( [
+                formatted_flow.extend([
                     self._format_priority_block_end(),
-                    self._format_priority_end() ])
+                    self._format_priority_end()])
                 n_priority_in_table += 1
                 if n_priority_in_table <= len(priorities) and n_priority_in_table != 1:
                     formatted_flow.append(self._format_priority_to_priority(
@@ -238,16 +259,17 @@ node [
                 old_p_no = p_no
                 n_entry_in_old_priority = n_entry_in_priority
 
-            formatted_flow.extend( [
+            formatted_flow.extend([
                 self._format_end(t_no),
-                self._format_priority_to_end(t_no, p_no, n_entry_in_priority - 1),
+                self._format_priority_to_end(
+                    t_no, p_no, n_entry_in_priority - 1),
                 self._format_resubmit_loop(t_no),
                 self._format_resubmit_edges(),
                 self._format_resubmit_tables(),
                 self._rank_priorities(t_no),
                 self._rank_min("start" + t_no),
                 self._rank_max("end" + t_no),
-                self._format_table_end() ])
+                self._format_table_end()])
             n_table_in_switch += 1
             if n_table_in_switch <= len(tables) and n_table_in_switch != 1:
                 formatted_flow.append(
@@ -265,16 +287,16 @@ node [
         return "l%s_%s_%s_%s" % (table_no, priority_no, entry_no, instruction_no)
 
     def _format_start(self, table_no):
-        return self.INDENT_IN_TABLE + self.start_template.substitute({"table_no":table_no})
+        return self.INDENT_IN_TABLE + self.start_template.substitute({"table_no": table_no})
 
     def _format_end(self, table_no):
-        return self.INDENT_IN_TABLE + self.end_template.substitute({"table_no":table_no})
+        return self.INDENT_IN_TABLE + self.end_template.substitute({"table_no": table_no})
 
     def _format_summary(self):
         format_summary = []
         format_summary_tables = []
         number_of_all_table_flows = 0
-        
+
         if self.output_summary:
             tables = self._tables.keys()
             for table_no in sorted(tables, key=lambda x: int(x)):
@@ -283,14 +305,17 @@ node [
                 number_of_flows = 0
                 for priority_no in sorted(priorities, key=lambda x: int(x), reverse=True):
                     number_of_priorities += 1
-                    number_of_flows += self._tables[table_no].get_priority(priority_no).get_number_of_flow_entries()
-                    self.util.debug_out("table_no:" + table_no + " priority_no:" + priority_no \
-                        + " flows:" + str(self._tables[table_no].get_priority(priority_no).get_number_of_flow_entries()))
-                
-                format_summary_tables.append(self._format_summary_table(table_no, number_of_priorities, number_of_flows))
+                    number_of_flows += self._tables[table_no].get_priority(
+                        priority_no).get_number_of_flow_entries()
+                    self.util.debug_out("table_no:" + table_no + " priority_no:" + priority_no
+                                        + " flows:" + str(self._tables[table_no].get_priority(priority_no).get_number_of_flow_entries()))
+
+                format_summary_tables.append(self._format_summary_table(
+                    table_no, number_of_priorities, number_of_flows))
                 number_of_all_table_flows += number_of_flows
-                
-            format_summary.append(self._format_summary_start(len(tables), number_of_all_table_flows))
+
+            format_summary.append(
+                self._format_summary_start(len(tables), number_of_all_table_flows))
             format_summary.extend(format_summary_tables)
             format_summary.append(self._format_summary_end())
             return "".join(format_summary)
@@ -298,104 +323,117 @@ node [
             return ""
 
     def _format_summary_start(self, number_of_tables, number_of_flows):
-        return self.summary_start_template.substitute({"number_of_tables":number_of_tables, "number_of_flows":number_of_flows})
+        return self.summary_start_template.substitute({"number_of_tables": number_of_tables, "number_of_flows": number_of_flows})
 
     def _format_summary_end(self):
         return self.summary_end_template.substitute({})
 
     def _format_summary_table(self, table_no, number_of_priorities, number_of_flows):
-        return "\n" + self.summary_table_template.substitute({"table_no":table_no, "number_of_priorities":number_of_priorities, "number_of_flows":number_of_flows})
+        return "\n" + self.summary_table_template.substitute({"table_no": table_no, "number_of_priorities": number_of_priorities, "number_of_flows": number_of_flows})
 
     def _format_summary_table2(self, table_no, number_of_priorities, number_of_flows):
-        return "\n" + self.summary_table2_template.substitute({"table_no":table_no, "number_of_priorities":number_of_priorities, "number_of_flows":number_of_flows})
+        return "\n" + self.summary_table2_template.substitute({"table_no": table_no, "number_of_priorities": number_of_priorities, "number_of_flows": number_of_flows})
 
-        
     def _format_table_start(self, table_no):
-        return self.table_start_template.substitute({"table_no":table_no})
+        return self.table_start_template.substitute({"table_no": table_no})
 
     def _format_table_end(self):
         return self.TABLE_END
 
     def _format_priority_start(self, table_no, priority_no):
-        return self.priority_start_template.substitute({"table_no":table_no, "priority_no":priority_no})
+        return self.priority_start_template.substitute({"table_no": table_no, "priority_no": priority_no})
 
     def _format_priority_end(self):
         return self.PRIORITY_END
 
     def _format_priority_block_start(self, table_no, priority_no, block_no):
-        return self.priority_block_start_template.substitute({"table_no":table_no, "priority_no":priority_no, "block_no":block_no})
+        return self.priority_block_start_template.substitute({"table_no": table_no, "priority_no": priority_no, "block_no": block_no})
 
     def _format_priority_block_end(self):
         return self.PRIORITY_BLOCK_END
 
     def _format_match(self, table_no, priority_no, entry_no, match_exp):
-        return self.match_template.substitute({"table_no":table_no, "priority_no":priority_no, \
-            "entry_no":entry_no, "match_exp":match_exp})
-    
+        return self.match_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no,
+             "entry_no": entry_no, "match_exp": match_exp})
+
     def _format_instruction_output(self, table_no, priority_no, entry_no, instruction_no, actions):
-        return self.instruction_output_template.substitute({"table_no":table_no, "priority_no":priority_no, \
-            "entry_no":entry_no, "instruction_no":instruction_no, "actions":actions})
+        return self.instruction_output_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no,
+             "entry_no": entry_no, "instruction_no": instruction_no, "actions": actions})
 
     def _format_instruction_controller(self, table_no, priority_no, entry_no, instruction_no, actions):
-        return self.instruction_controller_template.substitute({"table_no":table_no, "priority_no":priority_no, \
-            "entry_no":entry_no, "instruction_no":instruction_no, "actions":actions})
+        return self.instruction_controller_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no,
+             "entry_no": entry_no, "instruction_no": instruction_no, "actions": actions})
 
     def _format_instruction_resubmit(self, table_no, priority_no, entry_no, instruction_no, actions):
-        return self.instruction_resubmit_template.substitute({"table_no":table_no, "priority_no":priority_no, \
-            "entry_no":entry_no, "instruction_no":instruction_no, "actions":actions})
+        return self.instruction_resubmit_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no,
+             "entry_no": entry_no, "instruction_no": instruction_no, "actions": actions})
 
     def _format_instruction_drop(self, table_no, priority_no, entry_no, instruction_no, actions):
-        return self.instruction_drop_template.substitute({"table_no":table_no, "priority_no":priority_no, \
-            "entry_no":entry_no, "instruction_no":instruction_no, "actions":actions})
+        return self.instruction_drop_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no,
+             "entry_no": entry_no, "instruction_no": instruction_no, "actions": actions})
 
     def _format_instruction_other(self, table_no, priority_no, entry_no, instruction_no, actions):
-        return self.instruction_other_template.substitute({"table_no":table_no, "priority_no":priority_no, \
-            "entry_no":entry_no, "instruction_no":instruction_no, "actions":actions})
-    
+        return self.instruction_other_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no,
+             "entry_no": entry_no, "instruction_no": instruction_no, "actions": actions})
+
     def _format_entry(self, table_no, priority_no, entry_no, match_exp, instructions, counter=""):
         formatted_match_exp = self._format_match_exp(match_exp)
         formatted_str = self.INDENT_IN_PRIORITY_BLOCK + \
             self._format_match(table_no, priority_no, entry_no, formatted_match_exp) + \
             "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-            self._format_group(self._generate_match_name(table_no, priority_no, entry_no), entry_no)
-            
+            self._format_group(self._generate_match_name(
+                table_no, priority_no, entry_no), entry_no)
+
         instruction_no = 0
         self.util.debug_out("TARGET INSTRUCTION: " + str(instructions))
         instruction_set = self._split_instruction(instructions)
         for actions in instruction_set:
             if re.match(r'.* output:.*', actions) is not None or re.match(r'.* ALL.*', actions) is not None or re.match(r'.* NORMAL.*', actions) is not None or re.match(r'.* LOCAL.*', actions) is not None:
                 formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                    self._format_instruction_output(table_no, priority_no, entry_no, instruction_no, actions)
+                    self._format_instruction_output(
+                        table_no, priority_no, entry_no, instruction_no, actions)
             elif re.match(r'.* CONTROLLER:.*', actions) is not None:
                 formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                    self._format_instruction_controller(table_no, priority_no, entry_no, instruction_no, actions)
+                    self._format_instruction_controller(
+                        table_no, priority_no, entry_no, instruction_no, actions)
             elif re.match(r'.* drop', actions) is not None:
                 formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                    self._format_instruction_drop(table_no, priority_no, entry_no, instruction_no, actions)
+                    self._format_instruction_drop(
+                        table_no, priority_no, entry_no, instruction_no, actions)
             elif re.match(r'.* resubmit:\d+', actions) is not None or re.match(r'.* resubmit\(\d+,%s' % table_no, actions) is not None:
                 formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                    self._format_instruction_resubmit(table_no, priority_no, entry_no, instruction_no, actions)
-                self.resubmit_edges.append("\n" + self.INDENT_IN_TABLE \
-                    + self._format_instruction_to_resubmit(table_no, priority_no, entry_no, instruction_no))
+                    self._format_instruction_resubmit(
+                        table_no, priority_no, entry_no, instruction_no, actions)
+                self.resubmit_edges.append("\n" + self.INDENT_IN_TABLE
+                                           + self._format_instruction_to_resubmit(table_no, priority_no, entry_no, instruction_no))
                 self.resubmit_loop = True
             elif self.util.d_push(re.match(r'.* resubmit\(\d*,(\d+)\)', actions)) is not None or self.util.d_push(re.match(r'.* goto_table:(\d+)', actions)) is not None:
                 match = self.util.d_pop()
                 resubmit_table_no = match.group(1)
                 formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                    self._format_instruction_resubmit(table_no, priority_no, entry_no, instruction_no, actions)
+                    self._format_instruction_resubmit(
+                        table_no, priority_no, entry_no, instruction_no, actions)
                 self.resubmit_tables.append([table_no, resubmit_table_no])
-                self.resubmit_edges.append("\n" + self.INDENT_IN_TABLE \
-                    + self._format_instruction_to_resubmit_table(\
-                        table_no, priority_no, entry_no, instruction_no, resubmit_table_no))
+                self.resubmit_edges.append("\n" + self.INDENT_IN_TABLE
+                                           + self._format_instruction_to_resubmit_table(
+                                           table_no, priority_no, entry_no, instruction_no, resubmit_table_no))
             else:
                 formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                    self._format_instruction_other(table_no, priority_no, entry_no, instruction_no, actions)
+                    self._format_instruction_other(
+                        table_no, priority_no, entry_no, instruction_no, actions)
 
             formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
                 self._format_match_to_instruction(
                     table_no, priority_no, entry_no, instruction_no)
             formatted_str += "\n" + self.INDENT_IN_PRIORITY_BLOCK + \
-                self._format_group(self._generate_instruction_name(table_no, priority_no, entry_no, instruction_no), entry_no)
+                self._format_group(self._generate_instruction_name(
+                    table_no, priority_no, entry_no, instruction_no), entry_no)
             instruction_no += 1
         return formatted_str
 
@@ -405,28 +443,28 @@ node [
         return formatted_match_exp
 
     def _format_match_to_instruction(self, table_no, priority_no, entry_no, instruction_no):
-        return self.match_to_instruction_template.substitute( \
-            {"table_no":table_no,"priority_no":priority_no, "entry_no":entry_no, \
-            "instruction_no":instruction_no})
+        return self.match_to_instruction_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no, "entry_no": entry_no,
+             "instruction_no": instruction_no})
 
     def _format_instruction_to_resubmit(self, table_no, priority_no, entry_no, instruction_no):
         if self.output_resubmit_loop:
-            return self.instruction_to_resubmit_template.substitute( \
-                {"table_no":table_no, "priority_no":priority_no, "entry_no":entry_no, \
-                "instruction_no":instruction_no})
+            return self.instruction_to_resubmit_template.substitute(
+                {"table_no": table_no, "priority_no": priority_no, "entry_no": entry_no,
+                                                                   "instruction_no": instruction_no})
         else:
             return ""
 
     def _format_instruction_to_resubmit_table(self, table_no, priority_no, entry_no, instruction_no, resubmit_table_no):
-        return self.instruction_to_resubmit_table_template.substitute( \
-            {"table_no":table_no, "priority_no":priority_no, "entry_no":entry_no, \
-            "instruction_no":instruction_no, "resubmit_table_no":resubmit_table_no})
+        return self.instruction_to_resubmit_table_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no, "entry_no": entry_no,
+             "instruction_no": instruction_no, "resubmit_table_no": resubmit_table_no})
 
     def _format_block_to_block(self, table_no, priority_no, block_no, entry_no, entries_per_block):
-        return self.INDENT_IN_PRIORITY + self.block_to_block_template.substitute( \
-            {"table_no":table_no, "priority_no":priority_no, "entry_no":entry_no, \
-            "old_entry_no":entry_no - (entries_per_block / 2), "instruction_no":"0",\
-            "block_no":block_no, "old_block_no":block_no -1})
+        return self.INDENT_IN_PRIORITY + self.block_to_block_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no, "entry_no": entry_no,
+             "old_entry_no": entry_no - (entries_per_block / 2), "instruction_no": "0",
+             "block_no": block_no, "old_block_no": block_no - 1})
 
     def _format_priority_to_priority(self, table_no, priority_no, entry_no, entries_per_block, old_priority_no):
 #         if entry_no > (entries_per_block / 2) and entry_no > entries_per_block:
@@ -435,24 +473,26 @@ node [
 #                 table_no, priority_no, "0",\
 #                 table_no, old_priority_no, table_no, priority_no)
 #         else:
-        return self.INDENT_IN_TABLE + self.priority_to_priority_template.substitute( \
-            {"table_no":table_no, "priority_no":priority_no, "entry_no":"0",\
-            "old_priority_no":old_priority_no, "old_entry_no":entry_no - 1, "old_instruction_no":"0"})
+        return self.INDENT_IN_TABLE + self.priority_to_priority_template.substitute(
+            {"table_no": table_no, "priority_no": priority_no, "entry_no": "0",
+             "old_priority_no": old_priority_no, "old_entry_no": entry_no - 1, "old_instruction_no": "0"})
 
     def _format_start_to_priority(self, table_no, priority_no):
-        return self.INDENT_IN_TABLE + self.start_to_priority_template.substitute({"table_no":table_no, "priority_no":priority_no, "entry_no":"0"})
+        return self.INDENT_IN_TABLE + self.start_to_priority_template.substitute({"table_no": table_no, "priority_no": priority_no, "entry_no": "0"})
 
     def _format_priority_to_end(self, table_no, priority_no, entry_no):
-        return self.INDENT_IN_TABLE + self.priority_to_end_template.substitute({"table_no":table_no, "priority_no":priority_no, "entry_no":entry_no, "instruction_no":"0"})
+        return self.INDENT_IN_TABLE + self.priority_to_end_template.substitute({"table_no": table_no, "priority_no": priority_no, "entry_no": entry_no, "instruction_no": "0"})
 
     def _format_resubmit_table(self, table_no, resubmit_table_no):
-        return self.INDENT_IN_TABLE + self.resubmit_table_template.substitute({"table_no":table_no, "resubmit_table_no":resubmit_table_no})
+        return self.INDENT_IN_TABLE + self.resubmit_table_template.substitute({"table_no": table_no, "resubmit_table_no": resubmit_table_no})
 
     def _format_resubmit_loop(self, table_no):
         if self.output_resubmit_loop:
             if self.resubmit_loop:
-                return self.INDENT_IN_TABLE + self.resubmit_template.substitute({"table_no":table_no}) \
-                    + "\n" + self.INDENT_IN_TABLE + self.resubmit_to_start_template.substitute({"table_no":table_no})
+                return self.INDENT_IN_TABLE + self.resubmit_template.substitute({"table_no": table_no}) \
+                    + "\n" + self.INDENT_IN_TABLE + \
+                    self.resubmit_to_start_template.substitute(
+                        {"table_no": table_no})
             else:
                 return ""
         else:
@@ -477,21 +517,23 @@ node [
 
         for table_no, resubmit_table in resubmit_table_sets:
             if resubmit_table is not None:
-                format_resubmit_tables.append(self._format_resubmit_table(table_no, resubmit_table))
+                format_resubmit_tables.append(
+                    self._format_resubmit_table(table_no, resubmit_table))
         return "\n".join(format_resubmit_tables)
 
     def _format_table_to_table(self, table_no, old_table_no):
         if self.output_target_tables != []:
-            return self.INDENT_IN_GRAPH + self.table_to_table_invisible_template.substitute({"table_no":table_no, "old_table_no":old_table_no})
+            return self.INDENT_IN_GRAPH + self.table_to_table_invisible_template.substitute({"table_no": table_no, "old_table_no": old_table_no})
         else:
-            return self.INDENT_IN_GRAPH + self.table_to_table_template.substitute({"table_no":table_no, "old_table_no":old_table_no})
-        
+            return self.INDENT_IN_GRAPH + self.table_to_table_template.substitute({"table_no": table_no, "old_table_no": old_table_no})
+
     def _format_group(self, entry_name, group_no):
-        return self.group_template.substitute({"entry_name":entry_name, "group_no":group_no})
+        return self.group_template.substitute({"entry_name": entry_name, "group_no": group_no})
 
     def _rank_priorities(self, table_no):
         rank_priority = []
-        rank_priority.append(self.INDENT_IN_TABLE + '"start%s" -> "%s"' % (table_no, self.ranks_in_table[0]))
+        rank_priority.append(self.INDENT_IN_TABLE + '"start%s" -> "%s"' %
+                             (table_no, self.ranks_in_table[0]))
         for entry in range(1, len(self.ranks_in_table)):
             rank_priority.append(' -> "%s"' % (self.ranks_in_table[entry]))
         rank_priority.append(' -> "end%s" [color ="transparent"]' % (table_no))
@@ -506,7 +548,6 @@ node [
     def _rank_same(self, rank1, rank2):
         return self.INDENT_IN_TABLE + self.RANK_SAME_FORMAT % (rank1, rank2)
 
-    
     def _split_instruction(self, instructions):
         instruction_set = [""]
         instruction_no = 0