Skip to content

Commit

Permalink
Fix reported errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tpazderka committed Nov 11, 2024
1 parent 68af14d commit bd7e410
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion oidc_example/op3/modules/login.mako.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion oidc_example/op3/modules/root.mako.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions oidc_example/op3/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import traceback
import argparse
import importlib
import time
import logging

from mako.lookup import TemplateLookup
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion oidc_example/rp2/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions oidc_example/rp2/rp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion oidc_example/rp3/rp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
#
import re
import sys
from io import open

from setuptools import setup
Expand Down
1 change: 0 additions & 1 deletion src/oic/extension/heart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/oic/oauth2/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/oic/utils/keyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
6 changes: 3 additions & 3 deletions src/oic/utils/sdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/oic/utils/webfinger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down

0 comments on commit bd7e410

Please sign in to comment.