aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/url.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-16 20:56:46 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-10-16 20:56:46 -0700
commit5a07892bfc58472c1b651f66deaf03176bfe79df (patch)
tree6b6a7f449721c3b3515c9ae36e5be03b610c7967 /netlib/http/url.py
parent3fbce7e981cab5d20b3ef17a50f14b34e8c60fa3 (diff)
downloadmitmproxy-5a07892bfc58472c1b651f66deaf03176bfe79df.tar.gz
mitmproxy-5a07892bfc58472c1b651f66deaf03176bfe79df.tar.bz2
mitmproxy-5a07892bfc58472c1b651f66deaf03176bfe79df.zip
py2--: inline type info
Diffstat (limited to 'netlib/http/url.py')
-rw-r--r--netlib/http/url.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/netlib/http/url.py b/netlib/http/url.py
index 2878734a..67e22efa 100644
--- a/netlib/http/url.py
+++ b/netlib/http/url.py
@@ -1,4 +1,6 @@
import urllib
+from typing import Sequence
+from typing import Tuple
from netlib import utils
@@ -80,8 +82,7 @@ def unparse(scheme, host, port, path=""):
return "%s://%s%s" % (scheme, hostport(scheme, host, port), path)
-def encode(s):
- # type: Sequence[Tuple[str,str]] -> str
+def encode(s: Sequence[Tuple[str, str]]) -> str:
"""
Takes a list of (key, value) tuples and returns a urlencoded string.
"""
@@ -95,23 +96,21 @@ def decode(s):
return urllib.parse.parse_qsl(s, keep_blank_values=True, errors='surrogateescape')
-def quote(b, safe="/"):
+def quote(b: str, safe: str="/") -> str:
"""
Returns:
An ascii-encodable str.
"""
- # type: (str) -> str
return urllib.parse.quote(b, safe=safe, errors="surrogateescape")
-def unquote(s):
+def unquote(s: str) -> str:
"""
Args:
s: A surrogate-escaped str
Returns:
A surrogate-escaped str
"""
- # type: (str) -> str
return urllib.parse.unquote(s, errors="surrogateescape")