Conditions | 1 |
Total Lines | 19 |
Code Lines | 5 |
Lines | 19 |
Ratio | 100 % |
Tests | 2 |
CRAP Score | 1.216 |
Changes | 0 |
1 | 1 | import re |
|
31 | 1 | @staticmethod |
|
32 | 1 | def unescape(text: str) -> str: |
|
33 | """ |
||
34 | Returns an unescaped SDoc escaped string. I.e. removes back slashes. |
||
35 | |||
36 | :param str text: The SDoc escaped string. |
||
37 | """ |
||
38 | |||
39 | def replace(match_obj): |
||
40 | """ |
||
41 | Returns the match text without prefixed backslash. |
||
42 | |||
43 | :param re.match match_obj: The match. |
||
44 | |||
45 | :rtype: str |
||
46 | """ |
||
47 | return match_obj.group(0)[1:] |
||
48 | |||
49 | return re.sub(r'\\.', replace, text) |
||
50 | |||
52 |