Commit ff6327ce authored by Svetlana A. Tkachenko's avatar Svetlana A. Tkachenko
Browse files

Remove Python version check in sed plugin

parent 98c34052
......@@ -148,15 +148,14 @@ class sed(object):
# WARNING: re.sub does not have a flags
# parameter for Python version < 2.7
# for Python < 2.7, flag 'i' will be ignored
if sys.version_info[:2] == (2, 7):
# if ignore case flag is set
flag_ignore = 0
if 'i' in sed_part3:
flag_ignore = re.I
result = re.sub(sed_part1, sed_part2, repl_message, count=flag_global, flags=flag_ignore)
else:
result = re.sub(sed_part1, sed_part2, repl_message, count=flag_global)
# if sys.version_info[:2] == (2, 7):
# # if ignore case flag is set
flag_ignore = 0
if 'i' in sed_part3:
flag_ignore = re.I
result = re.sub(sed_part1, sed_part2, repl_message, count=flag_global, flags=flag_ignore)
# else:
# result = re.sub(sed_part1, sed_part2, repl_message, count=flag_global)
# add the sed result to the backlog
self.backlog_message(channel, user, result)
......@@ -184,7 +183,7 @@ class sed(object):
modifiers = 0
# don't match 'i' (ignore-case) for Python versions < 2.7
if sys.version_info[:2] == (2, 7) and 'i' in regex_modifiers:
if 'i' in regex_modifiers:
modifiers = re.I
reg_obj = re.compile(regex, modifiers)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment