@@ -26,15 +26,6 @@ def __init__(self, file_path, model_name=None):
2626 super ().__init__ (file_path , model_name )
2727 self .line_length = 100
2828
29- def __buff_to_string (self , buff ):
30- string = ""
31-
32- for line in buff :
33- string = string + line + "\n "
34-
35- # cut off the last \n
36- return string [:- 1 ]
37-
3829 def __get_enum_states_content (self ) -> list [str ]:
3930 buff = []
4031 buff .append ("\t %s%s = 0," % (self .initial_state , self .enum_suffix ))
@@ -45,14 +36,10 @@ def __get_enum_states_content(self) -> list[str]:
4536
4637 return buff
4738
48- def get_enum_states_string (self ):
49- buff = self .__get_enum_states_content ()
50- return self .__buff_to_string (buff )
51-
5239 def format_states_enum (self ) -> list [str ]:
5340 buff = []
5441 buff .append ("enum %s {" % self .enum_states_def )
55- buff . append ( self .get_enum_states_string () )
42+ buff += self .__get_enum_states_content ( )
5643 buff .append ("};\n " )
5744
5845 return buff
@@ -71,14 +58,10 @@ def __get_enum_events_content(self) -> list[str]:
7158
7259 return buff
7360
74- def get_enum_events_string (self ):
75- buff = self .__get_enum_events_content ()
76- return self .__buff_to_string (buff )
77-
7861 def format_events_enum (self ) -> list [str ]:
7962 buff = []
8063 buff .append ("enum %s {" % self .enum_events_def )
81- buff . append ( self .get_enum_events_string () )
64+ buff += self .__get_enum_events_content ( )
8265 buff .append ("};\n " )
8366
8467 return buff
@@ -127,23 +110,17 @@ def __get_string_vector_per_line_content(self, buff: list[str]) -> str:
127110
128111 return string
129112
130- def get_aut_init_events_string (self ):
131- return self .__get_string_vector_per_line_content (self .events )
132-
133- def get_aut_init_states_string (self ):
134- return self .__get_string_vector_per_line_content (self .states )
135-
136113 def format_aut_init_events_string (self ) -> list [str ]:
137114 buff = []
138115 buff .append ("\t .event_names = {" )
139- buff .append (self .get_aut_init_events_string ( ))
116+ buff .append (self .__get_string_vector_per_line_content ( self . events ))
140117 buff .append ("\t }," )
141118 return buff
142119
143120 def format_aut_init_states_string (self ) -> list [str ]:
144121 buff = []
145122 buff .append ("\t .state_names = {" )
146- buff .append (self .get_aut_init_states_string ( ))
123+ buff .append (self .__get_string_vector_per_line_content ( self . states ))
147124 buff .append ("\t }," )
148125
149126 return buff
@@ -178,7 +155,7 @@ def get_aut_init_function(self) -> str:
178155 line += "\n \t \t }," if linetoolong else " },"
179156 buff .append (line )
180157
181- return self . __buff_to_string (buff )
158+ return ' \n ' . join (buff )
182159
183160 def format_aut_init_function (self ) -> list [str ]:
184161 buff = []
@@ -253,4 +230,4 @@ def format_model(self) -> list[str]:
253230
254231 def print_model_classic (self ):
255232 buff = self .format_model ()
256- print (self . __buff_to_string (buff ))
233+ print (' \n ' . join (buff ))
0 commit comments