From be6834fe527823a64269c5ab1107af4c97882a44 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 2 Apr 2020 22:35:04 +0200 Subject: avoid changing variable types The mypy type checker deals badly when a binding changes its type. To ease porting to mypy, avoid changing the type of variables. In some cases, variables can be eliminated. In other cases, they are renamed. --- wsgitools/middlewares.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wsgitools/middlewares.py') diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py index 1cb5622..3e48ee0 100644 --- a/wsgitools/middlewares.py +++ b/wsgitools/middlewares.py @@ -354,12 +354,12 @@ class BasicAuthMiddleware(AuthenticationMiddleware): def authenticate(self, auth, environ): assert isinstance(auth, str) assert isinstance(environ, dict) - auth = str2bytes(auth) + authb = str2bytes(auth) try: - auth_info = base64.b64decode(auth) + auth_infob = base64.b64decode(authb) except TypeError: raise ProtocolViolation("failed to base64 decode auth_info") - auth_info = bytes2str(auth_info) + auth_info = bytes2str(auth_infob) try: username, password = auth_info.split(':', 1) except ValueError: -- cgit v1.2.3