Use identity operators for comparison to None singleton.

PEP 8 specifies:

* Comparisons to singletons like None should always be done with `is` or
  `is not`, never the equality operators.
This commit is contained in:
Ben Finney 2022-12-19 09:41:29 +11:00
parent 4bed400c7d
commit 7118641d78

View file

@ -138,16 +138,16 @@ def get_password(user, host):
cursor.execute(db_query_getpass, {"user": user.lower(), "host": host})
data = cursor.fetchone()
cursor.close()
return data[0] if data != None else None
return data[0] if data is not None else None
def isuser(user, host):
return get_password(user, host) != None
return get_password(user, host) is not None
def auth(user, host, password):
db_password = get_password(user, host)
if db_password == None:
if db_password is None:
logging.debug("Wrong username: %s@%s" % (user, host))
return False
else: