change most double quotes to single quotes

This commit is contained in:
2026-04-12 21:56:03 +03:00
parent f31752797e
commit 5d53a0d179
5 changed files with 94 additions and 94 deletions

View File

@@ -4,10 +4,10 @@ from flask import current_app
import time
class Users(Model):
table = "users"
table = 'users'
def get_avatar_url(self):
return Avatars.find({"id": self.avatar_id}).file_path
return Avatars.find({'id': self.avatar_id}).file_path
def is_default_avatar(self):
return int(Avatars.find({'id': self.avatar_id}).id) == 1
@@ -104,7 +104,7 @@ class Users(Model):
class Topics(Model):
table = "topics"
table = 'topics'
@classmethod
def get_list(_cls):
@@ -131,12 +131,12 @@ class Topics(Model):
topics.sort_order ASC"""
return db.query(q)
def get_threads(self, per_page, page, sort_by = "activity"):
order_clause = ""
if sort_by == "thread":
order_clause = "ORDER BY threads.is_stickied DESC, threads.created_at DESC"
def get_threads(self, per_page, page, sort_by = 'activity'):
order_clause = ''
if sort_by == 'thread':
order_clause = 'ORDER BY threads.is_stickied DESC, threads.created_at DESC'
else:
order_clause = "ORDER BY threads.is_stickied DESC, latest_post_created_at DESC"
order_clause = 'ORDER BY threads.is_stickied DESC, latest_post_created_at DESC'
q = """
SELECT
@@ -168,7 +168,7 @@ class Topics(Model):
users u ON u.id = posts.user_id
WHERE
threads.topic_id = ?
""" + order_clause + " LIMIT ? OFFSET ?"
""" + order_clause + ' LIMIT ? OFFSET ?'
return db.query(q, self.id, per_page, (page - 1) * per_page)
@@ -206,10 +206,10 @@ class Topics(Model):
class Threads(Model):
table = "threads"
table = 'threads'
def get_posts(self, limit, offset):
q = Posts.FULL_POSTS_QUERY + " WHERE posts.thread_id = ? ORDER BY posts.created_at ASC LIMIT ? OFFSET ?"
q = Posts.FULL_POSTS_QUERY + ' WHERE posts.thread_id = ? ORDER BY posts.created_at ASC LIMIT ? OFFSET ?'
return db.query(q, self.id, limit, offset)
def get_posts_rss(self):
@@ -263,23 +263,23 @@ class Posts(Model):
LEFT JOIN
user_badges ON users.id = user_badges.user_id"""
table = "posts"
table = 'posts'
def get_full_post_view(self):
q = f'{self.FULL_POSTS_QUERY} WHERE posts.id = ?'
return db.fetch_one(q, self.id)
class PostHistory(Model):
table = "post_history"
table = 'post_history'
class Sessions(Model):
table = "sessions"
table = 'sessions'
class Avatars(Model):
table = "avatars"
table = 'avatars'
class Subscriptions(Model):
table = "subscriptions"
table = 'subscriptions'
def get_unread_count(self):
q = """SELECT COUNT(*) AS unread_count
@@ -316,15 +316,15 @@ class APIRateLimits(Model):
return False
class Reactions(Model):
table = "reactions"
table = 'reactions'
@classmethod
def for_post(cls, post_id):
qb = db.QueryBuilder(cls.table)\
.select("reaction_text, COUNT(*) as c")\
.where({"post_id": post_id})\
.group_by("reaction_text")\
.order_by("c", False)
.select('reaction_text, COUNT(*) as c')\
.where({'post_id': post_id})\
.group_by('reaction_text')\
.order_by('c', False)
result = qb.all()
return result if result else []
@@ -342,7 +342,7 @@ class Reactions(Model):
class PasswordResetLinks(Model):
table = "password_reset_links"
table = 'password_reset_links'
class InviteKeys(Model):
@@ -446,7 +446,7 @@ class BadgeUploads(Model):
@classmethod
def get_for_user(cls, user_id):
q = "SELECT * FROM badge_uploads WHERE user_id = ? OR user_id IS NULL ORDER BY uploaded_at"
q = 'SELECT * FROM badge_uploads WHERE user_id = ? OR user_id IS NULL ORDER BY uploaded_at'
res = db.query(q, int(user_id))
return [cls.from_data(row) for row in res]