Total Complexity | 3 |
Total Lines | 14 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Test helpers.""" |
||
2 | |||
3 | |||
4 | def strip(text, tabs=None, end='\n'): |
||
5 | """Strip leading whitespace indentation on multiline string literals.""" |
||
6 | lines = [] |
||
7 | |||
8 | for line in text.strip().splitlines(): |
||
9 | if not tabs: |
||
10 | tabs = line.count(' ' * 4) |
||
11 | lines.append(line.replace(' ' * tabs * 4, '', 1)) |
||
12 | |||
13 | return '\n'.join(lines) + end |
||
14 |