Remove code smells

This commit is contained in:
Paul Bienkowski 2021-11-29 00:54:22 +01:00
parent 88ea2a44d3
commit 9ade5ecc7a
5 changed files with 5 additions and 6 deletions

View file

@ -59,7 +59,7 @@ async def init_models():
def random_string(length):
letters = string.ascii_lowercase + string.digits
return "".join(random.choice(letters) for i in range(length))
return "".join(random.choice(letters) for _ in range(length))
@asynccontextmanager

View file

@ -54,7 +54,7 @@ async def process_tracks_loop(delay):
data_source = DataSource(tile_source)
await process_track(session, track, data_source)
except:
except BaseException:
log.exception("Failed to process track. Will continue.")
await asyncio.sleep(1)
continue

View file

@ -1,7 +1,5 @@
import logging
# from sqlalchemy import select
from obs.api.app import api
from sanic.response import json

View file

@ -22,7 +22,7 @@ client = Client(client_authn_method=CLIENT_AUTHN_METHOD)
@auth.before_server_start
async def connect_auth_client(app, loop):
client.allow["issuer_mismatch"] = True
pc = client.provider_config(app.config.KEYCLOAK_URL)
client.provider_config(app.config.KEYCLOAK_URL)
client.store_registration_info(
RegistrationResponse(
client_id=app.config.KEYCLOAK_CLIENT_ID,
@ -122,6 +122,7 @@ async def login_redirect(req):
log.debug("Updating user (id: %s) email from auth system.", user.id)
user.email = email
# TODO: re-add username change when we can safely rename users
# if preferred_username != user.username:
# log.debug("Updating user (id: %s) username from auth system.", user.id)
# user.username = preferred_username

View file

@ -211,7 +211,7 @@ async def put_track(req, slug: str):
try:
body = req.json["track"]
except:
except BaseException:
body = {}
if "title" in body: