(self, f)
| 174 | class Reindenter: |
| 175 | |
| 176 | def __init__(self, f): |
| 177 | self.find_stmt = 1 # next token begins a fresh stmt? |
| 178 | self.level = 0 # current indent level |
| 179 | |
| 180 | # Raw file lines. |
| 181 | self.raw = f.readlines() |
| 182 | |
| 183 | # File lines, rstripped & tab-expanded. Dummy at start is so |
| 184 | # that we can use tokenize's 1-based line numbering easily. |
| 185 | # Note that a line is all-blank iff it's "\n". |
| 186 | self.lines = [_rstrip(line).expandtabs() + "\n" |
| 187 | for line in self.raw] |
| 188 | self.lines.insert(0, None) |
| 189 | self.index = 1 # index into self.lines of next line |
| 190 | |
| 191 | # List of (lineno, indentlevel) pairs, one for each stmt and |
| 192 | # comment line. indentlevel is -1 for comment lines, as a |
| 193 | # signal that tokenize doesn't know what to do about them; |
| 194 | # indeed, they're our headache! |
| 195 | self.stats = [] |
| 196 | |
| 197 | # Save the newlines found in the file so they can be used to |
| 198 | # create output without mutating the newlines. |
| 199 | self.newlines = f.newlines |
| 200 | |
| 201 | def run(self): |
| 202 | tokens = tokenize.generate_tokens(self.getline) |
nothing calls this directly
no test coverage detected