@@ -133,38 +133,11 @@ def parse_fstring(self, token: tokenize.TokenInfo):
133133 Luckily, each token records the content of the line,
134134 and we can just take what we want there.
135135 """
136- lines_contents = dict ()
137-
138- def collect_lines (token_ : tokenize .TokenInfo ):
139- # iterate over all lines that the token spans
140- token_string = token_ .line
141- i = token_ .start [0 ]
142- while i <= token_ .end [0 ]:
143- end_of_line_index = (
144- (token_string .index ("\n " ) + 1 )
145- if "\n " in token_string
146- else len (token_string )
147- )
148- line_content = token_string [:end_of_line_index ]
149-
150- # don't take the new line content if the one already stored is longer
151- if i not in lines_contents or len (lines_contents [i ]) < len (
152- line_content
153- ):
154- lines_contents [i ] = line_content
155-
156- # remainder of the line after the newline character
157- token_string = token_string [end_of_line_index :]
158- i += 1
159-
160- # Collect lines for the first and subsequent tokens that are part of the f-string
161- collect_lines (token )
162- related_lines = token .start [0 ]
163136 lines = dict (split_token_lines (token ))
164137 isin_fstring = 1
165138 for t1 in self .snakefile :
166- if t1 .end [0 ] not in lines :
167- lines .update (split_token_lines (t1 ))
139+ # if t1.end[0] not in lines: for safety, check all tokens
140+ lines .update (split_token_lines (t1 ))
168141 if t1 .type == tokenize .FSTRING_START :
169142 isin_fstring += 1
170143 elif t1 .type == tokenize .FSTRING_END :
0 commit comments