mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-27 21:22:39 +01:00
Fix compatibility with Python 2.6.
This commit is contained in:
parent
1e794d88d7
commit
d2b33a3794
@ -101,7 +101,7 @@ class MultipleReplacer:
|
||||
# it to a class in Python 3.
|
||||
def __init__(self, dict_):
|
||||
self._dict = dict_
|
||||
dict_ = {re.escape(key): val for key,val in dict_.items()}
|
||||
dict_ = dict([(re.escape(key), val) for key,val in dict_.items()])
|
||||
self._matcher = re.compile('|'.join(dict_.keys()))
|
||||
def __call__(self, s):
|
||||
return self._matcher.sub(lambda m: self._dict[m.group(0)], s)
|
||||
|
Loading…
Reference in New Issue
Block a user