Conditions | 1 |
Total Lines | 19 |
Code Lines | 5 |
Lines | 19 |
Ratio | 100 % |
Tests | 4 |
CRAP Score | 1.008 |
Changes | 0 |
1 | 1 | import re |
|
10 | 1 | @staticmethod |
|
11 | 1 | def escape(text: str) -> str: |
|
12 | """ |
||
13 | Returns an escaped string that is safe to use in SDoc. |
||
14 | |||
15 | :param str text: The escaped string. |
||
16 | """ |
||
17 | |||
18 | 1 | def replace(match_obj): |
|
19 | """ |
||
20 | Returns the match text prefixed with backslash |
||
21 | |||
22 | :param re.match match_obj: The match. |
||
23 | |||
24 | :rtype: str |
||
25 | """ |
||
26 | return '\\' + match_obj.group(0) |
||
27 | |||
28 | 1 | return re.sub(r'[\\{}]', replace, text) |
|
29 | |||
52 |