diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-05-28 22:17:02 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-05-28 22:17:02 +0200 |
commit | e5038c9ab7a6718e7a3408a43549231929c7beb9 (patch) | |
tree | ba9255d148fa325a0adf0b891436cb5559b1cc1d /netlib/http/message.py | |
parent | e1cc91900f95c82e15d39cac1e0b9fa8b265d391 (diff) | |
download | mitmproxy-e5038c9ab7a6718e7a3408a43549231929c7beb9.tar.gz mitmproxy-e5038c9ab7a6718e7a3408a43549231929c7beb9.tar.bz2 mitmproxy-e5038c9ab7a6718e7a3408a43549231929c7beb9.zip |
netlib: fix most flake8 offenses
Diffstat (limited to 'netlib/http/message.py')
-rw-r--r-- | netlib/http/message.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/netlib/http/message.py b/netlib/http/message.py index b7f42515..13d401a7 100644 --- a/netlib/http/message.py +++ b/netlib/http/message.py @@ -6,14 +6,21 @@ import six from .headers import Headers from .. import encoding, utils +from ..utils import always_bytes if six.PY2: # pragma: no cover - _native = lambda x: x - _always_bytes = lambda x: x + def _native(x): + return x + + def _always_bytes(x): + return x else: - # While the HTTP head _should_ be ASCII, it's not uncommon for certain headers to be utf-8 encoded. - _native = lambda x: x.decode("utf-8", "surrogateescape") - _always_bytes = lambda x: utils.always_bytes(x, "utf-8", "surrogateescape") + # While headers _should_ be ASCII, it's not uncommon for certain headers to be utf-8 encoded. + def _native(x): + return x.decode("utf-8", "surrogateescape") + + def _always_bytes(x): + return always_bytes(x, "utf-8", "surrogateescape") class MessageData(utils.Serializable): |