flake8 pass

- fix test_empty_embed not actually reporting on empty embeds
This commit is contained in:
Luna 2019-10-25 08:06:26 -03:00
parent 1accbba002
commit 0cc1062c52
7 changed files with 16 additions and 17 deletions

View File

@ -64,7 +64,7 @@ async def register():
j = await request.get_json()
if not "password" in j:
if "password" not in j:
# we need a password to generate a token.
# passwords are optional, so
j["password"] = "default_password"

View File

@ -259,7 +259,7 @@ async def patch_me():
user_id,
)
if user["email"] is None and not "new_password" in j:
if user["email"] is None and "new_password" not in j:
raise BadRequest("missing password", {"password": "Please set a password."})
if "new_password" in j and j["new_password"]:

View File

@ -25,6 +25,10 @@ from logbook import Logger
log = Logger(__name__)
def _identity(_self, x):
return x
class Dispatcher:
"""Pub/Sub backend dispatcher.
@ -33,9 +37,8 @@ class Dispatcher:
subclasses have them implemented.
"""
# the _ parameter is for (self)
KEY_TYPE = lambda _, x: x
VAL_TYPE = lambda _, x: x
KEY_TYPE = _identity
VAL_TYPE = _identity
def __init__(self, main):
#: main EventDispatcher

View File

@ -45,7 +45,7 @@ async def task_wrapper(name: str, coro):
await coro
except asyncio.CancelledError:
pass
except:
except Exception:
log.exception("{} task error", name)

View File

@ -170,7 +170,7 @@ async def apply_migration(app, migration: Migration) -> bool:
log.info("applied {} {}", migration.id, migration.name)
return True
except:
except Exception:
log.exception("failed to run migration, rollbacking log")
await _delete_log(app, migration.id)

View File

@ -30,20 +30,16 @@ def valid(embed: dict):
try:
validate_embed(embed)
return True
except:
except Exception:
return False
def invalid(embed):
try:
validate_embed(embed)
return False
except:
return True
return not valid(embed)
def test_empty_embed():
valid({})
assert valid({})
def test_basic_embed():