Completed
Push — develop ( 6c344e...20efac )
by Jace
07:26
created

tests.strip()   A

Complexity

Conditions 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 3
dl 0
loc 10
rs 9.4285
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