Conditions | 2 |
Total Lines | 12 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | from typing import Optional |
||
10 | @staticmethod |
||
11 | def clean(string: Optional[str]) -> Optional[str]: |
||
12 | """ |
||
13 | Prunes whitespace from a string. |
||
14 | |||
15 | :param string: The string. |
||
16 | """ |
||
17 | # Return empty input immediately. |
||
18 | if not string: |
||
19 | return string |
||
20 | |||
21 | return string.replace(' ', ' ').strip() |
||
22 | |||
24 |