AutoMode, Channel, Nickometer: fix invalid escape sequence DeprecationWarning

This commit is contained in:
James Lu 2020-01-26 11:20:21 -08:00
parent 772862d49c
commit 304125cfd0
3 changed files with 6 additions and 6 deletions

View File

@ -108,7 +108,7 @@ class AutoMode(callbacks.Plugin):
user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
except KeyError:
return
pattern = re.compile('-|\+')
pattern = re.compile(r'-|\+')
for item in self.registryValue('extra', channel, network):
try:
username, modes = pattern.split(item, maxsplit=1)

View File

@ -620,7 +620,7 @@ class Channel(callbacks.Plugin):
If you have the #channel,op capability, this will show you the
current persistent bans on the <channel> that match the given
mask, if any (returns all of them otherwise).
Note that you can use * as a wildcard on masks and \* to match
Note that you can use * as a wildcard on masks and \\* to match
actual * in masks
"""
all_bans = ircdb.channels.getChannel(channel).bans

View File

@ -139,7 +139,7 @@ class Nickometer(callbacks.Plugin):
nick=re.sub('^C--$', 'C', nick);
# Punish consecutive non-alphas
matches=re.findall('[^\w\d]{2,}',nick)
matches=re.findall(r'[^\w\d]{2,}',nick)
for match in matches:
score += self.punish(slowPow(10, len(match)),
'%s consecutive non-alphas ' % len(match))
@ -147,9 +147,9 @@ class Nickometer(callbacks.Plugin):
# Remove balanced brackets ...
while True:
nickInitial = nick
nick=re.sub('^([^()]*)(\()(.*)(\))([^()]*)$', '\1\3\5', nick, 1)
nick=re.sub('^([^{}]*)(\{)(.*)(\})([^{}]*)$', '\1\3\5', nick, 1)
nick=re.sub('^([^\[\]]*)(\[)(.*)(\])([^\[\]]*)$', '\1\3\5', nick, 1)
nick = re.sub(r'^([^()]*)(\()(.*)(\))([^()]*)$', r'\1\3\5', nick, 1)
nick = re.sub(r'^([^{}]*)(\{)(.*)(\})([^{}]*)$', r'\1\3\5', nick, 1)
nick = re.sub(r'^([^\[\]]*)(\[)(.*)(\])([^\[\]]*)$', r'\1\3\5', nick, 1)
if nick == nickInitial:
break
self.log.debug('Removed some matching brackets %r => %r',