diff --git a/files/classes/badges.py b/files/classes/badges.py index b0afe3079..856e65c35 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -40,7 +40,7 @@ class Badge(Base): ti = self.user.agendaposter if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S') else: text = self.badge.description + " permanently" - elif self.badge_id in (94,95,96,97,98,109): + elif self.badge_id in {94,95,96,97,98,109}: if self.badge_id == 94: ti = self.user.progressivestack elif self.badge_id == 95: ti = self.user.bird elif self.badge_id == 96: ti = self.user.flairchanged diff --git a/files/helpers/const.py b/files/helpers/const.py index 16ecb4262..76ca5546d 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -141,7 +141,7 @@ AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically remo included. \n\n*This is an automated message; if you need help, you can message us [here](/contact).*""" -if SITE in ('rdrama.net','devrama.xyz','ruqqus.us'): +if SITE in {'rdrama.net','devrama.xyz','ruqqus.us'}: NOTIFICATIONS_ID = 1046 AUTOJANNY_ID = 2360 SNAPPY_ID = 261 diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index d662c0fb4..efb4f7976 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -89,7 +89,7 @@ no_images = ['b', def sanitize_marquee(tag, name, value): if name in allowed_attributes['*'] or name in ['direction', 'behavior', 'scrollamount']: return True - if name in ['height', 'width']: + if name in {'height', 'width'}: try: value = int(value.replace('px', '')) except: return False if 0 < value <= 250: return True diff --git a/files/routes/admin.py b/files/routes/admin.py index 482ac6334..c0f2e44ad 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -510,7 +510,7 @@ def badge_grant_post(v): try: badge_id = int(request.values.get("badge_id")) except: abort(400) - if badge_id in (94,95,96,97,98,109): abort(403) + if badge_id in {94,95,96,97,98,109}: abort(403) if user.has_badge(badge_id): return render_template("admin/badge_grant.html", v=v, badge_types=badges, error="User already has that badge.") diff --git a/files/routes/discord.py b/files/routes/discord.py index 7e00b254c..19790f806 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -108,7 +108,7 @@ def discord_redirect(v): x=requests.put(url, headers=headers, json=data, timeout=5) - if x.status_code in [201, 204]: + if x.status_code in {201, 204}: if v.admin_level > 2: add_role(v, "owner") diff --git a/files/routes/posts.py b/files/routes/posts.py index f663a40eb..7773446c3 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1378,7 +1378,7 @@ def submit_post(v, sub=None): send_discord_message(new_post.permalink) cache.delete_memoized(changeloglist) - if v.id in (PIZZASHILL_ID, HIL_ID): + if v.id in {PIZZASHILL_ID, HIL_ID}: autovote = Vote(user_id=CARP_ID, submission_id=new_post.id, vote_type=1) g.db.add(autovote) autovote = Vote(user_id=AEVANN_ID, submission_id=new_post.id, vote_type=1) diff --git a/files/routes/settings.py b/files/routes/settings.py index ea1ea7025..0445ef777 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -301,7 +301,7 @@ def settings_profile_post(v): frontsize = request.values.get("frontsize") if frontsize: - if frontsize in ["25", "50", "100"]: + if frontsize in {"25", "50", "100"}: v.frontsize = int(frontsize) updated = True cache.delete_memoized(frontlist) @@ -309,28 +309,28 @@ def settings_profile_post(v): defaultsortingcomments = request.values.get("defaultsortingcomments") if defaultsortingcomments: - if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]: + if defaultsortingcomments in {"new", "old", "controversial", "top", "bottom"}: v.defaultsortingcomments = defaultsortingcomments updated = True else: abort(400) defaultsorting = request.values.get("defaultsorting") if defaultsorting: - if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]: + if defaultsorting in {"hot", "new", "old", "comments", "controversial", "top", "bottom"}: v.defaultsorting = defaultsorting updated = True else: abort(400) defaulttime = request.values.get("defaulttime") if defaulttime: - if defaulttime in ["hour", "day", "week", "month", "year", "all"]: + if defaulttime in {"hour", "day", "week", "month", "year", "all"}: v.defaulttime = defaulttime updated = True else: abort(400) theme = request.values.get("theme") if theme: - if theme in ["dramblr","classic","classic_dark","transparent", "win98", "dark", "light", "coffee", "tron", "4chan", "midnight"]: + if theme in {"dramblr","classic","classic_dark","transparent", "win98", "dark", "light", "coffee", "tron", "4chan", "midnight"}: if theme == "transparent" and not v.background: return {"error": "You need to set a background to use the transparent theme!"} v.theme = theme diff --git a/files/routes/votes.py b/files/routes/votes.py index fd8d56ef1..6f2d6ed58 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -125,7 +125,7 @@ def api_vote_comment(comment_id, new, v): comment = get_comment(comment_id) - if comment.author_id in (AUTOPOLLER_ID,AUTOBETTER_ID,AUTOCHOICE_ID): return {"error": "forbidden."}, 403 + if comment.author_id in {AUTOPOLLER_ID,AUTOBETTER_ID,AUTOCHOICE_ID}: return {"error": "forbidden."}, 403 existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none()