Skip to content

Commit

Permalink
cleanup: Remove unused default for otherid in collection functions,…
Browse files Browse the repository at this point in the history
… and enforce kwargs for more parameters
  • Loading branch information
charmander committed Sep 13, 2024
1 parent a7fee29 commit 07228e9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions weasyl/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from weasyl.error import PostgresError, WeasylError


def select_query(userid, rating, otherid=None, pending=False, backid=None, nextid=None):
def select_query(userid, *, rating, otherid, pending=False, backid=None, nextid=None):
"""
Build a query to select a list of collections, joined on submission table
and profile of the submitter
Expand Down Expand Up @@ -61,18 +61,18 @@ def select_query(userid, rating, otherid=None, pending=False, backid=None, nexti
return statement


def select_count(userid, rating, otherid=None, pending=False, backid=None, nextid=None):
def select_count(userid, rating, *, otherid, pending=False, backid=None, nextid=None):
statement = ["SELECT count(su.submitid) "]
statement.extend(select_query(userid, rating, otherid, pending,
backid, nextid))
statement.extend(select_query(userid, rating=rating, otherid=otherid, pending=pending,
backid=backid, nextid=nextid))
return d.execute("".join(statement))[0][0]


def select_list(userid, rating, limit, otherid=None, pending=False, backid=None, nextid=None):
def select_list(userid, rating, limit, *, otherid, pending=False, backid=None, nextid=None):
statement = ["SELECT su.submitid, su.title, su.subtype, su.rating, co.unixtime, "
"su.userid, pr.username, cpr.username, cpr.userid "]
statement.extend(select_query(userid, rating, otherid, pending,
backid, nextid))
statement.extend(select_query(userid, rating=rating, otherid=otherid, pending=pending,
backid=backid, nextid=nextid))
statement.append(" ORDER BY co.unixtime%s LIMIT %i" % ("" if backid else " DESC", limit))

query = []
Expand Down

0 comments on commit 07228e9

Please sign in to comment.