jenkins-bot has submitted this change and it was merged.
Change subject: Remove item count output in page generators
......................................................................
Remove item count output in page generators
Currently WikibaseSearchItemPageGenerator always
fetches all items twice in order to display an item count,
and then yield each item.
Also do not fetch all entities for test_searchitem*.
The test only needs to confirm one item is fetched,
and currently it can halt Travis builds due to fetching
~5000 items twice taking 10 mins without any output.
Also add a note to WikidataQueryPageGenerator about its item count.
Change-Id: Ia8b0e97930a94945d3ed2cdf593887ebff8a3e5c
(manually cherry-picked from c9f51be)
---
M pywikibot/pagegenerators.py
M tests/pagegenerators_tests.py
2 files changed, 15 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index e6420a4..d83d85d 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2295,7 +2295,8 @@
wd_query = wdquery.WikidataQuery(cacheMaxAge=0)
data = wd_query.query(wd_queryset)
-
+ # This item count should not be copied by other generators,
+ # and should be removed when wdq becomes a real generator (T135592)
pywikibot.output(u'retrieved %d items' % data[u'status'][u'items'])
for item in data[u'items']:
page = pywikibot.ItemPage(repo, u'Q{0}'.format(item))
@@ -2332,7 +2333,6 @@
repo = site.data_repository()
data = repo.search_entities(text, language, limit=total, site=site)
- pywikibot.output(u'retrieved %d items' % len(list(data)))
for item in data:
yield pywikibot.ItemPage(repo, item['id'])
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 967b95e..b19d0b5 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -708,21 +708,30 @@
gf.handleArg('-searchitem:abc')
gen = gf.getCombinedGenerator()
self.assertIsNotNone(gen)
- self.assertGreater(len(set(gen)), 0)
+ self.assertIsNotNone(next(gen))
def test_searchitem_language(self):
"""Test -searchitem with custom language specified."""
gf = pagegenerators.GeneratorFactory(site=self.site)
gf.handleArg('-searchitem:pl:abc')
+ gf.handleArg('-limit:1')
gen = gf.getCombinedGenerator()
self.assertIsNotNone(gen)
- pages = set(gen)
+ # ABC disambiguation
+ page1 = next(gen)
+ self.assertEqual(page1.title(), 'Q286874')
+
gf = pagegenerators.GeneratorFactory(site=self.site)
gf.handleArg('-searchitem:en:abc')
+ gf.handleArg('-limit:2')
gen = gf.getCombinedGenerator()
self.assertIsNotNone(gen)
- pages2 = set(gen)
- self.assertNotEqual(pages, pages2)
+ # American Broadcasting Company
+ page1 = next(gen)
+ self.assertEqual(page1.title(), 'Q169889')
+ # ABC disambiguation
+ page2 = next(gen)
+ self.assertEqual(page2.title(), 'Q286874')
class TestLogeventsFactoryGenerator(DefaultSiteTestCase,
--
To view, visit https://gerrit.wikimedia.org/r/303376
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8b0e97930a94945d3ed2cdf593887ebff8a3e5c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Stop reading 'cookieprefix' upon login
......................................................................
Stop reading 'cookieprefix' upon login
We don't even use the cookies it tries to create, and cookieprefix is
being removed from MediaWiki, so this entire hunk of code is useless,
and has been removed.
Bug: T142155
Change-Id: I449e75870fa2cbcb50a55c2b05805a2c084e6913
(cherry picked from commit 6a848594df261ed18ab78a5e406265ca27476cb0)
---
M pywikibot/data/api.py
1 file changed, 7 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c2af5ea..44d7160 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2537,7 +2537,12 @@
Parameters are all ignored.
- @return: cookie data if successful, None otherwise.
+ Note, this doesn't actually return or do anything with cookies.
+ The threadedhttp module takes care of all the cookie stuff,
+ this just has a legacy name for now and should be renamed in the
+ future.
+
+ @return: empty string if successful, throws exception on failure
"""
if hasattr(self, '_waituntil'):
@@ -2557,14 +2562,7 @@
if u"login" not in login_result:
raise RuntimeError("API login response does not have 'login' key.")
if login_result['login']['result'] == "Success":
- prefix = login_result['login']['cookieprefix']
- cookies = []
- for key in ('Token', 'UserID', 'UserName'):
- cookies.append("%s%s=%s"
- % (prefix, key,
- login_result['login']['lg' + key.lower()]))
- self.username = login_result['login']['lgusername']
- return "\n".join(cookies)
+ return ''
elif login_result['login']['result'] == "NeedToken":
token = login_result['login']['token']
login_request["lgtoken"] = token
--
To view, visit https://gerrit.wikimedia.org/r/303367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I449e75870fa2cbcb50a55c2b05805a2c084e6913
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Test Python 3.5 on Travis
......................................................................
Test Python 3.5 on Travis
As Python 3.5 has been officially released we should test on this.
c.f. 773e72e adding this on master, and T106209 for why the rest
of that patch doesnt need backporting.
Change-Id: I31319a5feff31b3f4db1dacde782b7595917cf25
---
M .travis.yml
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index 0823589..ade2476 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@
- '2.7'
- '3.3'
- '3.4'
+ - '3.5'
# OSX builds do not yet support Python
os:
--
To view, visit https://gerrit.wikimedia.org/r/303373
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I31319a5feff31b3f4db1dacde782b7595917cf25
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Fix docstring capitalization in return types and behavior
......................................................................
Fix docstring capitalization in return types and behavior
Bug: T121365
Change-Id: I08aea29e0db61ab930fb2fefd8f5d025f7d36f55
(manually cherry-picked from c150a28)
---
M pywikibot/comms/rcstream.py
M scripts/data_ingestion.py
M scripts/featured.py
M scripts/replicate_wiki.py
M tests/ui_tests.py
5 files changed, 6 insertions(+), 6 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py
index d024bc8..544e911 100644
--- a/pywikibot/comms/rcstream.py
+++ b/pywikibot/comms/rcstream.py
@@ -141,7 +141,7 @@
def rc_listener(wikihost, rchost, rcport=80, rcpath='/rc', total=None):
- """RC Changes Generator. Yields changes received from RCstream.
+ """Yield changes received from RCstream.
@param wikihost: the hostname of the wiki we want to get changes for. This
is passed to rcstream using a 'subscribe' command. Pass
@@ -195,7 +195,7 @@
def site_rc_listener(site, total=None):
- """RC Changes Generator. Yields changes received from RCstream.
+ """Yield changes received from RCstream.
@param site: the Pywikibot.Site object to yield live recent changes for
@type site: Pywikibot.BaseSite
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index c30669e..eac28be 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -141,7 +141,7 @@
def CSVReader(fileobj, urlcolumn, site=None, *args, **kwargs):
- """CSV reader."""
+ """Yield Photo objects for each row of a CSV file."""
reader = csv.DictReader(fileobj, *args, **kwargs)
for line in reader:
yield Photo(line[urlcolumn], line, site=site)
diff --git a/scripts/featured.py b/scripts/featured.py
index 9e534b7..cef48d7 100755
--- a/scripts/featured.py
+++ b/scripts/featured.py
@@ -541,7 +541,7 @@
def add_template(self, source, dest, task, fromsite):
"""Place or remove the Link_GA/FA template on/from a page."""
def compile_link(site, templates):
- """compile one link template list."""
+ """Compile one link template list."""
findtemplate = '(%s)' % '|'.join(templates)
return re.compile(r"\{\{%s\|%s\}\}"
% (findtemplate.replace(u' ', u'[ _]'),
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 788f993..9cbed4f 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -56,7 +56,7 @@
@deprecated('BaseSite.namespaces')
def namespaces(site):
- """dict from namespace number to prefix."""
+ """Return a dictionary from namespace number to prefix."""
return dict((n.id, n.custom_name) for n in site.namespaces)
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 811dfe2..a5779e8 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -194,7 +194,7 @@
def unpatch():
- """un-patch standard terminal files."""
+ """Un-patch standard terminal files."""
ui._print = org_print
ui._raw_input = org_input
--
To view, visit https://gerrit.wikimedia.org/r/303371
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I08aea29e0db61ab930fb2fefd8f5d025f7d36f55
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Negative24 <jamison.lofthouse(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3541
Status: Errored
Duration: 2 hours, 10 minutes, and 36 seconds
Commit: 6a84859 (master)
Author: Kunal Mehta
Message: Stop reading 'cookieprefix' upon login
We don't even use the cookies it tries to create, and cookieprefix is
being removed from MediaWiki, so this entire hunk of code is useless,
and has been removed.
Bug: T142155
Change-Id: I449e75870fa2cbcb50a55c2b05805a2c084e6913
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/d21ee035fca8...6a848594…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/150283424
--
You can configure recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: Stop reading 'cookieprefix' upon login
......................................................................
Stop reading 'cookieprefix' upon login
We don't even use the cookies it tries to create, and cookieprefix is
being removed from MediaWiki, so this entire hunk of code is useless,
and has been removed.
Bug: T142155
Change-Id: I449e75870fa2cbcb50a55c2b05805a2c084e6913
---
M pywikibot/data/api.py
1 file changed, 7 insertions(+), 9 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 62ec818..66c9aec 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3003,7 +3003,12 @@
Parameters are all ignored.
- @return: cookie data if successful, None otherwise.
+ Note, this doesn't actually return or do anything with cookies.
+ The threadedhttp module takes care of all the cookie stuff,
+ this just has a legacy name for now and should be renamed in the
+ future.
+
+ @return: empty string if successful, throws exception on failure
"""
if hasattr(self, '_waituntil'):
@@ -3030,14 +3035,7 @@
if u"login" not in login_result:
raise RuntimeError("API login response does not have 'login' key.")
if login_result['login']['result'] == "Success":
- prefix = login_result['login']['cookieprefix']
- cookies = []
- for key in ('Token', 'UserID', 'UserName'):
- cookies.append("%s%s=%s"
- % (prefix, key,
- login_result['login']['lg' + key.lower()]))
- self.username = login_result['login']['lgusername']
- return "\n".join(cookies)
+ return ''
elif login_result['login']['result'] == "NeedToken":
# Kept for backwards compatibility
token = login_result['login']['token']
--
To view, visit https://gerrit.wikimedia.org/r/303342
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I449e75870fa2cbcb50a55c2b05805a2c084e6913
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: jenkins-bot <>