[Pywikibot-commits] [Gerrit] update mw version - change (pywikibot/compat)
jenkins-bot has submitted this change and it was merged. Change subject: update mw version .. update mw version Change-Id: I97ad3542d888eb337466a74c995e9e10f91b05bd --- M family.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/family.py b/family.py index f343989..326fbd4 100644 --- a/family.py +++ b/family.py @@ -4963,7 +4963,7 @@ # Don't use this, use versionnumber() instead. This only exists # to not break family files. # Here we return the latest mw release of wikimedia projects -return '1.25wmf10' +return '1.25wmf11' def shared_image_repository(self, code): return ('commons', 'commons') -- To view, visit https://gerrit.wikimedia.org/r/179603 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I97ad3542d888eb337466a74c995e9e10f91b05bd Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: Xqt i...@gno.de Gerrit-Reviewer: John Vandenberg jay...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Xqt i...@gno.de Gerrit-Reviewer: jenkins-bot ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Passed: wikimedia/pywikibot-core#1785 (master - 570547c)
Build Update for wikimedia/pywikibot-core - Build: #1785 Status: Passed Duration: 31 minutes and 23 seconds Commit: 570547c (master) Author: John Vandenberg Message: Dont use 'gen' to refer to the generator factory Also use pagegenerators instead of alias pg Change-Id: I31aa4d113ce6ca021c559c0b489d1a6b1904c86e View the changeset: https://github.com/wikimedia/pywikibot-core/compare/a4aaccc57f16...570547c45d0b View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43938749 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] [Gerrit] textlib.extract_templates_and_params tests - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: textlib.extract_templates_and_params tests .. textlib.extract_templates_and_params tests allow textlib.extract_templates_and_params_mwpfh to be accessed and tested even if config.mwparserfromhell is disabled. Delay import of mwparserfromhell until it is actually used. Merge common test results for mwpfh and regex, highlighting the case known to be different, and mention them in the docstring. Change-Id: Id6a17940f241d95d9e8dc9b86131dec3989ea36a --- M pywikibot/textlib.py M tests/textlib_tests.py 2 files changed, 119 insertions(+), 34 deletions(-) Approvals: John Vandenberg: Looks good to me, but someone else must approve XZise: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 859c290..ed25218 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -14,19 +14,14 @@ __version__ = '$Id$' # -try: -import mwparserfromhell -except ImportError: -mwparserfromhell = False +import datetime +import re +import sys try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict - -import datetime -import re -import sys if sys.version_info[0] 2: from html.parser import HTMLParser @@ -966,17 +961,53 @@ parameters, and if this results multiple parameters with the same name only the last value provided will be returned. -This uses a third party library (mwparserfromhell) if it is installed -and enabled in the user-config.py. Otherwise it falls back on a -regex based function defined below. +This uses the package L{mwparserfromhell} (mwpfh) if it is installed +and enabled by config.mwparserfromhell. Otherwise it falls back on a +regex based implementation. + +There are minor differences between the two implementations. + +The two implementations return nested templates in a different order. +i.e. for {{a|b={{c, mwpfh returns [a, c], whereas regex returns [c, a]. + +mwpfh preserves whitespace in parameter names and values. regex excludes +anything between !-- -- before parsing the text. @param text: The wikitext from which templates are extracted @type text: unicode or string @return: list of template name and params @rtype: list of tuple -if not (config.use_mwparserfromhell and mwparserfromhell): +use_mwparserfromhell = config.use_mwparserfromhell +if use_mwparserfromhell: +try: +import mwparserfromhell # noqa +except ImportError: +use_mwparserfromhell = False + +if use_mwparserfromhell: +return extract_templates_and_params_mwpfh(text) +else: return extract_templates_and_params_regex(text) + + +def extract_templates_and_params_mwpfh(text): + +Extract templates with params using mwparserfromhell. + +This function should not be called directly. + +Use extract_templates_and_params, which will select this +mwparserfromhell implementation if based on whether the +mwparserfromhell package is installed and enabled by +config.mwparserfromhell. + +@param text: The wikitext from which templates are extracted +@type text: unicode or string +@return: list of template name and params +@rtype: list of tuple + +import mwparserfromhell code = mwparserfromhell.parse(text) result = [] for template in code.filter_templates(recursive=True): diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 10dd200..630ced4 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -7,10 +7,6 @@ # __version__ = '$Id$' -try: -import mwparserfromhell -except ImportError: -mwparserfromhell = False import codecs import os @@ -53,24 +49,6 @@ def testCurrentBehaviour(self): self.assertContains(enwiki_help_editing, uEditing) - -def testExtractTemplates(self): -if not (pywikibot.config.use_mwparserfromhell and mwparserfromhell): -raise unittest.SkipTest('mwparserfromhell not available or enabled') -func = textlib.extract_templates_and_params # It's really long. -self.assertEqual(func('{{a}}'), [('a', OrderedDict())]) -self.assertEqual(func('{{a|b=c}}'), [('a', OrderedDict((('b', 'c'), )))]) -self.assertEqual(func('{{a|b|c=d}}'), [('a', OrderedDict((('1', 'b'), ('c', 'd']) -self.assertEqual(func('{{a|b={{c'), [('a', OrderedDict((('b', '{{c}}'), ))), ('c', OrderedDict())]) -self.assertEqual(func('{{a|b=c|f=g|d=e|1=}}'), [('a', OrderedDict((('b', 'c'), ('f', 'g'), ('d', 'e'), ('1', '']) - -def testExtractTemplatesRegex(self): -func = textlib.extract_templates_and_params_regex # It's really long. -self.assertEqual(func('{{a}}'), [('a', OrderedDict())]) -
[Pywikibot-commits] Broken: wikimedia/pywikibot-core#1786 (master - 666272c)
Build Update for wikimedia/pywikibot-core - Build: #1786 Status: Broken Duration: 31 minutes and 0 seconds Commit: 666272c (master) Author: jenkins-bot Message: Merge textlib.extract_templates_and_params tests View the changeset: https://github.com/wikimedia/pywikibot-core/compare/570547c45d0b...666272ce9818 View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43953897 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] [Gerrit] Don't aggressively cache token requests in tests - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Don't aggressively cache token requests in tests .. Don't aggressively cache token requests in tests Tests aggressively cache all API responses, with the exception of requests containing 'lgpassword'. Announced recently, token handling on the server is changing. Brad Jorsch: 'Upcoming changes to token handling' https://lists.wikimedia.org/pipermail/mediawiki-api-announce/2014-August/63.html pywikibot doesnt handle 'badtoken', which should cause the client to get a new token. As a result, re-running tests now fail with badtoken errors, and can only be corrected by deleting the data in tests/apicache. This patch tells the test layer to not use the API cache for any request containing 'intoken', so new tokens will be requested each test run. Change-Id: I9f7d86bd1a13eda3cc0b2170840c9d65e716dd20 --- M tests/__init__.py 1 file changed, 10 insertions(+), 0 deletions(-) Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/__init__.py b/tests/__init__.py index 919064a..4176945 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -62,6 +62,13 @@ if not super(TestRequest, self)._load_cache(): return False +# tokens need careful management in the cache +# and cant be aggressively cached. +# FIXME: remove once 'badtoken' is reliably handled in api.py +if 'intoken' in self._uniquedescriptionstr(): +self._data = None +return False + if 'lgpassword' in self._uniquedescriptionstr(): self._data = None return False @@ -70,6 +77,9 @@ def _write_cache(self, data): Write data except login details. +if 'intoken' in self._uniquedescriptionstr(): +return + if 'lgpassword' in self._uniquedescriptionstr(): return -- To view, visit https://gerrit.wikimedia.org/r/154987 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9f7d86bd1a13eda3cc0b2170840c9d65e716dd20 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg jay...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Merlijn van Deen valhall...@arctus.nl Gerrit-Reviewer: jenkins-bot ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] [Gerrit] Use both pagegenerators and local generator - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Use both pagegenerators and local generator .. Use both pagegenerators and local generator When the script has a local generator, it can be inserted at the beginning of the list of generators used by the generator factory. This is especially useful so that filters may be applied to the script supplied generator. Change-Id: I492673ce69c77df9ed697271c7c7e8a9c6fc055d --- M scripts/imageuncat.py 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/imageuncat.py b/scripts/imageuncat.py index 581eae9..acc6087 100755 --- a/scripts/imageuncat.py +++ b/scripts/imageuncat.py @@ -1343,8 +1343,8 @@ generator = recentChanges(site=site, delay=120) else: genFactory.handleArg(arg) -if not generator: -generator = genFactory.getCombinedGenerator() + +generator = genFactory.getCombinedGenerator(gen=generator) if not generator: pywikibot.output( u'You have to specify the generator you want to use for the program!') -- To view, visit https://gerrit.wikimedia.org/r/179616 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I492673ce69c77df9ed697271c7c7e8a9c6fc055d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg jay...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Merlijn van Deen valhall...@arctus.nl Gerrit-Reviewer: jenkins-bot ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] [Gerrit] Re-enable site tests commented out due to old bugs - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Re-enable site tests commented out due to old bugs .. Re-enable site tests commented out due to old bugs allcategories and allimages tests commented out due to bug 15985, now fixed. Bug: T60941 Change-Id: I13be662e1be1f90109c8a19e6e9b13d65419255a --- M tests/site_tests.py 1 file changed, 9 insertions(+), 9 deletions(-) Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/site_tests.py b/tests/site_tests.py index f0e8468..918dc3f 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -478,10 +478,10 @@ for cat in mysite.allcategories(total=5, prefix=Def): self.assertIsInstance(cat, pywikibot.Category) self.assertTrue(cat.title(withNamespace=False).startswith(Def)) -## Bug # 15985 -#for cat in mysite.allcategories(total=5, start=Hij, reverse=True): -#self.assertIsInstance(cat, pywikibot.Category) -#self.assertLessEqual(cat.title(withNamespace=False), Hij) +# Bug # 15985 - reverse and start combined; fixed in v 1.14 +for cat in mysite.allcategories(total=5, start=Hij, reverse=True): +self.assertIsInstance(cat, pywikibot.Category) +self.assertLessEqual(cat.title(withNamespace=False), Hij) def test_allusers(self): Test the site.allusers() method. @@ -536,11 +536,11 @@ self.assertIsInstance(impage, pywikibot.FilePage) self.assertTrue(mysite.page_exists(impage)) self.assertGreaterEqual(impage.title(withNamespace=False), Ba) -## Bug # 15985 -#for impage in mysite.allimages(start=Da, reverse=True, total=5): -#self.assertIsInstance(impage, pywikibot.FilePage) -#self.assertTrue(mysite.page_exists(impage)) -#self.assertLessEqual(impage.title(), Da) +# Bug # 15985 - reverse and start combined; fixed in v 1.14 +for impage in mysite.allimages(start=Da, reverse=True, total=5): +self.assertIsInstance(impage, pywikibot.FilePage) +self.assertTrue(mysite.page_exists(impage)) +self.assertLessEqual(impage.title(withNamespace=False), Da) for impage in mysite.allimages(prefix=Ch, total=5): self.assertIsInstance(impage, pywikibot.FilePage) self.assertTrue(mysite.page_exists(impage)) -- To view, visit https://gerrit.wikimedia.org/r/179124 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I13be662e1be1f90109c8a19e6e9b13d65419255a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg jay...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Merlijn van Deen valhall...@arctus.nl Gerrit-Reviewer: jenkins-bot ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Broken: wikimedia/pywikibot-core#1788 (master - 39724af)
Build Update for wikimedia/pywikibot-core - Build: #1788 Status: Broken Duration: 30 minutes and 25 seconds Commit: 39724af (master) Author: jenkins-bot Message: Merge Use both pagegenerators and local generator View the changeset: https://github.com/wikimedia/pywikibot-core/compare/8b064b3364e5...39724af1aac1 View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43964552 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Passed: wikimedia/pywikibot-core#1789 (master - 7bbc90b)
Build Update for wikimedia/pywikibot-core - Build: #1789 Status: Passed Duration: 31 minutes and 58 seconds Commit: 7bbc90b (master) Author: jenkins-bot Message: Merge Move templatesWithParams from BasePage into Page View the changeset: https://github.com/wikimedia/pywikibot-core/compare/39724af1aac1...7bbc90b47e30 View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43964768 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Passed: wikimedia/pywikibot-core#1790 (master - 3ae6b76)
Build Update for wikimedia/pywikibot-core - Build: #1790 Status: Passed Duration: 40 minutes and 20 seconds Commit: 3ae6b76 (master) Author: jenkins-bot Message: Merge Re-enable allpages langlinks tests View the changeset: https://github.com/wikimedia/pywikibot-core/compare/7bbc90b47e30...3ae6b76b433e View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43965120 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Passed: wikimedia/pywikibot-core#1791 (master - aaebdd4)
Build Update for wikimedia/pywikibot-core - Build: #1791 Status: Passed Duration: 40 minutes and 54 seconds Commit: aaebdd4 (master) Author: jenkins-bot Message: Merge Re-enable site tests commented out due to old bugs View the changeset: https://github.com/wikimedia/pywikibot-core/compare/3ae6b76b433e...aaebdd4f77e9 View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43965156 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Broken: wikimedia/pywikibot-core#1792 (master - c57911a)
Build Update for wikimedia/pywikibot-core - Build: #1792 Status: Broken Duration: 41 minutes and 47 seconds Commit: c57911a (master) Author: jenkins-bot Message: Merge Remove lists of missing tests View the changeset: https://github.com/wikimedia/pywikibot-core/compare/aaebdd4f77e9...c57911aabcdc View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43965171 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] Passed: wikimedia/pywikibot-core#1793 (master - 7c6305f)
Build Update for wikimedia/pywikibot-core - Build: #1793 Status: Passed Duration: 41 minutes and 21 seconds Commit: 7c6305f (master) Author: jenkins-bot Message: Merge Miscellaneous pwb improvements View the changeset: https://github.com/wikimedia/pywikibot-core/compare/c57911aabcdc...7c6305fdff1a View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/43965344 -- You can configure recipients for build notifications in your .travis.yml file. See http://docs.travis-ci.com/user/notifications ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
[Pywikibot-commits] [Gerrit] Remove deprecated 'throttle' argument from BasePage.get() calls - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Remove deprecated 'throttle' argument from BasePage.get() calls .. Remove deprecated 'throttle' argument from BasePage.get() calls It has been marked as deprecated by Russell Blau with commit 3e8ea74a5c85016dd4eb15c1d8f4324805953976 Change-Id: Ib7812dd6c7bf0ae7cec657910a9e9cb6e275bfba --- M scripts/imagetransfer.py M scripts/solve_disambiguation.py 2 files changed, 5 insertions(+), 5 deletions(-) Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py index bb16569..12d4e3e 100644 --- a/scripts/imagetransfer.py +++ b/scripts/imagetransfer.py @@ -234,7 +234,7 @@ % (i, image.title(asLink=True))) try: # Show the image description page's contents -pywikibot.output(image.get(throttle=False)) +pywikibot.output(image.get()) # look if page already exists with this name. # TODO: consider removing this: a different image of the same # name may exist on the target wiki, and the bot user may want @@ -244,11 +244,11 @@ targetTitle = '%s:%s' % (self.targetSite.image_namespace(), image.title().split(':', 1)[1]) targetImage = pywikibot.Page(self.targetSite, targetTitle) -targetImage.get(throttle=False) +targetImage.get() pywikibot.output(uImage with this name is already on %s. % self.targetSite) print(- * 60) -pywikibot.output(targetImage.get(throttle=False)) +pywikibot.output(targetImage.get()) sys.exit() except pywikibot.NoPage: # That's the normal case diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py index a0a9aa1..0374f5c 100644 --- a/scripts/solve_disambiguation.py +++ b/scripts/solve_disambiguation.py @@ -560,7 +560,7 @@ unlink = False new_targets = [] try: -text = refPage.get(throttle=False) +text = refPage.get() ignoreReason = self.checkContents(text) if ignoreReason: pywikibot.output('\n\nSkipping %s because it contains %s.\n\n' @@ -596,7 +596,7 @@ if not self.treat(refPage2, refPage): break elif choice == 'c': -text = refPage.get(throttle=False, get_redirect=True) +text = refPage.get(get_redirect=True) include = redirect except pywikibot.NoPage: pywikibot.output( -- To view, visit https://gerrit.wikimedia.org/r/179770 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib7812dd6c7bf0ae7cec657910a9e9cb6e275bfba Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Ricordisamoa ricordisa...@openmailbox.org Gerrit-Reviewer: John Vandenberg jay...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Merlijn van Deen valhall...@arctus.nl Gerrit-Reviewer: jenkins-bot ___ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits