aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/encoding.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-16 21:17:39 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-10-16 21:17:39 -0700
commit9389601025415c47d5efaa6ac371ddca6d543f48 (patch)
tree7a2fa561d702425ccec7edbc5a35108523e3f33d /netlib/encoding.py
parentae3ff8ee1edc646e7a640219df1a312c27f7c339 (diff)
parent5a07892bfc58472c1b651f66deaf03176bfe79df (diff)
downloadmitmproxy-9389601025415c47d5efaa6ac371ddca6d543f48.tar.gz
mitmproxy-9389601025415c47d5efaa6ac371ddca6d543f48.tar.bz2
mitmproxy-9389601025415c47d5efaa6ac371ddca6d543f48.zip
Merge branch 'such-types'
Diffstat (limited to 'netlib/encoding.py')
-rw-r--r--netlib/encoding.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/netlib/encoding.py b/netlib/encoding.py
index f0f7381d..a6ae9a96 100644
--- a/netlib/encoding.py
+++ b/netlib/encoding.py
@@ -11,7 +11,7 @@ import gzip
import zlib
import brotli
-from typing import Union # noqa
+from typing import Union
# We have a shared single-element cache for encoding and decoding.
@@ -22,8 +22,7 @@ CachedDecode = collections.namedtuple("CachedDecode", "encoded encoding errors d
_cache = CachedDecode(None, None, None, None)
-def decode(encoded, encoding, errors='strict'):
- # type: (Union[str, bytes], str, str) -> Union[str, bytes]
+def decode(encoded: Union[str, bytes], encoding: str, errors: str='strict') -> Union[str, bytes]:
"""
Decode the given input object
@@ -64,8 +63,7 @@ def decode(encoded, encoding, errors='strict'):
))
-def encode(decoded, encoding, errors='strict'):
- # type: (Union[str, bytes], str, str) -> Union[str, bytes]
+def encode(decoded: Union[str, bytes], encoding: str, errors: str='strict') -> Union[str, bytes]:
"""
Encode the given input object