Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/282368
Change subject: [compat2core] combat to core conversion
......................................................................
[compat2core] combat to core conversion
- self.templates never used; remove it
- templatesWithParams() gives a Page object instead a str. The title is
already normalized then.
- use two variables for assigning the tuple
- singleton comparison should use "is" instead of "==" due to PEP8
Change-Id: Id5d27004dbefb989d14e9f3f6217f869239ea3a1
---
M imagereview.py
1 file changed, 7 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot
refs/changes/68/282368/1
diff --git a/imagereview.py b/imagereview.py
index c9526f6..58f99f6 100644
--- a/imagereview.py
+++ b/imagereview.py
@@ -214,7 +214,6 @@
def __init__(self, site, title, text=None, timestamp=None):
pywikibot.ImagePage.__init__(self, site, title)
self._contents = text
- self.templates = []
self.reasons = set()
self.info = False
self.done = None
@@ -223,17 +222,15 @@
# breaking change mit
# https://www.mediawiki.org/wiki/Special:Code/pywikipedia/11347
# Vorlage sind damit normalisiert!
- TEMPL = (u'DÜP', u'dÜP', u'Düp', u'düp', u'Dateiüberprüfung',
- u'dateiüberprüfung',)
+ TEMPL = ('DÜP', 'Düp', 'Dateiüberprüfung')
if self._contents:
self.done = u"3=[[Benutzer:Xqbot|Xqbot]]" in self._contents
- for t in self.templatesWithParams():
- if t[0] in TEMPL:
- self.templates.append(t[0])
- for r in t[1]:
+ for tpl, param in self.templatesWithParams():
+ if tpl.title(withNamespace=False) in TEMPL:
+ for r in param:
if r.strip():
self.reasons.add(r.strip())
- if t[0] in (u'Information', 'information'):
+ if tpl.title(withNamespace=False) is 'Information':
self.info = True
@property
@@ -385,9 +382,9 @@
choice = pywikibot.inputChoice(
u'Do you want to accept these changes?',
['Yes', 'No', 'Always yes'], ['y', 'N', 'a'], 'N')
- if choice == 'n':
+ if choice is 'n':
return
- elif choice == 'a':
+ elif choice is 'a':
self.options['always'] = True
try:
--
To view, visit https://gerrit.wikimedia.org/r/282368
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5d27004dbefb989d14e9f3f6217f869239ea3a1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits