From e5038c9ab7a6718e7a3408a43549231929c7beb9 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sat, 28 May 2016 22:17:02 +0200 Subject: netlib: fix most flake8 offenses --- netlib/http/headers.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'netlib/http/headers.py') diff --git a/netlib/http/headers.py b/netlib/http/headers.py index 60d3f429..2caf8d51 100644 --- a/netlib/http/headers.py +++ b/netlib/http/headers.py @@ -14,12 +14,18 @@ from ..utils import always_bytes # See also: http://lucumr.pocoo.org/2013/7/2/the-updated-guide-to-unicode/ 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 headers _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: always_bytes(x, "utf-8", "surrogateescape") + def _native(x): + return x.decode("utf-8", "surrogateescape") + + def _always_bytes(x): + return always_bytes(x, "utf-8", "surrogateescape") class Headers(MultiDict): -- cgit v1.2.3