import re
from .config.const import *
from .regex import NOT_IN_CODE_OR_LINKS
tranny = f'
'
trannie = f'
'
troon = f'
'
SLURS = {
"tranny": tranny,
"trannie": trannie,
"troon": troon,
"(?]*>|{slur_single_words})" + NOT_IN_CODE_OR_LINKS, flags=re.I|re.A)
profanity_regex = re.compile(f"(<[^>]*>|{profanity_single_words})" + NOT_IN_CODE_OR_LINKS, flags=re.I|re.A)
SLURS_FOR_REPLACING = {}
for k, val in SLURS.items():
newkey = k.split('(?!')[0]
if ')' in newkey:
newkey = newkey.split(')')[1]
SLURS_FOR_REPLACING[newkey] = val
PROFANITIES_FOR_REPLACING = {}
for k, val in PROFANITIES.items():
newkey = k.split('(?!')[0]
if ')' in newkey:
newkey = newkey.split(')')[1]
PROFANITIES_FOR_REPLACING[newkey] = val
def sub_matcher(match, X_FOR_REPLACING):
group_num = 0
match_str = match.group(group_num)
if match_str.startswith('<'):
return match_str
else:
repl = X_FOR_REPLACING[match_str.lower()]
if "![]()