jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/361699 )
Change subject: [bugfix] Only force input_choise if self.always is given
......................................................................
[bugfix] Only force input_choise if self.always is given
- To force the default input choice, a default value must be given already.
Otherwise a ValueError will be raised.
Bug: T161483
Change-Id: Iad3f8cb603807ee8e60e604662e419f2affdc3d6
---
M scripts/solve_disambiguation.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 618503c..7716173 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -71,7 +71,7 @@
# (C) Daniel Herding, 2004
# (C) Andre Engels, 2003-2004
# (C) WikiWichtel, 2004
-# (C) Pywikibot team, 2003-2016
+# (C) Pywikibot team, 2003-2017
#
# Distributed under the terms of the MIT license.
#
@@ -837,7 +837,7 @@
# TODO: Output context on each question
answer = pywikibot.input_choice('Option', options,
default=self.always,
- force=True)
+ force=bool(self.always))
if answer == 'x':
assert edited, 'invalid option before editing'
break
--
To view, visit https://gerrit.wikimedia.org/r/361699
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iad3f8cb603807ee8e60e604662e419f2affdc3d6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: JAn Dudík <jan.dudik(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/361389 )
Change subject: [L10N] Disable cleanUpSectionHeaders on jbo.wiktionary
......................................................................
[L10N] Disable cleanUpSectionHeaders on jbo.wiktionary
Bug: T168399
Change-Id: I56c14109feedef77d8ecfe40b7196ef9cbe562dc
---
M pywikibot/cosmetic_changes.py
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, but someone else must approve
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index e160467..8c04c98 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -633,9 +633,12 @@
Example: ==Section title== becomes == Section title ==
NOTE: This space is recommended in the syntax help on the English and
- German Wikipedia. It might be that it is not wanted on other wikis.
- If there are any complaints, please file a bug report.
+ German Wikipedia. It is not wanted on Lojban Wiktionary (per T168399)
+ and it might be that it is not wanted on other wikis. If there are any
+ complaints, please file a bug report.
"""
+ if self.site.sitename == 'wiktionary:jbo':
+ return text
return textlib.replaceExcept(
text,
r'(?m)^(={1,7}) *(?P<title>[^=]+?) *\1 *\r?\n',
--
To view, visit https://gerrit.wikimedia.org/r/361389
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I56c14109feedef77d8ecfe40b7196ef9cbe562dc
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Hashar <hashar(a)free.fr>
Gerrit-Reviewer: JAn Dudík <jan.dudik(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Maven-release-user <maven-release-user(a)wikimedia.org>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xbony2 <xbony22(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/361306 )
Change subject: replace.py: do not overwrite exceptions given via CLI
......................................................................
replace.py: do not overwrite exceptions given via CLI
Exceptions specified via 'fix' shall not replace those entered via CLI.
They should be merged instead.
Bug: T142324
Change-Id: If9eb6bed1f4221023658292aa705e31de1611a00
---
M scripts/replace.py
1 file changed, 7 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/replace.py b/scripts/replace.py
index 34671fb..4357358 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -1086,9 +1086,15 @@
edit_summary=summary,
))
+ # Exceptions specified via 'fix' shall be merged to those via CLI.
if replacement_set:
replacements.extend(replacement_set)
- exceptions = replacement_set._exceptions
+ if replacement_set._exceptions is not None:
+ for k, v in replacement_set._exceptions.items():
+ if k in exceptions:
+ exceptions[k] = list(set(exceptions[k]) | set(v))
+ else:
+ exceptions[k] = v
if len(fix['replacements']) == len(missing_fix_summaries):
missing_fixes_summaries.append(
--
To view, visit https://gerrit.wikimedia.org/r/361306
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If9eb6bed1f4221023658292aa705e31de1611a00
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/360948 )
Change subject: Don't loop over user contribs
......................................................................
Don't loop over user contribs
- The current implementation loops over user contribs when the total number
is below given max which is 500. Just use site.usercontribs with the
given parameters to solve this bug.
- pagegenerators aren't used and could be removed.
- StopIteration is senseless here. The for-loop in revert_contribs stops
when the generator has finished.
- Keep lines below 80 chars due to PEP8
Bug: T168666
Change-Id: Ib34fcb193e76c37910eda6e15f031afe10b6ce5e
---
M scripts/revertbot.py
1 file changed, 14 insertions(+), 36 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/revertbot.py b/scripts/revertbot.py
index 1f649fd..3752a3a 100755
--- a/scripts/revertbot.py
+++ b/scripts/revertbot.py
@@ -14,7 +14,7 @@
"""
#
# (C) Bryan Tong Minh, 2008
-# (C) Pywikibot team, 2008-2016
+# (C) Pywikibot team, 2008-2017
#
# Ported by Geoffrey "GEOFBOT" Mon - User:Sn1per
# for Google Code-In 2013
@@ -29,15 +29,8 @@
import re
import pywikibot
-
from pywikibot import i18n
-from pywikibot import pagegenerators
-
from pywikibot.tools.formatter import color_format
-
-docuReplacements = {
- '¶ms;': pagegenerators.parameterHelp
-}
class BaseRevertBot(object):
@@ -59,39 +52,22 @@
def get_contributions(self, max=500, ns=None):
"""Get contributions."""
- count = 0
- iterator = pywikibot.tools.empty_iterator()
- never_continue = False
- while count != max or never_continue:
- try:
- item = next(iterator)
- except StopIteration:
- self.log(u'Fetching new batch of contributions')
- data = list(pywikibot.Site().usercontribs(user=self.user, namespaces=ns, total=max))
- never_continue = True
- iterator = iter(data)
- else:
- count += 1
- yield item
+ return self.site.usercontribs(user=self.user, namespaces=ns, total=max)
def revert_contribs(self, callback=None):
"""Revert contributions."""
if callback is None:
callback = self.callback
- contribs = self.get_contributions()
- for item in contribs:
- try:
- if callback(item):
- result = self.revert(item)
- if result:
- self.log(u'%s: %s' % (item['title'], result))
- else:
- self.log(u'Skipped %s' % item['title'])
+ for item in self.get_contributions():
+ if callback(item):
+ result = self.revert(item)
+ if result:
+ self.log(u'%s: %s' % (item['title'], result))
else:
- self.log(u'Skipped %s by callback' % item['title'])
- except StopIteration:
- return
+ self.log(u'Skipped %s' % item['title'])
+ else:
+ self.log(u'Skipped %s by callback' % item['title'])
def callback(self, item):
"""Callback function."""
@@ -130,11 +106,13 @@
'markbot': True}).submit()
except pywikibot.data.api.APIError as e:
if e.code == 'badtoken':
- pywikibot.error("There was an API token error rollbacking the edit")
+ pywikibot.error(
+ 'There was an API token error rollbacking the edit')
else:
pywikibot.exception()
return False
- return u"The edit(s) made in %s by %s was rollbacked" % (page.title(), self.user)
+ return 'The edit(s) made in %s by %s was rollbacked' % (page.title(),
+ self.user)
def log(self, msg):
"""Log the message msg."""
--
To view, visit https://gerrit.wikimedia.org/r/360948
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib34fcb193e76c37910eda6e15f031afe10b6ce5e
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/361017 )
Change subject: Create superclass for log entries with user targets
......................................................................
Create superclass for log entries with user targets
This superclass will override the user() method so it returns a
User object instead of a Page object.
Change-Id: Iccce2364e67dc8e4975cea9b07c782d58a700b2f
---
M pywikibot/logentries.py
1 file changed, 16 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 22cc434..80cf38c 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -129,6 +129,21 @@
return self.data['comment']
+class UserTargetLogEntry(LogEntry):
+
+ """A log entry whose target is a user page."""
+
+ def page(self):
+ """Return the target user.
+
+ This returns a User object instead of the Page object returned by the
+ superclass method.
+ """
+ if not hasattr(self, '_page'):
+ self._page = pywikibot.User(super(UserTargetLogEntry, self).page())
+ return self._page
+
+
class BlockEntry(LogEntry):
"""
@@ -361,21 +376,11 @@
_expectedType = 'newusers'
-class ThanksEntry(LogEntry):
+class ThanksEntry(UserTargetLogEntry):
"""Thanks log entry."""
_expectedType = 'thanks'
-
- def page(self):
- """Return the target user.
-
- This returns a User object instead of the Page object returned by the
- superclass method.
- """
- if not hasattr(self, '_page'):
- self._page = pywikibot.User(super(ThanksEntry, self).page())
- return self._page
# TODO entries for merge,suppress,makebot,gblblock,renameuser,globalauth,gblrights ?
--
To view, visit https://gerrit.wikimedia.org/r/361017
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iccce2364e67dc8e4975cea9b07c782d58a700b2f
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Happy5214 <happy5214(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>