Skip to content

Commit ea1f290

Browse files
committed
Remove old implementation, rename remove_unblocked2
1 parent 6750c0d commit ea1f290

File tree

2 files changed

+9
-33
lines changed

2 files changed

+9
-33
lines changed

remove_blocked.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
import pywikibot
2-
import re
1+
from RemoveBase import RemoveBlocked
32

43
if __name__ == "__main__":
5-
site = pywikibot.Site(fam="wikipedia", code="en", user="TheSandBot")
6-
pattern = r'(?:User talk:)([^/\n]+)'
7-
count = 0
8-
for page in pywikibot.Category(site, "Wikipedia usernames with possible policy issues").articles():
9-
if page.title() == "Template:Uw-corpname":
10-
continue
11-
m = re.search(pattern, str(page.title()))
12-
user_raw = m.group(1)
13-
user = pywikibot.User(site, user_raw)
14-
if user.isBlocked():
15-
with open("block_removed_mar_14_2020.txt", 'a+') as f:
16-
count += 1
17-
f.write(str(count) + " " + str(page.title()) + "\n")
18-
page.text = page.text.replace("[[Category:Wikipedia usernames with possible policy issues|{{PAGENAME}}]]",
19-
"")
20-
page.save(
21-
summary="Removing [[:Category:Wikipedia usernames with possible policy issues]] as user is blocked." +
22-
" ([[Wikipedia:Bots/Requests for approval/TheSandBot 6|BRFA]])", minor=True,
23-
botflag=True, force=True)
24-
print("Saved " + str(page.title()))
4+
rmBlocked = RemoveBlocked(log_name="block_removed_apr_3_2020.txt",
5+
category="Wikipedia usernames with possible policy issues",
6+
target="[[Category:Wikipedia usernames with possible policy issues|{{PAGENAME}}]]",
7+
brfa="TheSandBot 6")
8+
try:
9+
rmBlocked.run()
10+
except KeyboardInterrupt:
11+
print("\n")

remove_blocked2.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)