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)
| 1563 | |
| 1564 | _line_indent_re = re.compile(r'[ \t]*') |
| 1565 | def get_line_indent(line, tabwidth): |
| 1566 | """Return a line's indentation as (# chars, effective # of spaces). |
| 1567 | |
| 1568 | The effective # of spaces is the length after properly "expanding" |
| 1569 | the tabs into spaces, as done by str.expandtabs(tabwidth). |
| 1570 | """ |
| 1571 | m = _line_indent_re.match(line) |
| 1572 | return m.end(), len(m.group().expandtabs(tabwidth)) |
| 1573 | |
| 1574 | |
| 1575 | class IndentSearcher: |
no test coverage detected
searching dependent graphs…