jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/592679 )
Change subject: Improvements for replace.py
......................................................................
Improvements for replace.py
Detached from I600816e5a297427159c5bbedad988c0dfd823868
Change-Id: Iffa58bf64e731a738aba562e24a91adfeb05df0f
Signed-off-by: xqt <info(a)gno.de>
---
M scripts/replace.py
1 file changed, 5 insertions(+), 18 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py
index a50c778..4f7d75d 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -895,12 +895,8 @@
# will become True when the user presses a ('yes to all') or uses the
# -always flag.
acceptall = False
- # Will become True if the user inputs the commandline parameter -nocase
- caseInsensitive = False
- # Will become True if the user inputs the commandline parameter -dotall
- dotall = False
- # Will become True if the user inputs the commandline parameter -multiline
- multiline = False
+ # Set the default regular expression flags
+ flags = re.UNICODE
# Do all hits when they overlap
allowoverlap = False
# Do not recurse replacement
@@ -961,11 +957,11 @@
elif arg == '-recursive':
recursive = True
elif arg == '-nocase':
- caseInsensitive = True
+ flags |= re.IGNORECASE
elif arg == '-dotall':
- dotall = True
+ flags |= re.DOTALL
elif arg == '-multiline':
- multiline = True
+ flags |= re.MULTILINE
elif arg.startswith('-addcat:'):
add_cat = arg[8:]
elif arg.startswith('-summary:'):
@@ -1139,15 +1135,6 @@
else:
edit_summary = ''
- # Set the regular expression flags
- flags = re.UNICODE
- if caseInsensitive:
- flags = flags | re.IGNORECASE
- if dotall:
- flags = flags | re.DOTALL
- if multiline:
- flags = flags | re.MULTILINE
-
# Pre-compile all regular expressions here to save time later
for replacement in replacements:
replacement.compile(regex, flags)
--
To view, visit
https://gerrit.wikimedia.org/r/592679
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iffa58bf64e731a738aba562e24a91adfeb05df0f
Gerrit-Change-Number: 592679
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)disroot.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)