@@ -122,20 +122,21 @@ def line(content: str, line_separator: str, config: Config = DEFAULT_CONFIG) ->
122
122
_separator = line_separator
123
123
else :
124
124
_separator = ""
125
- _comment = ""
125
+ noqa_comment = ""
126
126
if comment and "noqa" in comment :
127
- _comment = f"{ config .comment_prefix } { comment } "
127
+ noqa_comment = f"{ config .comment_prefix } { comment } "
128
128
cont_line = cont_line .rstrip ()
129
129
_comma = "," if config .include_trailing_comma else ""
130
130
output = (
131
- f"{ content } { splitter } ({ _comment } "
131
+ f"{ content } { splitter } ({ noqa_comment } "
132
132
f"{ line_separator } { cont_line } { _comma } { _separator } )"
133
133
)
134
- lines = output .split (line_separator )
135
- if config .comment_prefix in lines [- 1 ] and lines [- 1 ].endswith (")" ):
136
- content , comment = lines [- 1 ].split (config .comment_prefix , 1 )
137
- lines [- 1 ] = content + ")" + config .comment_prefix + comment [:- 1 ]
138
- return line_separator .join (lines )
134
+ lines = output .split (line_separator )
135
+ if config .comment_prefix in lines [- 1 ] and lines [- 1 ].endswith (")" ):
136
+ content , comment = lines [- 1 ].split (config .comment_prefix , 1 )
137
+ lines [- 1 ] = content + ")" + config .comment_prefix + comment [:- 1 ]
138
+ output = line_separator .join (lines )
139
+ return output
139
140
return f"{ content } { splitter } \\ { line_separator } { cont_line } "
140
141
elif len (content ) > config .line_length and wrap_mode == Modes .NOQA and "# NOQA" not in content : # type: ignore
141
142
return f"{ content } { config .comment_prefix } NOQA"
0 commit comments