Check for unescaped percent signs. :param s: A string. `s` can have things like '%25', '%2525', and '%E2%85%A8' but cannot have unquoted percent like '%foo'.
(s: str)
| 107 | |
| 108 | |
| 109 | def _unquoted_percent(s: str) -> bool: |
| 110 | """Check for unescaped percent signs. |
| 111 | |
| 112 | :param s: A string. `s` can have things like '%25', '%2525', |
| 113 | and '%E2%85%A8' but cannot have unquoted percent like '%foo'. |
| 114 | """ |
| 115 | for i in range(len(s)): |
| 116 | if s[i] == "%": |
| 117 | sub = s[i : i + 3] |
| 118 | # If unquoting yields the same string this means there was an |
| 119 | # unquoted %. |
| 120 | if unquote_plus(sub) == sub: |
| 121 | return True |
| 122 | return False |
| 123 | |
| 124 | |
| 125 | def parse_userinfo(userinfo: str) -> tuple[str, str]: |