MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _unquoted_percent

Function _unquoted_percent

pymongo/uri_parser_shared.py:109–122  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

107
108
109def _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
125def parse_userinfo(userinfo: str) -> tuple[str, str]:

Callers 1

parse_userinfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected