@@ -23,7 +23,7 @@ def length(self) -> int:
2323
2424 @property
2525 def tag_and_value (self ) -> str :
26- return f'{ self .tag } ={ self .value } , '
26+ return f'{ self .tag } ={ self .value } '
2727
2828 @property
2929 def info_comment (self ) -> str :
@@ -66,7 +66,7 @@ def __init__(
6666
6767 def get_string (self , indent : int = 1 ):
6868 self .tb : str = " "
69- self .indent : int = 1
69+ self .indent : int = indent
7070 ind = self .indent * self .tb
7171 name = self .namespaced_identifier
7272 alias = " as " + self .alias if self .alias else "" # alias is always being supplied, but this implies its not?
@@ -97,17 +97,18 @@ def input_section_to_string(self, lines: list[StepValueLine]) -> str:
9797
9898 # render 'unknown' input messages
9999 if self .render_comments :
100- str_lines += [f'{ ind } { self .tb } #{ m } ,' for m in self .messages ]
100+ str_lines += [f'{ ind } { self .tb } #{ msg } ,' for msg in self .messages ]
101101
102102 # calc longest line so we know how to justify info comments
103- max_line_len = max ([ln .length for ln in lines ])
103+ justification = max ([ln .length for ln in lines ]) + 2
104104
105- # generate string representaiton of each line
106- for ln in lines :
105+ # generate string representation of each line
106+ for i , ln in enumerate (lines ):
107+ comma = ',' if i < len (lines ) - 1 else '' # ignore comma for last line
107108 if self .render_comments :
108- str_line = f'{ ind } { self .tb } { ln .tag_and_value :<{max_line_len + 2 }} { ln .info_comment } '
109+ str_line = f'{ ind } { self .tb } { ln .tag_and_value + comma :<{justification }} { ln .info_comment } '
109110 else :
110- str_line = f'{ ind } { self .tb } { ln .tag_and_value } '
111+ str_line = f'{ ind } { self .tb } { ln .tag_and_value + comma } '
111112 str_lines .append (str_line )
112113
113114 # join lines and return body segment
@@ -143,6 +144,6 @@ def get_string(self, indent=1):
143144
144145 body = "\n " .join (c .get_string (indent = indent + 1 ) for c in self .calls )
145146
146- return "{ind}scatter ({st}) {{\n {body}\n {ind}}}" .format (
147+ return "{ind}scatter ({st}) {{\n {body}\n {ind}}}" .format (
147148 ind = indent * " " , st = scatter_iteration_statement , body = body
148149 )
0 commit comments