Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1822
Status: Still Failing
Duration: 43 minutes and 45 seconds
Commit: 740c962 (master)
Author: Fabian Neundorf
Message: [FIX] QueryGenerator: Allow missing 'query' entry
The QueryGenerator stopped when the result didn't contain a 'query'
entry. If the result doesn't contain anything yet (but needs to be
continued) it's not returning a 'query' entry when used with the
'generator' API feature.
Instead of stopping the iteration when there is not 'query' entry it's
just stopping the iteration if there is no continuation provided.
Because the exact nature why the condition was there in the first place
(it was added in 54bc6aafa591e31274dc3630e9c6c1039f80839b) is not known
the output was raised from 'debug' to 'log'. Prior to that revision no
condition was found in the repository which looks like that.
Bug: T84860
Change-Id: I1f8c4986d69be18134987c951fd65237300e277e
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/2de0ce1aa105...740c9627…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/44573315
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] Added some docstrings
......................................................................
[IMPROV] Added some docstrings
Change-Id: Ie5633447090ddfcf201ed38d7fea111a450c7177
---
M pywikibot/bot.py
M pywikibot/comms/http.py
M pywikibot/compat/catlib.py
M pywikibot/compat/query.py
M pywikibot/diff.py
M pywikibot/families/test_family.py
M pywikibot/page.py
M pywikibot/throttle.py
M pywikibot/tools.py
9 files changed, 32 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Unicodesnowman: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index ddfbbc9..21eb4a4 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1133,6 +1133,7 @@
"""
def __init__(self, **kwargs):
+ """Constructor."""
super(WikidataBot, self).__init__(**kwargs)
self.site = pywikibot.Site()
self.repo = self.site.data_repository()
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index ad2e2e8..444f3c7 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -166,6 +166,17 @@
def user_agent(site=None, format_string=None):
+ """
+ Generate the user agent string for a given site and format.
+
+ @param site: The site for which this user agent is intended. May be None.
+ @type site: BaseSite
+ @param format_string: The string to which the values will be added using
+ str.format. Is using config.user_agent_format when it is None.
+ @type format_string: basestring
+ @return: The formatted user agent
+ @rtype: unicode
+ """
values = USER_AGENT_PRODUCTS.copy()
# This is the Pywikibot revision; also map it to {version} at present.
diff --git a/pywikibot/compat/catlib.py b/pywikibot/compat/catlib.py
index d4f7b48..f329b21 100644
--- a/pywikibot/compat/catlib.py
+++ b/pywikibot/compat/catlib.py
@@ -20,6 +20,7 @@
def change_category(article, oldCat, newCat, comment=None, sortKey=None,
inPlace=True):
+ """Change the category of the article."""
return article.change_category(oldCat, newCat, comment, sortKey, inPlace)
__all__ = ('Category', 'change_category',)
diff --git a/pywikibot/compat/query.py b/pywikibot/compat/query.py
index fe02c99..46e9976 100644
--- a/pywikibot/compat/query.py
+++ b/pywikibot/compat/query.py
@@ -23,6 +23,11 @@
@deprecate_arg("retryCount", None)
@deprecate_arg("encodeTitle", None)
def GetData(request, site=None, back_response=False):
+ """
+ Query the server with the given request dict.
+
+ DEPRECATED: Use pywikibot.data.api.Request instead.
+ """
if site:
request['site'] = site
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index a93a90b..09fdfdf 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -158,6 +158,7 @@
return self.b[self.b_rng[0]:self.b_rng[1]]
def __str__(self):
+ """Return the diff as plain text."""
return u''.join(self.diff_plain_text)
def __repr__(self):
@@ -238,6 +239,7 @@
return blocks
def print_hunks(self):
+ """Print the headers and diff texts of all hunks to the output."""
for hunk in self.hunks:
pywikibot.output(hunk.header + hunk.diff_text)
diff --git a/pywikibot/families/test_family.py b/pywikibot/families/test_family.py
index 1517af2..2a587c0 100644
--- a/pywikibot/families/test_family.py
+++ b/pywikibot/families/test_family.py
@@ -14,4 +14,5 @@
langs = {'test': 'test.wikipedia.org'}
def from_url(self, url):
+ """Return None to indicate no code of this family is accepted."""
return None # Don't accept this, but 'test' of 'wikipedia'
diff --git a/pywikibot/page.py b/pywikibot/page.py
index eba81a3..d96b8cb 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -576,6 +576,13 @@
return min(x.revid for x in history)
def previousRevision(self):
+ """
+ Return the revision id for the previous revision.
+
+ DEPRECATED: Use previous_revision_id instead.
+
+ @return: long
+ """
return self.previous_revision_id
def exists(self):
@@ -3276,6 +3283,7 @@
}
def getRedirectTarget(self):
+ """Return the redirect target for this page."""
target = super(ItemPage, self).getRedirectTarget()
cmodel = target.content_model
if cmodel != 'wikibase-item':
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 5cdc30d..a311a20 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -39,6 +39,7 @@
def __init__(self, site, mindelay=None, maxdelay=None, writedelay=None,
multiplydelay=True):
+ """Constructor."""
self.lock = threading.RLock()
self.mysite = str(site)
self.ctrlfilename = config.datafilepath('throttle.ctrl')
diff --git a/pywikibot/tools.py b/pywikibot/tools.py
index b12341a..d3112cb 100644
--- a/pywikibot/tools.py
+++ b/pywikibot/tools.py
@@ -90,6 +90,7 @@
self.version = tuple(components)
def __str__(self):
+ """Return version number with optional "wmf" suffix."""
vstring = '.'.join(str(v) for v in self.version)
if self.wmf_version:
vstring += 'wmf{0}'.format(self.wmf_version)
@@ -406,6 +407,7 @@
"""Return self when called."""
def __call__(self):
+ """Do nothing and just return itself."""
return self
--
To view, visit https://gerrit.wikimedia.org/r/180691
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5633447090ddfcf201ed38d7fea111a450c7177
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Unicodesnowman <admin(a)glados.cc>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] QueryGenerator: Allow missing 'query' entry
......................................................................
[FIX] QueryGenerator: Allow missing 'query' entry
The QueryGenerator stopped when the result didn't contain a 'query'
entry. If the result doesn't contain anything yet (but needs to be
continued) it's not returning a 'query' entry when used with the
'generator' API feature.
Instead of stopping the iteration when there is not 'query' entry it's
just stopping the iteration if there is no continuation provided.
Because the exact nature why the condition was there in the first place
(it was added in 54bc6aafa591e31274dc3630e9c6c1039f80839b) is not known
the output was raised from 'debug' to 'log'. Prior to that revision no
condition was found in the repository which looks like that.
Bug: T84860
Change-Id: I1f8c4986d69be18134987c951fd65237300e277e
---
M pywikibot/data/api.py
M tests/category_tests.py
2 files changed, 5 insertions(+), 12 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Unicodesnowman: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 04420c2..5b70fe1 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1483,14 +1483,7 @@
% self.__class__.__name__,
_logger)
return
- if "query" not in self.data:
- pywikibot.debug(
- u"%s: stopped iteration because 'query' not found in api "
- u"response." % self.__class__.__name__,
- _logger)
- pywikibot.debug(unicode(self.data), _logger)
- return
- if self.resultkey in self.data["query"]:
+ if 'query' in self.data and self.resultkey in self.data["query"]:
resultdata = self.data["query"][self.resultkey]
if isinstance(resultdata, dict):
pywikibot.debug(u"%s received %s; limit=%s"
@@ -1538,6 +1531,10 @@
# self.resultkey in data in last request.submit()
previous_result_had_data = True
else:
+ if 'query' not in self.data:
+ pywikibot.log("%s: 'query' not found in api response." %
+ self.__class__.__name__)
+ pywikibot.log(unicode(self.data))
# if (query-)continue is present, self.resultkey might not have
# been fetched yet
if self.continue_name not in self.data:
diff --git a/tests/category_tests.py b/tests/category_tests.py
index 6ba5abb..9e57069 100644
--- a/tests/category_tests.py
+++ b/tests/category_tests.py
@@ -11,7 +11,6 @@
import pywikibot.page
from tests.aspects import unittest, TestCase
-from tests.utils import allowed_failure
class TestCategoryObject(TestCase):
@@ -100,11 +99,8 @@
subcategories_total = list(cat.subcategories(total=2))
self.assertEqual(len(subcategories_total), 2)
- @allowed_failure
def test_subcategories_recurse(self):
"""Test the subcategories method with recurse=True."""
- # FIXME: Broken, some subcategories are missing.
- # See: T84860
site = self.get_site()
cat = pywikibot.Category(site, 'Category:Wikipedians by gender')
c1 = pywikibot.Category(site, 'Category:Female Wikipedians')
--
To view, visit https://gerrit.wikimedia.org/r/180779
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1f8c4986d69be18134987c951fd65237300e277e
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Unicodesnowman <admin(a)glados.cc>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1819
Status: Broken
Duration: 43 minutes and 39 seconds
Commit: d79ab7b (master)
Author: Fabian Neundorf
Message: [FEAT/FIX] Replace: Explicitly allow userinput
If replacements are defined before it shouldn't ask the user for any
more except when explicitly allowing userinput with '-manualinput'.
This fixes a problem that when -fix was provided it couldn't be
automated because it still asked if manual inputs are requested. This
changes the default behavior a bit, because previously manual input was
enabled when replacements via the command line were defined. But it
doesn't make sense that -manualinput is only required when using -fix.
This actually enables the bot to run automatically without user
interference using command line replacements and still allows the user
to specify replacements via the normal input.
Also removed explicit concatenation of two static strings and updated
documentation that -fix can now be used together with other parameters
like -nocase or additional replacements.
Change-Id: I199ed9e070b59424cb7251cc98ffd0a7ceff5b3f
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/58a536b822cc...d79ab7bf…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/44464120
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications