diff --git a/oidc_example/op3/modules/login.mako.py b/oidc_example/op3/modules/login.mako.py index 6317e7fc2..af712d9e3 100644 --- a/oidc_example/op3/modules/login.mako.py +++ b/oidc_example/op3/modules/login.mako.py @@ -1,4 +1,4 @@ -from mako import runtime, filters, cache +from mako import runtime UNDEFINED = runtime.UNDEFINED STOP_RENDERING = runtime.STOP_RENDERING __M_dict_builtin = dict diff --git a/oidc_example/op3/modules/root.mako.py b/oidc_example/op3/modules/root.mako.py index 5fc5d0770..e4ea7cb10 100644 --- a/oidc_example/op3/modules/root.mako.py +++ b/oidc_example/op3/modules/root.mako.py @@ -1,4 +1,4 @@ -from mako import runtime, filters, cache +from mako import runtime, filters UNDEFINED = runtime.UNDEFINED STOP_RENDERING = runtime.STOP_RENDERING __M_dict_builtin = dict diff --git a/oidc_example/op3/server.py b/oidc_example/op3/server.py index 8a4eee6bb..9ff16134a 100755 --- a/oidc_example/op3/server.py +++ b/oidc_example/op3/server.py @@ -10,6 +10,7 @@ import traceback import argparse import importlib +import time import logging from mako.lookup import TemplateLookup @@ -29,7 +30,8 @@ from oic.utils.authn.multi_auth import AuthnIndexedEndpointWrapper from oic.utils.authn.user import UsernamePasswordMako from oic.utils.authz import AuthzHandling -from oic.utils.http_util import * +from oic.utils.http_util import NotFound, ServiceError, Response, BadRequest, wsgi_wrapper, get_post, Unauthorized +from jwkest import as_unicode from oic.utils.keyio import keyjar_init from oic.utils.userinfo import UserInfo from oic.utils.webfinger import OIC_ISSUER @@ -446,7 +448,7 @@ def mako_renderer(template_name, context): provider, # server/client instance config.keys, # key configuration kid_template="op%d") # template by which to build the kids (key ID parameter) - except Exception as err: + except Exception: # LOGGER.error("Key setup failed: %s" % err) provider.key_setup("static", sig={"format": "jwk", "alg": "rsa"}) else: diff --git a/oidc_example/rp2/oidc.py b/oidc_example/rp2/oidc.py index 0526cd278..a65ac74b1 100644 --- a/oidc_example/rp2/oidc.py +++ b/oidc_example/rp2/oidc.py @@ -302,7 +302,7 @@ def phaseN(self, environ, query, server_env, session): if isinstance(inforesp, ErrorResponse): return False, "Invalid response %s." % inforesp["error"], session - tot_info = userinfo.update(inforesp.to_dict()) + userinfo.update(inforesp.to_dict()) logger.debug("UserInfo: %s", inforesp) diff --git a/oidc_example/rp2/rp2.py b/oidc_example/rp2/rp2.py index 71f83e2fc..9a4440114 100755 --- a/oidc_example/rp2/rp2.py +++ b/oidc_example/rp2/rp2.py @@ -172,12 +172,12 @@ def application(environ, start_response): logoutUrl += "&" + urlencode({ "id_token_hint": id_token_as_signed_jwt( session['client'], "HS256")}) - except AttributeError as err: + except AttributeError: pass session.clear() resp = SeeOther(str(logoutUrl)) return resp(environ, start_response) - except Exception as err: + except Exception: LOGGER.exception("Failed to handle logout") if path == "post_logout": diff --git a/oidc_example/rp3/rp3.py b/oidc_example/rp3/rp3.py index 7c5f1878e..f31db4933 100755 --- a/oidc_example/rp3/rp3.py +++ b/oidc_example/rp3/rp3.py @@ -321,7 +321,7 @@ def application(self, environ, start_response): return result(environ, start_response) except OIDCError as err: return operror(environ, start_response, "%s" % err) - except Exception as err: + except Exception: raise else: session.update(result) diff --git a/setup.py b/setup.py index 9db62d9c4..4a90c2c1f 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,6 @@ # limitations under the License. # import re -import sys from io import open from setuptools import setup diff --git a/src/oic/extension/heart.py b/src/oic/extension/heart.py index cd2483d0a..b35b244d1 100644 --- a/src/oic/extension/heart.py +++ b/src/oic/extension/heart.py @@ -16,7 +16,6 @@ class PrivateKeyJWT(JasonWebToken): "aud": SINGLE_REQUIRED_STRING, "iss": SINGLE_REQUIRED_STRING, "sub": SINGLE_REQUIRED_STRING, - "aud": SINGLE_REQUIRED_STRING, "exp": SINGLE_REQUIRED_INT, "iat": SINGLE_REQUIRED_INT, "jti": SINGLE_REQUIRED_STRING, diff --git a/src/oic/oauth2/message.py b/src/oic/oauth2/message.py index 35c63d2b4..d066631a0 100644 --- a/src/oic/oauth2/message.py +++ b/src/oic/oauth2/message.py @@ -725,7 +725,7 @@ def verify(self, **kwargs): if cparam.required: raise MissingRequiredAttribute("%s" % attribute) continue - if cparam.type != bool and not val: + if cparam.type is not bool and not val: if cparam.required: raise MissingRequiredAttribute("%s" % attribute) continue diff --git a/src/oic/utils/keyio.py b/src/oic/utils/keyio.py index 8d83ac53e..f24443a89 100644 --- a/src/oic/utils/keyio.py +++ b/src/oic/utils/keyio.py @@ -259,7 +259,7 @@ def _parse_remote_response(self, response): def _uptodate(self): res = False - if self._keys is not []: + if self._keys != []: if self.remote: # verify that it's not to old if time.time() > self.time_out: if self.update(): diff --git a/src/oic/utils/sdb.py b/src/oic/utils/sdb.py index ba8be9db5..f4e888ad1 100644 --- a/src/oic/utils/sdb.py +++ b/src/oic/utils/sdb.py @@ -39,9 +39,9 @@ def lv_unpack(txt): txt = txt.strip() res = [] while txt: - l, v = txt.split(":", 1) - res.append(v[: int(l)]) - txt = v[int(l) :] + length, v = txt.split(":", 1) + res.append(v[: int(length)]) + txt = v[int(length) :] return res diff --git a/src/oic/utils/webfinger.py b/src/oic/utils/webfinger.py index 6f1e8834b..866e4b83d 100644 --- a/src/oic/utils/webfinger.py +++ b/src/oic/utils/webfinger.py @@ -39,7 +39,7 @@ def __setitem__(self, item, val): try: t1, t2 = spec["type"] - if t1 == list: # Should always be + if t1 is list: # Should always be assert not isinstance(val, str) # nosec assert isinstance(val, list) # nosec res = []