fix flake8 E711 (comparison-to-none)

This commit is contained in:
Pavol Rusnak 2023-01-21 15:08:59 +00:00
parent eba7319808
commit 86e8a3a315
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
9 changed files with 10 additions and 10 deletions

View File

@ -358,7 +358,7 @@ async def get_payments(
args: List[Any] = []
clause: List[str] = []
if since != None:
if since is not None:
if db.type == POSTGRES:
clause.append("time > to_timestamp(?)")
elif db.type == COCKROACH:

View File

@ -37,7 +37,7 @@ async def run_migration(db: Connection, migrations_module: Any, current_version:
print(f"running migration {db_name}.{version}")
await migrate(db)
if db.schema == None:
if db.schema is None:
await update_migration_version(db, db_name, version)
else:
async with core_db.connect() as conn:

View File

@ -120,7 +120,7 @@ async def extensions_install(
)
)
await update_installed_extension_state(
ext_id=ext_id, active=activate != None
ext_id=ext_id, active=activate is not None
)
all_extensions = list(map(lambda e: e.code, get_valid_extensions()))

View File

@ -31,7 +31,7 @@ def si_formatter(value):
the value cannot be classified.
"""
classifier = si_classifier(value)
if classifier == None:
if classifier is None:
# Don't know how to classify this value
return None
@ -48,7 +48,7 @@ def si_format(value, precision=4, long_form=False, separator=""):
"""
scaled, short_suffix, long_suffix = si_formatter(value)
if scaled == None:
if scaled is None:
# Don't know how to format this value
return value

View File

@ -58,7 +58,7 @@ async def get_jukebox_by_user(user: str) -> Optional[Jukebox]:
async def get_jukeboxs(user: str) -> List[Jukebox]:
rows = await db.fetchall('SELECT * FROM jukebox.jukebox WHERE "user" = ?', (user,))
for row in rows:
if row.sp_playlists == None:
if row.sp_playlists is None:
await delete_jukebox(row.id)
rows = await db.fetchall('SELECT * FROM jukebox.jukebox WHERE "user" = ?', (user,))

View File

@ -83,7 +83,7 @@ async def api_link_create_or_update(
detail="Min is greater than max.", status_code=HTTPStatus.BAD_REQUEST
)
if data.currency == None and (
if data.currency is None and (
round(data.min) != data.min or round(data.max) != data.max or data.min < 1
):
raise HTTPException(

View File

@ -78,7 +78,7 @@ async def api_add_or_update_item(
)
if data.unit != "sat":
data.price = data.price * 100
if item_id == None:
if item_id is None:
await add_item(
shop.id,

View File

@ -12,7 +12,7 @@ def isValidDomain(str):
# If the string is empty
# return false
if str == None:
if str is None:
return False
# Return if the string

View File

@ -41,7 +41,7 @@ class PaymentStatus(NamedTuple):
return "settled"
elif self.paid is False:
return "failed"
elif self.paid == None:
elif self.paid is None:
return "still pending"
else:
return "unknown (should never happen)"