From 0455ad49104e713b1f5c05bd0b9c23b310540717 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 29 Sep 2023 04:29:14 +0300 Subject: [PATCH] capitalization consistency --- files/helpers/const_stateful.py | 20 ++++++++++---------- files/helpers/marsify.py | 6 +++--- files/helpers/sanitize.py | 2 +- files/routes/login.py | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/files/helpers/const_stateful.py b/files/helpers/const_stateful.py index 65d905fa1..95016df51 100644 --- a/files/helpers/const_stateful.py +++ b/files/helpers/const_stateful.py @@ -4,9 +4,9 @@ from files.classes import Emoji, Sub from files.helpers.config.const import * SNAPPY_KONGS = [] -marseys_const = [] -marseys_const2 = [] -marsey_mappings = {} +MARSEYS_CONST = [] +MARSEYS_CONST2 = [] +MARSEY_MAPPINGS = {} SNAPPY_MARSEYS = [] SNAPPY_QUOTES = [] SNAPPY_QUOTES_FISTMAS = [] @@ -14,19 +14,19 @@ SNAPPY_QUOTES_HOMOWEEN = [] STEALTH_HOLES = [] def const_initialize(): - global marseys_const, marseys_const2, marsey_mappings, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES + global MARSEYS_CONST, MARSEYS_CONST2, MARSEY_MAPPINGS, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES db = db_session() - marseys_const = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None, Emoji.name!='chudsey')] - marseys_const2 = marseys_const + ['chudsey','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark'] + MARSEYS_CONST = [x[0] for x in db.query(Emoji.name).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None, Emoji.name!='chudsey')] + MARSEYS_CONST2 = MARSEYS_CONST + ['chudsey','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark'] marseys = db.query(Emoji).filter(Emoji.kind=="Marsey", Emoji.submitter_id==None).all() for marsey in marseys: for tag in marsey.tags.split(): - if tag in marsey_mappings: - marsey_mappings[tag].append(marsey.name) + if tag in MARSEY_MAPPINGS: + MARSEY_MAPPINGS[tag].append(marsey.name) else: - marsey_mappings[tag] = [marsey.name] + MARSEY_MAPPINGS[tag] = [marsey.name] SNAPPY_KONGS = db.query(Emoji.name).filter(Emoji.kind=="Donkey Kong", Emoji.submitter_id==None).all() SNAPPY_KONGS = [f':#{x[0]}:' for x in SNAPPY_KONGS] @@ -36,7 +36,7 @@ def const_initialize(): db.commit() db.close() - SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2] + SNAPPY_MARSEYS = [f':#{x}:' for x in MARSEYS_CONST2] try: with open(f"snappy_{SITE_NAME}.txt", "r") as f: diff --git a/files/helpers/marsify.py b/files/helpers/marsify.py index a212e0a6a..346c0ec48 100644 --- a/files/helpers/marsify.py +++ b/files/helpers/marsify.py @@ -1,6 +1,6 @@ from random import choice -from .const_stateful import marsey_mappings +from .const_stateful import MARSEY_MAPPINGS def marsify(text): if '`' in text or '
' in text or '' in text:
@@ -10,7 +10,7 @@ def marsify(text):
 	for x in text.split(' '):
 		new_text += f'{x} '
 		x = x.lower()
-		if len(x) >= 5 and x in marsey_mappings:
-			marsey = choice(marsey_mappings[x])
+		if len(x) >= 5 and x in MARSEY_MAPPINGS:
+			marsey = choice(MARSEY_MAPPINGS[x])
 			new_text += f':{marsey}: '
 	return new_text
diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index 54818c8ec..8b7e1da18 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -284,7 +284,7 @@ def render_emoji(html, regexp, golden, emojis_used, b=False, is_title=False):
 		attrs = ''
 		if b: attrs += ' b'
 		if is_title: emoji = emoji.replace('#','')
-		if golden and len(emojis) <= 20 and ('marsey' in emoji or emoji in marseys_const2):
+		if golden and len(emojis) <= 20 and ('marsey' in emoji or emoji in MARSEYS_CONST2):
 			if random.random() < 0.005:
 				attrs += ' ' + random.choice(('g', 'glow', 'party'))
 
diff --git a/files/routes/login.py b/files/routes/login.py
index f57993245..a51035d65 100644
--- a/files/routes/login.py
+++ b/files/routes/login.py
@@ -302,7 +302,7 @@ def sign_up_post(v):
 
 	profileurl = None
 	if PFP_DEFAULT_MARSEY:
-		profileurl = '/e/' + random.choice(marseys_const) + '.webp'
+		profileurl = '/e/' + random.choice(MARSEYS_CONST) + '.webp'
 
 	new_user = User(
 		username=username,