| Conditions | 2 |
| Total Lines | 33 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 18 | @staticmethod |
||
| 19 | def decode_to_url(raw_string: str) -> str: |
||
| 20 | """Decode a string to a url string |
||
| 21 | |||
| 22 | :param raw_string: String to decode |
||
| 23 | :return: Decoded string |
||
| 24 | """ |
||
| 25 | |||
| 26 | url_string = raw_string.lower() |
||
| 27 | |||
| 28 | decode_chars: Dict[str, str] = { |
||
| 29 | ", ": "_", |
||
| 30 | "+": "_", |
||
| 31 | "/": "_", |
||
| 32 | " ": "_", |
||
| 33 | "ä": "ae", |
||
| 34 | "ü": "ue", |
||
| 35 | "ö": "oe", |
||
| 36 | "ß": "ss", |
||
| 37 | ",": ".", |
||
| 38 | "é": "e", |
||
| 39 | "&": "", |
||
| 40 | "(": "", |
||
| 41 | ")": "" |
||
| 42 | } |
||
| 43 | |||
| 44 | for char in decode_chars: |
||
| 45 | url_string = url_string.replace(char, decode_chars[char]) |
||
| 46 | |||
| 47 | url_string = re.sub(r"([^a-z0-9_\-.]*)", "", url_string) |
||
| 48 | url_string = re.sub(r"([_]+)", "_", url_string) |
||
| 49 | |||
| 50 | return url_string |
||
| 51 |