From fcf30a5601fccc44dee8393fc0f967bdd11bb35a Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 29 Dec 2018 23:36:57 +0100 Subject: [PATCH] Fix FutureWarning related to nested sets. See https://bugs.python.org/issue30349 --- plugins/ChannelStats/plugin.py | 2 +- plugins/Math/plugin.py | 2 +- plugins/Nickometer/plugin.py | 2 +- src/ircutils.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/ChannelStats/plugin.py b/plugins/ChannelStats/plugin.py index 42b090389..2aa4eb5bd 100644 --- a/plugins/ChannelStats/plugin.py +++ b/plugins/ChannelStats/plugin.py @@ -292,7 +292,7 @@ class ChannelStats(callbacks.Plugin): name, channel)) stats = wrap(stats, ['channeldb', additional('something')]) - _calc_match_forbidden_chars = re.compile('[_[\]]') + _calc_match_forbidden_chars = re.compile('[_\[\]]') _env = {'__builtins__': types.ModuleType('__builtins__')} _env.update(math.__dict__) def _factorial(x): diff --git a/plugins/Math/plugin.py b/plugins/Math/plugin.py index 29bbf0bb1..88f6e1428 100644 --- a/plugins/Math/plugin.py +++ b/plugins/Math/plugin.py @@ -157,7 +157,7 @@ class Math(callbacks.Plugin): else: return '%s%s' % (realS, imagS) - _calc_match_forbidden_chars = re.compile('[_[\]]') + _calc_match_forbidden_chars = re.compile('[_\[\]]') _calc_remover = utils.str.MultipleRemover('_[] \t') ### # So this is how the 'calc' command works: diff --git a/plugins/Nickometer/plugin.py b/plugins/Nickometer/plugin.py index 0bda1442c..686ee266b 100644 --- a/plugins/Nickometer/plugin.py +++ b/plugins/Nickometer/plugin.py @@ -151,7 +151,7 @@ class Nickometer(callbacks.Plugin): 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('^([^\[\]]*)(\[)(.*)(\])([^\[\]]*)$', '\1\3\5', nick, 1) if nick == nickInitial: break self.log.debug('Removed some matching brackets %r => %r', diff --git a/src/ircutils.py b/src/ircutils.py index bc5f7a0a4..18ed806c7 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -181,7 +181,7 @@ def _hostmaskPatternEqual(pattern, hostmask): elif c == '?': fd.write('.') elif c in '[{': - fd.write('[[{]') + fd.write(r'[\[{]') elif c in '}]': fd.write(r'[}\]]') elif c in '|\\':