Skip to content

Commit

Permalink
[IMPR] Use re.sub instead of replaceExcept with empty exception list
Browse files Browse the repository at this point in the history
Change-Id: Ieb1e540eba8f7e05f061f06322f6f013ad7ef662
  • Loading branch information
xqt committed Sep 18, 2023
1 parent cf91048 commit da5d40e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/delinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
SingleSiteBot,
calledModuleName,
)
from pywikibot.textlib import case_escape, ignore_case, replaceExcept
from pywikibot.textlib import case_escape, ignore_case


class CommonsDelinker(SingleSiteBot, ConfigParserBot, AutomaticTWSummaryBot):
Expand Down Expand Up @@ -119,7 +119,7 @@ def treat(self, file_page):

def treat_page(self):
"""Delink a single page."""
new = replaceExcept(self.current_page.text, self.image_regex, '', [])
new = re.sub(self.image_regex, '', self.current_page.text)
self.put_current(new)

def teardown(self):
Expand Down

0 comments on commit da5d40e

Please sign in to comment.