Skip to content

Commit

Permalink
fix: removed python 3.10 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Jul 29, 2024
1 parent 3f6ce90 commit abff706
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions horde/database/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ def get_total_usage():
return totals


def find_user_by_oauth_id(oauth_id) -> User | None:
def find_user_by_oauth_id(oauth_id):
if oauth_id == "anon" and not ALLOW_ANONYMOUS:
return None
return db.session.query(User).filter_by(oauth_id=oauth_id).first()


def find_user_by_username(username) -> User | None:
def find_user_by_username(username):
ulist = username.split("#")
try:
if int(ulist[-1]) == 0 and not ALLOW_ANONYMOUS:
Expand All @@ -173,21 +173,21 @@ def find_user_by_username(username) -> User | None:
return user


def find_user_by_id(user_id) -> User | None:
def find_user_by_id(user_id):
if int(user_id) == 0 and not ALLOW_ANONYMOUS:
return None
user = db.session.query(User).filter_by(id=user_id).first()
return user


def find_user_by_api_key(api_key) -> User | None:
def find_user_by_api_key(api_key):
if api_key == 0000000000 and not ALLOW_ANONYMOUS:
return None
user = db.session.query(User).filter_by(api_key=hash_api_key(api_key)).first()
return user


def find_user_by_sharedkey(shared_key) -> User | None:
def find_user_by_sharedkey(shared_key):
try:
sharedkey_uuid = uuid.UUID(shared_key)
except ValueError:
Expand Down

0 comments on commit abff706

Please sign in to comment.