Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #111
Status: Passed
Duration: 12 minutes and 7 seconds
Commit: aa15681 (querygen-flowcontrol-rebased)
Author: John Vandenberg
Message: Simplify QueryGenerator.__iter__ flow control
Rearrange the logic to use less nested branching, and
destroy the data before exiting the iteration.
Removes 'None' as a valid value for QueryGenerator.limit;
it was not able to be set using set_maximum_items().
Adds some iterator state information to help with debugging
and test validation, and dont leave data in an instance variable.
Bug: 64489
Change-Id: Ie3a9e3576a0174703bcccf0d77ed42d56da0d09f
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/aa15681bb631
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43074866
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #1751
Status: Passed
Duration: 41 minutes and 13 seconds
Commit: e6888eb (master)
Author: pietrodn
Message: Don't crash when snaks-order is missing in API result
On older Wikibase versions, snaks-order is not returned from the API results for the items.
If this is the case, the bot crashes when it gets the data.
This fix ensures compatibility with those older version of Wikibase.
Bug: T76833
Change-Id: Ic014c682443919017eb9cd57b883511a6189af91
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/c2160763f1a7...e6888ebe…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43082842
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #111
Status: Passed
Duration: 36 minutes and 2 seconds
Commit: aa15681 (querygen-flowcontrol-rebased)
Author: John Vandenberg
Message: Simplify QueryGenerator.__iter__ flow control
Rearrange the logic to use less nested branching, and
destroy the data before exiting the iteration.
Removes 'None' as a valid value for QueryGenerator.limit;
it was not able to be set using set_maximum_items().
Adds some iterator state information to help with debugging
and test validation, and dont leave data in an instance variable.
Bug: 64489
Change-Id: Ie3a9e3576a0174703bcccf0d77ed42d56da0d09f
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/aa15681bb631
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43074866
--
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: Don't crash when snaks-order is missing in API result
......................................................................
Don't crash when snaks-order is missing in API result
On older Wikibase versions, snaks-order is not returned from the API results for the items.
If this is the case, the bot crashes when it gets the data.
This fix ensures compatibility with those older version of Wikibase.
Bug: T76833
Change-Id: Ic014c682443919017eb9cd57b883511a6189af91
---
M pywikibot/page.py
1 file changed, 9 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 8df644f..192d3e1 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3624,7 +3624,15 @@
@return: dict
"""
source = OrderedDict()
- for prop in data['snaks-order']:
+
+ # Before #84516 Wikibase did not implement snaks-order.
+ # https://gerrit.wikimedia.org/r/#/c/84516/
+ if 'snaks-order' in data:
+ prop_list = data['snaks-order']
+ else:
+ prop_list = data['snaks'].keys()
+
+ for prop in prop_list:
for claimsnak in data['snaks'][prop]:
claim = Claim.fromJSON(site, {'mainsnak': claimsnak,
'hash': data['hash']})
--
To view, visit https://gerrit.wikimedia.org/r/167532
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic014c682443919017eb9cd57b883511a6189af91
Gerrit-PatchSet: 11
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Pietrodn <powerpdn(a)gmail.com>
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: Nemo bis <federicoleva(a)tiscali.it>
Gerrit-Reviewer: Pietrodn <powerpdn(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #110
Status: Passed
Duration: 32 minutes and 6 seconds
Commit: cf116fb (querygen-api-buffer-rebased)
Author: Mpaa
Message: api.py: buffer data in QueryGenerator
QueryGenerator yields all items in resultdata, but there is no
guarantee that all data for an item arrived in one response.
Some data will appear in the following response, etc.
(see commit 3d2ca97aaac17a28e177fa89fbdd3364e7f53c0c)
This patch buffers results until all data are for an item are fetched.
This is based on the fact that the API, when query-continuing, keeps on
repeating the same pages until all requested data are fetched.
Change-Id: Iccb3a96b0248fdab0650edfda23d05ecec0dadbd
View the changeset: https://github.com/jayvdb/pywikibot-core/compare/9ce6fcdc3cc2^...cf116fb79a…
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43073861
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #111
Status: Passed
Duration: 40 minutes and 3 seconds
Commit: aa15681 (querygen-flowcontrol-rebased)
Author: John Vandenberg
Message: Simplify QueryGenerator.__iter__ flow control
Rearrange the logic to use less nested branching, and
destroy the data before exiting the iteration.
Removes 'None' as a valid value for QueryGenerator.limit;
it was not able to be set using set_maximum_items().
Adds some iterator state information to help with debugging
and test validation, and dont leave data in an instance variable.
Bug: 64489
Change-Id: Ie3a9e3576a0174703bcccf0d77ed42d56da0d09f
View the changeset: https://github.com/jayvdb/pywikibot-core/commit/aa15681bb631
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43074866
--
You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications
Build Update for jayvdb/pywikibot-core
-------------------------------------
Build: #110
Status: Passed
Duration: 36 minutes and 53 seconds
Commit: cf116fb (querygen-api-buffer-rebased)
Author: Mpaa
Message: api.py: buffer data in QueryGenerator
QueryGenerator yields all items in resultdata, but there is no
guarantee that all data for an item arrived in one response.
Some data will appear in the following response, etc.
(see commit 3d2ca97aaac17a28e177fa89fbdd3364e7f53c0c)
This patch buffers results until all data are for an item are fetched.
This is based on the fact that the API, when query-continuing, keeps on
repeating the same pages until all requested data are fetched.
Change-Id: Iccb3a96b0248fdab0650edfda23d05ecec0dadbd
View the changeset: https://github.com/jayvdb/pywikibot-core/compare/9ce6fcdc3cc2^...cf116fb79a…
View the full build log and details: https://travis-ci.org/jayvdb/pywikibot-core/builds/43073861
--
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: editarticle: move from optparse to argparse
......................................................................
editarticle: move from optparse to argparse
Changes editarticle.py to use argparse, as optparse was deprecated in
python 2.7/3.2.
Behaviour is identical to optparse except for a nicer help message.
Updated script_tests to account for the argparse requirement in python
2.7.
Bug: T70617
Change-Id: I0614674840c96205fe7c8ff48e3bea1273a886cb
---
M scripts/editarticle.py
M tests/script_tests.py
2 files changed, 30 insertions(+), 15 deletions(-)
Approvals:
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/editarticle.py b/scripts/editarticle.py
index 0ee678c..97656d9 100755
--- a/scripts/editarticle.py
+++ b/scripts/editarticle.py
@@ -8,6 +8,18 @@
- minor edits
- watch/unwatch
- ...
+
+The following parameters are supported:
+
+-r Edit redirect pages without following them
+--edit_redirect automatically.
+--edit-redirect
+
+-p P Choose which page to edit.
+--page P This argument can be passed positionally.
+
+-w Add the page to the user's watchlist after editing.
+--watch
"""
#
# (C) Gerrit Holl, 2004
@@ -19,7 +31,8 @@
#
import os
-import optparse
+import sys
+import argparse
import tempfile
import pywikibot
@@ -42,21 +55,22 @@
def set_options(self, *args):
"""Parse commandline and set options attribute."""
- my_args = []
- for arg in pywikibot.handle_args(args):
- my_args.append(arg)
- parser = optparse.OptionParser()
- parser.add_option("-r", "--edit_redirect", action="store_true",
- default=False, help="Ignore/edit redirects")
- parser.add_option("-p", "--page", help="Page to edit")
- parser.add_option("-w", "--watch", action="store_true", default=False,
- help="Watch article after edit")
- (self.options, args) = parser.parse_args(args=my_args)
+ my_args = pywikibot.handle_args(args)
- # for convenience, if we have an arg, stuff it into the opt, so we
- # can act like a normal editor.
- if (len(args) == 1):
- self.options.page = args[0]
+ parser = argparse.ArgumentParser(add_help=False)
+ parser.add_argument("-r", "--edit_redirect", "--edit-redirect",
+ action="store_true", help="Ignore/edit redirects")
+ parser.add_argument("-p", "--page", help="Page to edit")
+ parser.add_argument("-w", "--watch", action="store_true",
+ help="Watch article after edit")
+ # convenience positional argument so we can act like a normal editor
+ parser.add_argument("wikipage", nargs="?", help="Page to edit")
+ self.options = parser.parse_args(my_args)
+
+ if self.options.page and self.options.wikipage:
+ pywikibot.error(u"Multiple pages passed. Please specify a single page to edit.")
+ sys.exit(1)
+ self.options.page = self.options.page or self.options.wikipage
def setpage(self):
"""Set page and page title."""
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 8536715..a276593 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -34,6 +34,7 @@
}
if sys.version_info < (2, 7):
script_deps['replicate_wiki'] = ['argparse']
+ script_deps['editarticle'] = ['argparse']
def check_script_deps(script_name):
--
To view, visit https://gerrit.wikimedia.org/r/176747
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0614674840c96205fe7c8ff48e3bea1273a886cb
Gerrit-PatchSet: 9
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mloc-gci <mloc.gci(a)gmail.com>
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: Mloc-gci <mloc.gci(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>