| Total Complexity | 2 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | class WhitespaceCleaner: |
||
| 2 | """ |
||
| 3 | Utility class for cleaning whitespace from strings. |
||
| 4 | """ |
||
| 5 | |||
| 6 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 7 | @staticmethod |
||
| 8 | def clean(string): |
||
| 9 | """ |
||
| 10 | Prunes whitespace from a string. |
||
| 11 | |||
| 12 | :param str string: The string. |
||
| 13 | |||
| 14 | :rtype str: |
||
| 15 | """ |
||
| 16 | # Return empty input immediately. |
||
| 17 | if not string: |
||
| 18 | return string |
||
| 19 | |||
| 20 | return string.replace(' ', ' ').strip() |
||
| 21 | |||
| 23 |