diff options
author | Helmut Grohne <helmut@subdivi.de> | 2020-04-02 22:35:04 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2020-04-02 22:35:04 +0200 |
commit | be6834fe527823a64269c5ab1107af4c97882a44 (patch) | |
tree | 8d18e6f1d76df4e4a6f6d76704828e6e4d09a025 /wsgitools/middlewares.py | |
parent | b12055c53b09eababd1fa7260ecbe4e2e26425e9 (diff) | |
download | wsgitools-be6834fe527823a64269c5ab1107af4c97882a44.tar.gz |
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.
Diffstat (limited to 'wsgitools/middlewares.py')
-rw-r--r-- | wsgitools/middlewares.py | 6 |
1 files changed, 3 insertions, 3 deletions
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: |