Return a line's indentation as (# chars, effective # of spaces). The effective # of spaces is the length after properly "expanding" the tabs into spaces, as done by str.expandtabs(tabwidth).
(line, tabwidth)
| 200 | _line_indent_re = re.compile(r'[ \t]*') |
| 201 | |
| 202 | def get_line_indent(line, tabwidth): |
| 203 | """Return a line's indentation as (# chars, effective # of spaces). |
| 204 | |
| 205 | The effective # of spaces is the length after properly "expanding" |
| 206 | the tabs into spaces, as done by str.expandtabs(tabwidth). |
| 207 | """ |
| 208 | m = _line_indent_re.match(line) |
| 209 | return m.end(), len(m.group().expandtabs(tabwidth)) |
| 210 | |
| 211 | |
| 212 | class FormatRegion: |
no test coverage detected
searching dependent graphs…