MCPcopy Index your code
hub / github.com/clips/pattern / urldecode

Function urldecode

pattern/web/__init__.py:187–205  ·  view source on GitHub ↗

Inverse operation of urllib.urlencode. Returns a dictionary of (name, value)-items from a URL query string.

(query)

Source from the content-addressed store, hash-verified

185 return os.path.splitext(filename)[1]
186
187def urldecode(query):
188 """ Inverse operation of urllib.urlencode.
189 Returns a dictionary of (name, value)-items from a URL query string.
190 """
191 def _format(s):
192 if s == "" or s == "None":
193 return None
194 if s.lstrip("-").isdigit():
195 return int(s)
196 try: return float(s)
197 except:
198 return s
199 if query:
200 query = query.lstrip("?").split("&")
201 query = ((kv.split("=") + [None])[:2] for kv in query)
202 query = ((u(urllib.unquote_plus(bytestring(k))),
203 _format(u(urllib.unquote_plus(bytestring(v))))) for k, v in query if k != "")
204 return dict(query)
205 return {}
206
207url_decode = urldecode
208

Callers 1

_parseMethod · 0.85

Calls 2

_formatFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…