Ladsgroup has uploaded a new change for review.
https://gerrit.wikimedia.org/r/104468
Change subject: removing unsed variables and imports
......................................................................
removing unsed variables and imports
using pyflakes
Change-Id: I439d14657ad3f0c58f37161739879154b620c1ce
---
M add_text.py
M category.py
M category_redirect.py
3 files changed, 4 insertions(+), 23 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat
refs/changes/68/104468/1
diff --git a/add_text.py b/add_text.py
index 475722a..6cce2e6 100644
--- a/add_text.py
+++ b/add_text.py
@@ -75,9 +75,9 @@
import re
import urllib2
-import urllib
import webbrowser
import codecs
+import time
import wikipedia as pywikibot
import config
from pywikibot import i18n
diff --git a/category.py b/category.py
index 3d06ca0..2a1eb40 100644
--- a/category.py
+++ b/category.py
@@ -810,7 +810,7 @@
articles = cat.articlesList(recurse=False)
if len(articles) == 0:
- pywikibot.output(u'There are no articles in category ' + catTitle)
+ pywikibot.output(u'There are no articles in category ' +
cat.title())
else:
preloadingGen = pagegenerators.PreloadingGenerator(iter(articles))
for article in preloadingGen:
@@ -938,7 +938,6 @@
catDB = CategoryDatabase()
action = None
sort_by_last_name = False
- restore = False
create_pages = False
follow_redirects = False
deleteEmptySourceCat = True
diff --git a/category_redirect.py b/category_redirect.py
index df22cf6..2641eeb 100644
--- a/category_redirect.py
+++ b/category_redirect.py
@@ -22,10 +22,7 @@
#
import cPickle
-import math
import re
-import sys
-import traceback
import time
from datetime import datetime, timedelta
import wikipedia as pywikibot
@@ -153,9 +150,6 @@
self.catprefix + oldCatTitle)
newCat = catlib.Category(self.site,
self.catprefix + newCatTitle)
-
- oldCatLink = oldCat.title()
- newCatLink = newCat.title()
comment = editSummary % locals()
# Move articles
found, moved = 0, 0
@@ -179,7 +173,7 @@
for item in result['categorymembers']:
doc = pywikibot.Page(self.site, item['title'] + "/doc")
try:
- old_text = doc.get()
+ doc.get()
except pywikibot.Error:
continue
changed = self.change_category(doc, oldCat, newCat,
@@ -308,13 +302,11 @@
def run(self):
"""Run the bot"""
- user = self.site.loggedInAs()
redirect_magicwords = ["redirect"]
other_words = self.site.redirect()
if other_words:
redirect_magicwords.extend(other_words)
problems = []
-
l = time.localtime()
today = "%04d-%02d-%02d" % l[:3]
edit_request_page = pywikibot.Page(
@@ -391,15 +383,7 @@
target.title(asLink=True, textlink=True)))
pywikibot.output("Done checking hard-redirect category pages.")
-
comment = i18n.twtranslate(self.site.lang, self.move_comment)
- scan_data = {
- u'action': 'query',
- u'list': 'embeddedin',
- u'einamespace': '14', # Category:
- u'eilimit': 'max',
- u'format': 'json'
- }
counts, destmap, catmap = {}, {}, {}
catlist, nonemptypages = [], []
catpages = []
@@ -430,7 +414,7 @@
% cat.title(asLink=True, textlink=True))
continue
try:
- text = cat.get(get_redirect=True)
+ cat.get(get_redirect=True)
except pywikibot.Error:
self.log_text.append(u"* Could not load %s; ignoring"
% cat.title(asLink=True, textlink=True))
@@ -525,8 +509,6 @@
pywikibot.output(u"")
pywikibot.output(u"Moving pages out of %s redirected categories."
% len(cats_to_empty))
-# thread_limit = int(math.log(len(cats_to_empty), 8) + 1)
-# threadpool = ThreadList(limit=1) # disabling multi-threads
for cat in cats_to_empty:
cat_title = cat.title(withNamespace=False)
--
To view, visit https://gerrit.wikimedia.org/r/104468
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I439d14657ad3f0c58f37161739879154b620c1ce
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits