File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 28
28
# mypy: disallow_untyped_calls=True
29
29
30
30
31
- from typing import MutableMapping , Iterable , TextIO , Optional
31
+ from typing import MutableMapping , Iterable , TextIO
32
32
from pygments .formatter import Formatter
33
33
from pygments .token import (
34
34
_TokenType ,
@@ -120,14 +120,15 @@ def format(
120
120
) -> None :
121
121
o : str = ""
122
122
for token , text in tokensource :
123
- t : Optional [_TokenType ] = token
124
123
if text == "\n " :
125
124
continue
126
125
127
- while t not in self .f_strings :
128
- if t is not None :
129
- t = t .parent
130
- o += f"{ self .f_strings [t ]} \x03 { text } \x04 "
126
+ while token not in self .f_strings :
127
+ if token .parent is None :
128
+ break
129
+ else :
130
+ token = token .parent
131
+ o += f"{ self .f_strings [token ]} \x03 { text } \x04 "
131
132
outfile .write (o .rstrip ())
132
133
133
134
You can’t perform that action at this time.
0 commit comments