[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Replace debian-sid with lucid
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/313832 Change subject: Replace debian-sid with lucid .. Replace debian-sid with lucid djvulibre-bin in debian-sid is incompatible with the Travis precise sudoless images. Use lucid instead. Bug: T145484 Change-Id: I6dda8892b1c020c7f8f0c1b1758f71b7250cd576 --- M .travis.yml 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/32/313832/1 diff --git a/.travis.yml b/.travis.yml index 5dc947f..9d46272 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ addons: apt: sources: - - debian-sid + - lucid packages: - libssl1.0.0 - djvulibre-bin -- To view, visit https://gerrit.wikimedia.org/r/313832 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6dda8892b1c020c7f8f0c1b1758f71b7250cd576 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Avoid broken pycparser 2.14
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/313821 Change subject: Avoid broken pycparser 2.14 .. Avoid broken pycparser 2.14 Package cryptography depends on cffi which depends on pycparser. pycparser 2.14 is broken and needs to be avoided. https://github.com/eliben/pycparser/issues/147 Change-Id: Ie95a686dc830d5c70f5dfd8205d579f344e4b193 --- M requests-requirements.txt M requirements.txt M setup.py 3 files changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/21/313821/1 diff --git a/requests-requirements.txt b/requests-requirements.txt index 4ad0a88..e5cf659 100644 --- a/requests-requirements.txt +++ b/requests-requirements.txt @@ -5,3 +5,5 @@ pyOpenSSL>=0.13 ; python_full_version < '2.7.9' or python_version >= '3' ndg-httpsclient ; python_full_version < '2.7.9' or python_version >= '3' pyasn1 ; python_full_version < '2.7.9' or python_version >= '3' +# https://github.com/eliben/pycparser/issues/147 +pycparser != 2.14 diff --git a/requirements.txt b/requirements.txt index 0aeb72d..83761b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,8 @@ pyOpenSSL>=0.13 ; python_full_version < '2.7.9' ndg-httpsclient ; python_full_version < '2.7.9' pyasn1 ; python_full_version < '2.7.9' +# https://github.com/eliben/pycparser/issues/147 +pycparser != 2.14 future>=0.15.0 ; python_version < '2.7' diff --git a/setup.py b/setup.py index f688df5..7abce5f 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ # 0.6.1 supports socket.io 1.0, but WMF is using 0.9 (T91393 and T85716) # websocket-client>=0.33 is required by socketIO-client (T114913) 'rcstream': ['socketIO-client<0.6.1', 'websocket-client>=0.33'], -'security': ['requests[security]'], +'security': ['requests[security]', 'pycparser!=2.14'], 'mwoauth': ['mwoauth>=0.2.4'], 'html': ['BeautifulSoup4'], } -- To view, visit https://gerrit.wikimedia.org/r/313821 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie95a686dc830d5c70f5dfd8205d579f344e4b193 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: pydocstyle 1.1.0 is incompatible with 1.0.x
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/313677 Change subject: pydocstyle 1.1.0 is incompatible with 1.0.x .. pydocstyle 1.1.0 is incompatible with 1.0.x Bug: T147126 Change-Id: Iabf7b612b1da55a3788148bb38721b9bdea3b672 --- M tox.ini 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/77/313677/1 diff --git a/tox.ini b/tox.ini index f053a96..5514562 100644 --- a/tox.ini +++ b/tox.ini @@ -52,6 +52,7 @@ basepython = python2.7 deps = flake8<3 pyflakes >= 1.1 + pydocstyle != 1.1.0 hacking flake8-docstrings>=0.2.6 flake8-putty>=0.3.2 -- To view, visit https://gerrit.wikimedia.org/r/313677 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iabf7b612b1da55a3788148bb38721b9bdea3b672 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: unicodedata2 9 supports Python 3
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/313676 Change subject: unicodedata2 9 supports Python 3 .. unicodedata2 9 supports Python 3 Change-Id: I5d416d548a5aef16b3217f41bcbbf296882422fa --- M requirements.txt M setup.py 2 files changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/76/313676/1 diff --git a/requirements.txt b/requirements.txt index 0aeb72d..71506d1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,6 +31,7 @@ ipaddr>=2.1.10 ; python_version < '3' unicodedata2>=7.0.0-2 ; python_version < '3' +unicodedata2>=9.0.0-2 ; python_version >= '3' # OAuth support # mwoauth 0.2.4 is needed because it supports getting identity information diff --git a/setup.py b/setup.py index f688df5..2e28367 100644 --- a/setup.py +++ b/setup.py @@ -66,6 +66,7 @@ 'security': ['requests[security]'], 'mwoauth': ['mwoauth>=0.2.4'], 'html': ['BeautifulSoup4'], +'unicode': ['unicodedata2>=9.0.0-2'], } if PY2: -- To view, visit https://gerrit.wikimedia.org/r/313676 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d416d548a5aef16b3217f41bcbbf296882422fa Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Use released flake8-mock 0.3
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/309816 Change subject: Use released flake8-mock 0.3 .. Use released flake8-mock 0.3 Change-Id: I10d134d8059236ea758065566a64edc390aeaab0 --- M dev-requirements.txt M tox.ini 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/16/309816/1 diff --git a/dev-requirements.txt b/dev-requirements.txt index e8bab19..edd5005 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -17,7 +17,7 @@ pyflakes>=0.9 flake8 flake8-docstrings>=0.2.6 -git+https://github.com/jayvdb/flake8-mock@use-ascii-readme +flake8-mock>=0.3 codecov coverage mock ; python_version < '3' diff --git a/tox.ini b/tox.ini index c436cf8..f053a96 100644 --- a/tox.ini +++ b/tox.ini @@ -62,7 +62,7 @@ flake8-import-order flake8-tuple>=0.2.8 flake8-print>=2.0.1 - git+https://github.com/jayvdb/flake8-mock@use-ascii-readme + flake8-mock>=0.3 pep8-naming [testenv:nose] -- To view, visit https://gerrit.wikimedia.org/r/309816 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I10d134d8059236ea758065566a64edc390aeaab0 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Allow importing to specified namespace
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/306219 Change subject: Allow importing to specified namespace .. Allow importing to specified namespace Bug: T143687 Change-Id: I4b0d8eef1a8ee5e4c5871140fe26b8763b1ea597 --- M maintenance/importDump.php 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/19/306219/1 diff --git a/maintenance/importDump.php b/maintenance/importDump.php index f0e0555..c926126 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -70,6 +70,8 @@ $this->addOption( 'namespaces', 'Import only the pages from namespaces belonging to the list of ' . 'pipe-separated namespace names or namespace indexes', false, true ); + $this->addOption( 'to-namespace', 'Pages will be imported into specified namespace', + false, true ); $this->addOption( 'rootpage', 'Pages will be imported as subpages of the specified page', false, true ); $this->addOption( 'dry-run', 'Parse dump without actually importing pages' ); -- To view, visit https://gerrit.wikimedia.org/r/306219 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b0d8eef1a8ee5e4c5871140fe26b8763b1ea597 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Split run method into __init__ and treat method
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/305869 Change subject: Split run method into __init__ and treat method .. Split run method into __init__ and treat method Change-Id: I18c29f25b272b2ccee6cfc7985f3997bb845a6db --- M scripts/unusedfiles.py 1 file changed, 29 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/69/305869/1 diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py index 3024a2a..147e869 100755 --- a/scripts/unusedfiles.py +++ b/scripts/unusedfiles.py @@ -44,8 +44,6 @@ super(UnusedFilesBot, self).__init__(**kwargs) self.site = site -def run(self): -"""Start the bot.""" template_image = i18n.translate(self.site, template_to_the_image) template_user = i18n.translate(self.site, @@ -54,27 +52,37 @@ if not all([template_image, template_user]): raise pywikibot.Error(u'This script is not localized for %s site.' % self.site) + +self.template_image = template_image +self.template_user = template_user + generator = pagegenerators.UnusedFilesGenerator(site=self.site) generator = pagegenerators.PreloadingGenerator(generator) -for image in generator: -if not image.exists(): -pywikibot.output("File '%s' does not exist (see bug T71133)." - % image.title()) -continue -# Use fileUrl() and fileIsShared() to confirm it is local media -# rather than a local page with the same name as shared media. -if (image.fileUrl() and not image.fileIsShared() and -u'http://' not in image.text): -if template_image in image.text: -pywikibot.output(u"%s done already" - % image.title(asLink=True)) -continue -self.append_text(image, u"\n\n" + template_image) -uploader = image.getFileVersionHistory().pop(0)['user'] -user = pywikibot.User(image.site, uploader) -usertalkpage = user.getUserTalkPage() -msg2uploader = template_user % {'title': image.title()} -self.append_text(usertalkpage, msg2uploader) + +self.generator = generator + +def treat(self, image): +"""Process one image page.""" +if not image.exists(): +pywikibot.output("File '%s' does not exist (see bug T71133)." + % image.title()) +return +# Use fileUrl() and fileIsShared() to confirm it is local media +# rather than a local page with the same name as shared media. +if (image.fileUrl() and not image.fileIsShared() and +u'http://' not in image.text): +if self.template_image in image.text: +pywikibot.output(u"%s done already" + % image.title(asLink=True)) +return + +self.append_text(image, '\n\n' + self.template_image) + +uploader = image.getFileVersionHistory().pop(0)['user'] +user = pywikibot.User(image.site, uploader) +usertalkpage = user.getUserTalkPage() +msg2uploader = self.template_user % {'title': image.title()} +self.append_text(usertalkpage, msg2uploader) def append_text(self, page, apptext): """Append apptext to the page.""" -- To view, visit https://gerrit.wikimedia.org/r/305869 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18c29f25b272b2ccee6cfc7985f3997bb845a6db Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Deprecate ReplaceBot.doReplacements
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/304974 Change subject: Deprecate ReplaceBot.doReplacements .. Deprecate ReplaceBot.doReplacements It was effectively deprecated by babc7cef. Change-Id: I01be5aa92faecbcf0819cbacc84d13c4470186f2 --- M scripts/replace.py 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/74/304974/1 diff --git a/scripts/replace.py b/scripts/replace.py index 7e3f0d9..0694ddf 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -629,6 +629,7 @@ return new_text +@deprecated('apply_replacements') def doReplacements(self, original_text, page=None): """Apply replacements to the given text and page.""" if page is None: -- To view, visit https://gerrit.wikimedia.org/r/304974 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I01be5aa92faecbcf0819cbacc84d13c4470186f2 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[2.0]: setup.py: Add Python 3.4 and 3.5 to pypi classifiers
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/303983 Change subject: setup.py: Add Python 3.4 and 3.5 to pypi classifiers .. setup.py: Add Python 3.4 and 3.5 to pypi classifiers Change-Id: I17fbde4172a5cd380c25b7f781a2a122f9313549 (cherry picked from commit b6e02407d8d1afde3c9df831f9bacb4a5a9f0e6e) --- M setup.py 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/83/303983/1 diff --git a/setup.py b/setup.py index 397dac1..265a915 100644 --- a/setup.py +++ b/setup.py @@ -188,6 +188,8 @@ 'Environment :: Console', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', +'Programming Language :: Python :: 3.4', +'Programming Language :: Python :: 3.5', ], use_2to3=False ) -- To view, visit https://gerrit.wikimedia.org/r/303983 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I17fbde4172a5cd380c25b7f781a2a122f9313549 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Legoktm ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[2.0]: Remove item count output in page generators
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/303376 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(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/76/303376/1 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: newchange Gerrit-Change-Id: Ia8b0e97930a94945d3ed2cdf593887ebff8a3e5c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[2.0]: Test Python 3.5 on Travis
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/303373 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(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/73/303373/1 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: newchange Gerrit-Change-Id: I31319a5feff31b3f4db1dacde782b7595917cf25 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[2.0]: Fix docstring capitalization in return types and behavior
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/303371 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(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/71/303371/1 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: newchange Gerrit-Change-Id: I08aea29e0db61ab930fb2fefd8f5d025f7d36f55 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Negative24 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[2.0]: Stop reading 'cookieprefix' upon login
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/303367 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(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/67/303367/1 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: newchange Gerrit-Change-Id: I449e75870fa2cbcb50a55c2b05805a2c084e6913 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Legoktm ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: flake8 v3 is not stable
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/301057 Change subject: flake8 v3 is not stable .. flake8 v3 is not stable Change-Id: I5e47fd359d06142242ac25ee018c7edc1dd9a703 --- M tox.ini 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/57/301057/1 diff --git a/tox.ini b/tox.ini index 541b1cb..8916507 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,7 @@ flake8 --version flake8 --doctests {posargs} basepython = python2.7 -deps = flake8 +deps = flake8<3 pyflakes >= 1.1 hacking flake8-docstrings>=0.2.6 -- To view, visit https://gerrit.wikimedia.org/r/301057 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5e47fd359d06142242ac25ee018c7edc1dd9a703 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Revert "Deactivate removeUselessSpaces due to several bugs" - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/299548 Change subject: Revert "Deactivate removeUselessSpaces due to several bugs" .. Revert "Deactivate removeUselessSpaces due to several bugs" This reverts commit 3ec08485811ac206456dea3c7b0a209ae0d7d7de. Change-Id: I8cca2348001beede0641c8c19738aadad0c59b7c --- M pywikibot/cosmetic_changes.py 1 file changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/48/299548/1 diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py index 5848140..72b74d2 100755 --- a/pywikibot/cosmetic_changes.py +++ b/pywikibot/cosmetic_changes.py @@ -226,8 +226,7 @@ self.replaceDeprecatedTemplates, # FIXME: fix bugs and re-enable # self.resolveHtmlEntities, -# FIXME: fix bugs with nested templates and re-enable -# self.removeUselessSpaces, +self.removeUselessSpaces, self.removeNonBreakingSpaceBeforePercent, self.fixHtml, -- To view, visit https://gerrit.wikimedia.org/r/299548 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cca2348001beede0641c8c19738aadad0c59b7c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix newline in three or more nested templates - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/299541 Change subject: Fix newline in three or more nested templates .. Fix newline in three or more nested templates NESTED_TEMPLATE_REGEX uses .* without re.DOTALL, so it fails to go into unhandled_depth mode when a newline appears in the nested templates. Change-Id: I91c27b657541abb5ebee061b0df34d4882d6f70a --- M pywikibot/textlib.py M tests/textlib_tests.py 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/41/299541/1 diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 32f8fe9..d379203 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -99,7 +99,7 @@ }} | (?P{{\s*[^{\|#0-9][^{\|#]*?\s* [^{]* {{ .* }}) -""", re.VERBOSE) +""", re.VERBOSE | re.DOTALL) # The following regex supports wikilinks anywhere after the first pipe # and correctly matches the end of the file link if the wikilink contains diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 89093ac..103d848 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -637,6 +637,16 @@ self.assertIsNotNone(m.group('unhandled_depth')) self.assertTrue(m.group(0).endswith('foo {{bar}}')) +m = func('{{a|\n{{c|{{d|}} }}\n| foo = bar }} foo {{bar}} baz') +self.assertIsNotNone(m) +self.assertIsNotNone(m.group(0)) +self.assertIsNone(m.group('name')) +self.assertIsNone(m.group(1)) +self.assertIsNone(m.group('params')) +self.assertIsNone(m.group(2)) +self.assertIsNotNone(m.group('unhandled_depth')) +self.assertTrue(m.group(0).endswith('foo {{bar}}')) + class TestGenericTemplateParams(PatchingTestCase): -- To view, visit https://gerrit.wikimedia.org/r/299541 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I91c27b657541abb5ebee061b0df34d4882d6f70a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Revert "[bugfix] fix tests for wikidata" - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/298452 Change subject: Revert "[bugfix] fix tests for wikidata" .. Revert "[bugfix] fix tests for wikidata" This reverts commit 8816913e4320dbac94c0d18926803ee8f5e8d44b. Change-Id: Ib435c5c64a3744f43aef639364dfbbd3b6712b08 --- M tests/wikibase_tests.py 1 file changed, 0 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/52/298452/1 diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index 6cfceaf..7b747e3 100644 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -1131,30 +1131,13 @@ }, } -def test_own_repository(self, key): -"""Test that a data repository family is its own repository.""" -site = self.get_site(key) -self.assertEqual(site, site.data_repository()) -self.assertTrue(site.is_data_repository) - def test_own_client(self, key): """Test that a data repository family can be its own client.""" site = self.get_site(key) -self.assertTrue(site.has_data_repository) -def test_item_exists(self): -"""Test that a ItemPage exists for wikidata:wikidata.""" -site = self.get_site('wikidata') page = pywikibot.Page(site, 'Wikidata:Main Page') item = pywikibot.ItemPage.fromPage(page) self.assertEqual(item.site, site) - -def test_item_not_exists(self): -"""Test that a ItemPage does not exists for test:wikidata.""" -site = self.get_site('wikidatatest') -page = pywikibot.Page(site, 'Wikidata:Main Page') -with self.assertRaises(pywikibot.NoPage): -pywikibot.ItemPage.fromPage(page) class TestUnconnectedClient(TestCase): -- To view, visit https://gerrit.wikimedia.org/r/298452 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib435c5c64a3744f43aef639364dfbbd3b6712b08 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix travis global environment variables - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/297366 Change subject: Fix travis global environment variables .. Fix travis global environment variables Remove the secure variable, which is available in the Travis settings. Change the syntax for TEST_TIMEOUT, as shippable can not understand the existing a: b syntax Change-Id: Id8162623647ea88c65bf6e2cd2bf5925e94b05bd --- M .travis.yml 1 file changed, 1 insertion(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/66/297366/1 diff --git a/.travis.yml b/.travis.yml index a0186ad..5dc947f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -121,12 +121,7 @@ env: global: -# This is the encrypted password for Wikimedia SUL user 'Pywikibot-test', -# and is only decrypted by Travis when running builds of code merged into -# the github repository 'wikimedia/pywikibot-core'. -# See http://docs.travis-ci.com/user/encryption-keys/ for more information. -- secure: kofInMlisiTBt9o/Ustc/vySlkKfxGzGCX2LwA1D2waym8sDTS0o5gMJ5LsrT/BUKwZbe1vLozPHqZrrkQvsdTml+DpZuotzdILs0m0f3BUoexEC6OON5IDljuxFyETrD1Ug44ih5Mc4lVFOdTcBzg501ZmswGwQrBvg/OyEFfE= -- TEST_TIMEOUT: 300 +- TEST_TIMEOUT=300 matrix: - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT2_TEST_PROD_ONLY=1 -- To view, visit https://gerrit.wikimedia.org/r/297366 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id8162623647ea88c65bf6e2cd2bf5925e94b05bd Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix notifications building from JSON - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/297119 Change subject: Fix notifications building from JSON .. Fix notifications building from JSON Sometimes (like in welcome messages), notifications don't have a 'title' property, so we shouldn't assume there is one. Bug: T139015 Change-Id: I83e480d04e8e09aa9bcb5edef4f56b47d150e199 (cherry picked from commit d387ab236634f91186805dd114ee85455d1244f8) --- M pywikibot/echo.py 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/19/297119/1 diff --git a/pywikibot/echo.py b/pywikibot/echo.py index 311827d..c42ddbb 100644 --- a/pywikibot/echo.py +++ b/pywikibot/echo.py @@ -27,8 +27,10 @@ notif.category = data['category'] notif.timestamp = pywikibot.Timestamp.fromtimestampformat(data['timestamp']['mw']) -# TODO: use 'namespace-key' + 'text' ? -notif.page = pywikibot.Page(site, data['title']['full']) +if 'title' in data and 'full' in data['title']: +notif.page = pywikibot.Page(site, data['title']['full']) +else: +notif.page = None if 'agent' in data and 'name' in data['agent']: notif.agent = pywikibot.User(site, data['agent']['name']) -- To view, visit https://gerrit.wikimedia.org/r/297119 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I83e480d04e8e09aa9bcb5edef4f56b47d150e199 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: APerson ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot: Store ImportError in imported variable - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/296411 Change subject: pywikibot: Store ImportError in imported variable .. pywikibot: Store ImportError in imported variable If a lazy ImportError is to be handled, the ImportError needs to be stored in a variable and then used when required. Earlier, the imported variable was set to `None` and the import error which was caught with `except` was used. But this import error may not exist at a later time as python guarantees it's existence only inside the `except` statement. Hence, this is changed so that the ImportError is saved in the variable that was being imported and checked later using `isinstance(, ImportError)`. Bug: T134336 Change-Id: I80f82e7f0674bfca70688f28640620dacac1d80b (manually cherry picked from commit 65cabc8258aa807a754a62182ae51fbf7df45ddd) --- M pywikibot/botirc.py M pywikibot/diff.py M scripts/flickrripper.py 3 files changed, 7 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/11/296411/1 diff --git a/pywikibot/botirc.py b/pywikibot/botirc.py index 77d258a..3294d76 100644 --- a/pywikibot/botirc.py +++ b/pywikibot/botirc.py @@ -25,13 +25,15 @@ try: from ircbot import SingleServerIRCBot except ImportError as e: +ircbot_import_error = e + class SingleServerIRCBot(object): """Fake SingleServerIRCBot.""" def __init__(*args, **kwargs): """Report import exception.""" -raise e +raise ircbot_import_error _logger = "botirc" diff --git a/pywikibot/diff.py b/pywikibot/diff.py index 08f939e..ee41492 100644 --- a/pywikibot/diff.py +++ b/pywikibot/diff.py @@ -20,11 +20,6 @@ else: from itertools import izip_longest as zip_longest -try: -from bs4 import BeautifulSoup -except ImportError as bserror: -BeautifulSoup = False - import pywikibot from pywikibot.tools import chars @@ -570,9 +565,7 @@ @return: deleted and added list of contexts @rtype: dict """ -# check if BeautifulSoup imported -if not BeautifulSoup: -raise bserror # should have been raised and stored earlier. +from bs4 import BeautifulSoup comparands = {'deleted-context': [], 'added-context': []} soup = BeautifulSoup(compare_string) diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py index 38e97df..568b5f2 100755 --- a/scripts/flickrripper.py +++ b/scripts/flickrripper.py @@ -62,7 +62,7 @@ try: from pywikibot.userinterfaces.gui import Tkdialog except ImportError as _tk_error: -Tkdialog = None +Tkdialog = _tk_error flickr_allowed_license = { @@ -295,7 +295,7 @@ override, addCategory, removeCategories) # pywikibot.output(photoDescription) -if Tkdialog is not None and not autonomous: +if not isinstance(Tkdialog, ImportError) and not autonomous: try: (newPhotoDescription, newFilename, skip) = Tkdialog( photoDescription, photo, filename).show_dialog() @@ -305,7 +305,7 @@ autonomous = True elif not autonomous: pywikibot.warning('Switching to autonomous mode because GUI interface cannot be used') -pywikibot.warning(_tk_error) +pywikibot.warning(Tkdialog) autonomous = True if autonomous: newPhotoDescription = photoDescription -- To view, visit https://gerrit.wikimedia.org/r/296411 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I80f82e7f0674bfca70688f28640620dacac1d80b Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: AbdealiJK ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use default tox pip install - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/296410 Change subject: Use default tox pip install .. Use default tox pip install Removing options --process-dependency-links --pre on main testenv, which is effective on other testenvs and installs a pre-release of flake8 that is incompatible with flake-putty. Bug: T138691 Change-Id: I0efc02ba536d88a503555fd4de30ad6b835dbbec (cherry picked from commit 8c224e53e32ccaccc50549341e098a0ac31a6a46) --- M tox.ini 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/10/296410/1 diff --git a/tox.ini b/tox.ini index 3c525f1..7fc1161 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,6 @@ setenv = VIRTUAL_ENV={envdir} usedevelop = True commands = python setup.py test -install_command = pip install --process-dependency-links --pre {opts} {packages} [testenv:flake8] commands = flake8 --ignore=D102,D103,D105,D211,E122,E127,E241,E402,E731 {posargs} -- To view, visit https://gerrit.wikimedia.org/r/296410 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0efc02ba536d88a503555fd4de30ad6b835dbbec Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [DNM] Use released findx 0.9.9 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/296190 Change subject: [DNM] Use released findx 0.9.9 .. [DNM] Use released findx 0.9.9 (should fail) Change-Id: I40158d4132689eeb909d990a64ff106f40e44810 --- M pwb.py M tox.ini 2 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/90/296190/1 diff --git a/pwb.py b/pwb.py index 88e40ee..03da726 100755 --- a/pwb.py +++ b/pwb.py @@ -26,6 +26,7 @@ import os import sys import types +import inspect from warnings import warn diff --git a/tox.ini b/tox.ini index bc027d7..98efc69 100644 --- a/tox.ini +++ b/tox.ini @@ -25,24 +25,24 @@ deps = unittest2 [testenv:pyflakes-py26] -commands = ffind --ignore-vcs . '(?=1.0.2 +findx >= 0.9.9 [testenv:pyflakes-py3] commands = findx . -name '*.py' -a '!' -path '*/.*' -a '!' -name 'user-config.py' : pyflakes basepython = python3 deps = -git+https://github.com/jayvdb/findx@exit_code +findx >= 0.9.9 pyflakes [testenv:pyflakes-pypy] commands = findx . -name '*.py' -a '!' -path '*/.*' -a '!' -name 'user-config.py' : pyflakes basepython = pypy deps = -git+https://github.com/jayvdb/findx@exit_code +findx >= 0.9.9 pyflakes [testenv:flake8] -- To view, visit https://gerrit.wikimedia.org/r/296190 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I40158d4132689eeb909d990a64ff106f40e44810 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Jenkins testing using mwparserfromhell and bs4 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/296082 Change subject: Jenkins testing using mwparserfromhell and bs4 .. Jenkins testing using mwparserfromhell and bs4 Add mwparserfromhell and bs4 to the nose34 rule. Change-Id: I1d6cabe3f5b58003b3ca922883548742e58d1685 --- M tox.ini 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/82/296082/1 diff --git a/tox.ini b/tox.ini index bc027d7..64a7572 100644 --- a/tox.ini +++ b/tox.ini @@ -80,6 +80,8 @@ nosetests --version nosetests --with-detecthttp -v -a '!net' tests deps = +mwparserfromhell +beautifulsoup4 nose nose-detecthttp>=0.1.3 six -- To view, visit https://gerrit.wikimedia.org/r/296082 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1d6cabe3f5b58003b3ca922883548742e58d1685 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use default tox pip install - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/296079 Change subject: Use default tox pip install .. Use default tox pip install Removing options --process-dependency-links --pre Change-Id: I0efc02ba536d88a503555fd4de30ad6b835dbbec --- M tox.ini 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/79/296079/1 diff --git a/tox.ini b/tox.ini index a7e3021..bc027d7 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,6 @@ PYWIKIBOT2_NO_USER_CONFIG=2 usedevelop = True commands = python setup.py test -install_command = pip install --process-dependency-links --pre {opts} {packages} [testenv:py26] deps = unittest2 -- To view, visit https://gerrit.wikimedia.org/r/296079 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0efc02ba536d88a503555fd4de30ad6b835dbbec Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Show ffind version - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/294907 Change subject: Show ffind version .. Show ffind version Change-Id: Iedfc0bf3a1a99d904aa3464a30eb6b2f594ed28d --- M tox.ini 1 file changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/07/294907/1 diff --git a/tox.ini b/tox.ini index 319e354..c281b5e 100644 --- a/tox.ini +++ b/tox.ini @@ -26,21 +26,27 @@ deps = unittest2 [testenv:pyflakes-py26] -commands = ffind --ignore-vcs . '(?=1.0.2 [testenv:pyflakes-py3] -commands = ffind --ignore-vcs . '(?=1.0.2 [testenv:pyflakes-pypy] -commands = ffind --ignore-vcs . '(?https://gerrit.wikimedia.org/r/294907 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iedfc0bf3a1a99d904aa3464a30eb6b2f594ed28d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add apt packages - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/292338 Change subject: Add apt packages .. Add apt packages Add trusty+sid job as precise does not have many packages such as python-unicodecsv, and precise+sid does not allow apt additions of python packages, as they drag in many other dependencies and the apt-get install fails. Package versions added: - bs4 - future - pycountry - stdnum 0.6 - unicodecsv - unittest2 Bug: T136807 Bug: T136808 Change-Id: Idb781e5af96f8d713511457cd18afd08c3091b83 --- M .travis.yml M pywikibot/cosmetic_changes.py M requirements.txt M scripts/isbn.py M tests/isbn_tests.py 5 files changed, 79 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/38/292338/1 diff --git a/.travis.yml b/.travis.yml index a0186ad..272703c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,9 +132,10 @@ - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT2_TEST_PROD_ONLY=1 - LANGUAGE=zh FAMILY=wikisource PYSETUP_TEST_EXTRAS=1 PYWIKIBOT2_TEST_PROD_ONLY=1 PYWIKIBOT2_TEST_NO_RC=1 +# Note: 2.7_with_system_site_packages is equivalent to virtualenv: system_site_packages: true matrix: include: -- python: '2.7_with_system_site_packages' # equivalent to virtualenv: system_site_packages: true +- python: '2.7_with_system_site_packages' env: LANGUAGE=he FAMILY=wikivoyage DIST=precise-sudo PYWIKIBOT2_TEST_NO_RC=1 dist: precise sudo: required @@ -144,7 +145,13 @@ - djvulibre-bin - graphviz - liblua5.1-0-dev +# python-bs4: diff broken - python-ipaddr +- python-pycountry +- python-six +- python-stdnum +- python-tz +- python-unittest2 - python: '2.7_with_system_site_packages' env: LANGUAGE=nb FAMILY=wikipedia DIST=trusty PYSETUP_TEST_EXTRAS=1 dist: trusty @@ -155,7 +162,34 @@ - djvulibre-bin - graphviz - liblua5.1-0-dev +- python-bs4 - python-ipaddr +- python-pycountry +- python-six +- python-stdnum +- python-tz +- python-unicodecsv +- python-unittest2 +- python: '2.7_with_system_site_packages' + env: LANGUAGE=test FAMILY=wikipedia DIST=trusty+sid PYSETUP_TEST_EXTRAS=1 + dist: trusty + sudo: required + addons: +apt: + sources: +- debian-sid + packages: +- djvulibre-bin +- liblua5.1-0-dev +- python-bs4 +- python-ipaddr +- python-future +- python-pycountry +- python-six +- python-stdnum +- python-tz +- python-unicodecsv +- python-unittest2 - python: '2.7' env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org" - python: '3.3' diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py index 6afa7b0..577bdc0 100755 --- a/pywikibot/cosmetic_changes.py +++ b/pywikibot/cosmetic_changes.py @@ -64,9 +64,23 @@ from warnings import warn try: -import stdnum.isbn as stdnum_isbn +from stdnum import isbn as stdnum_isbn +# 0.8 includes validate which raises useful exceptions +try: +from stdnum.exceptions import ValidationError as StdNumValidationError +from stdnum.isbn import validate as stdnum_isbn_validate +except ImportError: +stdnum_isbn_validate = None +StdNumValidationError = ValueError +try: +from stdnum.isbn import is_valid as stdnum_isbn_is_valid +except ImportError: +from stdnum.isbn import validate as stdnum_isbn_is_valid except ImportError: stdnum_isbn = None +stdnum_isbn_validate = None +stdnum_isbn_is_valid = None +StdNumValidationError = None import pywikibot @@ -159,8 +173,13 @@ isbn = match.group('code') if stdnum_isbn: try: -stdnum_isbn.validate(isbn) -except stdnum_isbn.ValidationError as e: +if stdnum_isbn_validate: +stdnum_isbn_validate(isbn) +else: +if not stdnum_isbn_is_valid(isbn): +raise StdNumValidationError( +'ISBN {0} not valid'.format(isbn)) +except StdNumValidationError as e: if strict: raise pywikibot.log('ISBN "%s" validation error: %s' % (isbn, e)) diff --git a/requirements.txt b/requirements.txt index 9b4400a..907bcec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -45,7 +45,7 @@ unicodecsv ; python_version < '3' and python_version >= '2.7' # cosmetic_changes and scripts/isbn -python-stdnum +python-stdnum>=0.2 # GUI Pillow @@ -86,7 +86,7 @@ # Also script
[MediaWiki-commits] [Gerrit] Update archived google.com URL - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291873 Change subject: Update archived google.com URL .. Update archived google.com URL web.archive.org previously returned /web//http://www.google.com/ as the archived URL for https://google.com It is now returning /web//http://google.com/ Change-Id: Ia928748b650554e629531e04effab32d55cd08f6 --- M tests/weblib_tests.py 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/73/291873/1 diff --git a/tests/weblib_tests.py b/tests/weblib_tests.py index 7e82081..43e3b79 100644 --- a/tests/weblib_tests.py +++ b/tests/weblib_tests.py @@ -50,7 +50,7 @@ parsed = urlparse(archivedversion) self.assertIn(parsed.scheme, [u'http', u'https']) self.assertEqual(parsed.netloc, u'web.archive.org') -self.assertTrue(parsed.path.strip('/').endswith('www.google.com'), parsed.path) +self.assertTrue(parsed.path.strip('/').endswith('google.com'), parsed.path) def testInternetArchiveOlder(self): """Test Internet Archive for https://google.com as of June 2006.""" @@ -58,7 +58,7 @@ parsed = urlparse(archivedversion) self.assertIn(parsed.scheme, [u'http', u'https']) self.assertEqual(parsed.netloc, u'web.archive.org') -self.assertTrue(parsed.path.strip('/').endswith('www.google.com'), parsed.path) +self.assertTrue(parsed.path.strip('/').endswith('google.com'), parsed.path) self.assertIn('200606', parsed.path) -- To view, visit https://gerrit.wikimedia.org/r/291873 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia928748b650554e629531e04effab32d55cd08f6 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] flake8-future-import 0.4.0 support - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291729 Change subject: flake8-future-import 0.4.0 support .. flake8-future-import 0.4.0 support flake8-future-import 0.4.0 introduces two new codes FI16 and FI17 for future features nested_scopes and generators that are mandatory on Python 2.6, and thus have not been listed in each file. These two, and FI12 (with_statement) can be deactivated by using the flake8-future-import option min-version = 2.6. Rather than forcing all devs to upgrade, also add the new codes to the ignore list. Change-Id: I71a05cec2077ab07190c2286107ad70f475daa71 --- M tox.ini 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/29/291729/1 diff --git a/tox.ini b/tox.ini index eb77d65..dcee400 100644 --- a/tox.ini +++ b/tox.ini @@ -126,8 +126,10 @@ # E402: module level import not at top of file; see T87409 # H201: Except: format # P102,P103: string does contain unindexed parameters; see I36355923 -ignore = E402,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101 +ignore = E402,D105,D211,FI10,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101 +#ignore = E402,D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,I100,I101 exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/* +min-version = 2.6 max_line_length = 100 accept-encodings = utf-8 require-code = true -- To view, visit https://gerrit.wikimedia.org/r/291729 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I71a05cec2077ab07190c2286107ad70f475daa71 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix flow tests - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291713 Change subject: Fix flow tests .. Fix flow tests mediawiki 'Talk:Sandbox' was moved to 'Project talk:Sandbox/Flow test' and the current revision now has a parent_id. Change-Id: Icf3c5fc1e5d2fe7e4706b9e113ad660cff3b1c1d --- M tests/flow_tests.py 1 file changed, 16 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/13/291713/1 diff --git a/tests/flow_tests.py b/tests/flow_tests.py index cf76536..fc24841 100644 --- a/tests/flow_tests.py +++ b/tests/flow_tests.py @@ -22,24 +22,30 @@ ) -class TestBoardBasePageMethods(BasePageMethodsTestBase): +class TestMediaWikiFlowSandbox(TestCase): -"""Test Flow board pages using BasePage-defined methods.""" +"""Test the Flow sandbox on MediaWiki.org.""" family = 'mediawiki' code = 'mediawiki' def setUp(self): """Set up unit test.""" -self._page = Board(self.site, 'Talk:Sandbox') -super(TestBoardBasePageMethods, self).setUp() +self._page = Board(self.site, 'Project_talk:Sandbox/Flow test') +super(TestMediaWikiFlowSandbox, self).setUp() + + +class TestBoardBasePageMethods(BasePageMethodsTestBase, + TestMediaWikiFlowSandbox): + +"""Test Flow board pages using BasePage-defined methods.""" def test_basepage_methods(self): """Test basic Page methods on a Flow board page.""" self._test_invoke() self._test_return_datatypes() self.assertFalse(self._page.isRedirectPage()) -self.assertEqual(self._page.latest_revision.parent_id, 0) +self.assertGreater(self._page.latest_revision.parent_id, 0) def test_content_model(self): """Test Flow page content model.""" @@ -70,17 +76,10 @@ self.assertEqual(self._page.content_model, 'flow-board') -class TestLoadRevisionsCaching(BasePageLoadRevisionsCachingTestBase): +class TestLoadRevisionsCaching(BasePageLoadRevisionsCachingTestBase, + TestMediaWikiFlowSandbox): """Test site.loadrevisions() caching.""" - -family = 'mediawiki' -code = 'mediawiki' - -def setUp(self): -"""Set up unit test.""" -self._page = Board(self.site, 'Talk:Sandbox') -super(TestLoadRevisionsCaching, self).setUp() def test_page_text(self): """Test site.loadrevisions() with Page.text.""" @@ -88,18 +87,15 @@ self._test_page_text() -class TestFlowLoading(TestCase): +class TestFlowLoading(TestMediaWikiFlowSandbox): """Test loading of Flow objects from the API.""" - -family = 'mediawiki' -code = 'mediawiki' cached = True def test_board_uuid(self): """Test retrieval of Flow board UUID.""" -board = Board(self.site, 'Talk:Sandbox') +board = self._page self.assertEqual(board.uuid, 'rl7iby6wgksbpfno') def test_topic_uuid(self): @@ -150,7 +146,7 @@ def test_topiclist(self): """Test loading of topiclist.""" -board = Board(self.site, 'Talk:Sandbox') +board = self._page i = 0 for topic in board.topics(limit=7): i += 1 -- To view, visit https://gerrit.wikimedia.org/r/291713 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icf3c5fc1e5d2fe7e4706b9e113ad660cff3b1c1d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use specific varied versions of Python - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291578 Change subject: Use specific varied versions of Python .. Use specific varied versions of Python Record the patch level of the Travis defaults, and use the recently added capability of Travis to install other versions on demand where possible. Not available via Travis python versions: - any other 2.6 except 2.6.9 - 2.7.0-2,4,5,7 - 3.3.0-2 - 3.4.0-1 Use pyenv to install 2.6.6 and 3.4.0 Change-Id: Ie87587dd8a841c9adeb9f74e35876bb3259fa89c --- M .travis.yml 1 file changed, 28 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/78/291578/1 diff --git a/.travis.yml b/.travis.yml index a0186ad..0348bc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,13 @@ sudo: false python: - - '2.7' - - '3.3' - - '3.4' - - '3.5' - - '2.6' + # Python minor versions pre-installed by Travis, with default patch level + - '2.7.9' + - '3.3.5' + - '3.4.2' + - '2.6.9' + # Installed on demand + - '3.5.1' # OSX builds do not yet support Python os: linux @@ -24,6 +26,14 @@ - liblua5.1-0-dev before_install: + # Use pyenv to install versions specified by $PYENV_VERSION + - | +git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT" +$PYENV_ROOT/bin/pyenv install --skip-existing "$PYENV_VERSION" +virtualenv --python="$PYENV_ROOT/versions/$PYENV_VERSION/bin/python" "$HOME/virtualenvs/$PYENV_VERSION" +source "$HOME/virtualenvs/$PYENV_VERSION/bin/activate" +python --version + # When PYSETUP_TEST_EXTRAS is not enabled, do not allow the # default 'install' step to install all dependencies listed in # requirements.txt to verify that a minimal install works as expected. @@ -126,7 +136,8 @@ # the github repository 'wikimedia/pywikibot-core'. # See http://docs.travis-ci.com/user/encryption-keys/ for more information. - secure: kofInMlisiTBt9o/Ustc/vySlkKfxGzGCX2LwA1D2waym8sDTS0o5gMJ5LsrT/BUKwZbe1vLozPHqZrrkQvsdTml+DpZuotzdILs0m0f3BUoexEC6OON5IDljuxFyETrD1Ug44ih5Mc4lVFOdTcBzg501ZmswGwQrBvg/OyEFfE= -- TEST_TIMEOUT: 300 +- TEST_TIMEOUT=300 +- PYENV_ROOT=$HOME/.pyenv matrix: - LANGUAGE=en FAMILY=wikipedia PYWIKIBOT2_TEST_PROD_ONLY=1 @@ -134,6 +145,7 @@ matrix: include: +# precise uses 2.7.3 - python: '2.7_with_system_site_packages' # equivalent to virtualenv: system_site_packages: true env: LANGUAGE=he FAMILY=wikivoyage DIST=precise-sudo PYWIKIBOT2_TEST_NO_RC=1 dist: precise @@ -145,6 +157,7 @@ - graphviz - liblua5.1-0-dev - python-ipaddr + # trusty uses 2.7.6 - python: '2.7_with_system_site_packages' env: LANGUAGE=nb FAMILY=wikipedia DIST=trusty PYSETUP_TEST_EXTRAS=1 dist: trusty @@ -156,24 +169,24 @@ - graphviz - liblua5.1-0-dev - python-ipaddr -- python: '2.7' +- python: '2.7.8' env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org" -- python: '3.3' +- python: '3.3.3' env: LANGUAGE=zh FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="zh.wikipedia.beta.wmflabs.org" - python: '3.4' - env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1 -- python: '2.7' + env: LANGUAGE=en FAMILY=wsbeta SITE_ONLY=1 PYENV_VERSION=3.4.0 PYSETUP_TEST_EXTRAS=1 +- python: '2.7.11' env: LANGUAGE=wikia FAMILY=wikia PYWIKIBOT2_TEST_NO_RC=1 -- python: '3.3' +- python: '3.3.6' env: LANGUAGE=en FAMILY=musicbrainz SITE_ONLY=1 -- python: '3.4' +- python: '3.4.4' env: LANGUAGE=test FAMILY=wikipedia SITE_ONLY=1 OAUTH_DOMAIN="test.wikipedia.org" -- python: '3.4' +- python: '3.4.3' env: LANGUAGE=test FAMILY=wikidata SITE_ONLY=1 -- python: '3.4' +- python: '3.5.0' env: LANGUAGE=ar FAMILY=wiktionary PYWIKIBOT2_TEST_NO_RC=1 - python: '2.6' - env: LANGUAGE=wikidata FAMILY=wikidata SITE_ONLY=1 + env: LANGUAGE=wikidata FAMILY=wikidata SITE_ONLY=1 PYENV_VERSION=2.6.6 PYSETUP_TEST_EXTRAS=1 notifications: email: -- To view, visit https://gerrit.wikimedia.org/r/291578 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie87587dd8a841c9adeb9f74e35876bb3259fa89c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Adjust recent added tests for case-sensitive site - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291577 Change subject: Adjust recent added tests for case-sensitive site .. Adjust recent added tests for case-sensitive site 2230213 caused new errors on the Travis wiktionary jobs. Also fix non-pep8 method names. Bug: T134676 Change-Id: I4eabed2fb7ebeaf1516bb1f80c00a50050efb51c --- M tests/textlib_tests.py 1 file changed, 25 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/77/291577/1 diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index e4dbc57..06d72ae 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -1353,44 +1353,60 @@ dry = True -def test_noMatch(self): +@classmethod +def setUpClass(cls): +"""Cache namespace 0 case sensitivity.""" +super(TestMultiTemplateMatchBuilder, cls).setUpClass() +cls._ns0_not_case_sensitive = ( +cls.get_site().namespaces[0].case != 'case-sensitive') + +def test_no_match(self): """Test text without any desired templates.""" string = 'The quick brown fox' builder = _MultiTemplateMatchBuilder(self.site) self.assertIsNone(re.search(builder.pattern('quick'), string)) -def test_Match(self): +def test_match(self): """Test text with one match without parameters.""" string = 'The {{quick}} brown fox' builder = _MultiTemplateMatchBuilder(self.site) self.assertIsNotNone(re.search(builder.pattern('quick'), string)) -self.assertIsNotNone(re.search(builder.pattern('Quick'), string)) +self.assertEqual(bool(re.search(builder.pattern('Quick'), string)), + self._ns0_not_case_sensitive) def test_match_with_params(self): """Test text with one match with parameters.""" -string = 'The {{Quick|brown}} fox' +string = 'The {{quick|brown}} fox' builder = _MultiTemplateMatchBuilder(self.site) self.assertIsNotNone(re.search(builder.pattern('quick'), string)) -self.assertIsNotNone(re.search(builder.pattern('Quick'), string)) +self.assertEqual(bool(re.search(builder.pattern('Quick'), string)), + self._ns0_not_case_sensitive) def test_match_msg(self): """Test text with {{msg:..}}.""" string = 'The {{msg:quick}} brown fox' builder = _MultiTemplateMatchBuilder(self.site) self.assertIsNotNone(re.search(builder.pattern('quick'), string)) -self.assertIsNotNone(re.search(builder.pattern('Quick'), string)) +self.assertEqual(bool(re.search(builder.pattern('Quick'), string)), + self._ns0_not_case_sensitive) def test_match_template_prefix(self): """Test pages with {{template:..}}.""" string = 'The {{%s:%s}} brown fox' template = 'template' builder = _MultiTemplateMatchBuilder(self.site) +if self._ns0_not_case_sensitive: +quick_list = ('quick', 'Quick') +else: +quick_list = ('quick', ) + for t in (template.upper(), template.lower(), template.title()): -for q in ('quick', 'Quick'): +for q in quick_list: self.assertIsNotNone(re.search(builder.pattern('quick'), string % (t, q))) -self.assertIsNotNone(re.search(builder.pattern('Quick'), - string % (t, q))) +self.assertEqual(bool(re.search(builder.pattern('Quick'), +string % (t, q))), + self._ns0_not_case_sensitive) class TestGetLanguageLinks(SiteAttributeTestCase): -- To view, visit https://gerrit.wikimedia.org/r/291577 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4eabed2fb7ebeaf1516bb1f80c00a50050efb51c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Clear exceptions in BaseBot.run before processing - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291523 Change subject: Clear exceptions in BaseBot.run before processing .. Clear exceptions in BaseBot.run before processing Bot classes use sys.exc_info, which can be a stale exception under Python 2. Bug: T136487 Change-Id: I01311cf9071ab45cb38bc5463153e887a76c5138 --- M pywikibot/bot.py 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/23/291523/1 diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 7dbb8ef..378f2b2 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -1414,6 +1414,10 @@ if PY2: maxint = sys.maxint +# Python 2 does not clear previous exceptions and method `exit` +# relies on sys.exc_info returning exceptions occurring in `run`. +sys.exc_clear() + try: for page in self.generator: try: -- To view, visit https://gerrit.wikimedia.org/r/291523 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I01311cf9071ab45cb38bc5463153e887a76c5138 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add asteroids that are being used as locations - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291199 Change subject: Add asteroids that are being used as locations .. Add asteroids that are being used as locations Used as globes for other items on Wikidata. Source: SELECT (count(?item) as ?c) ?globe ?globeLabel WHERE { ?item wdt:P376 ?globe . ?item wdt:P625 ?location . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } GROUP BY ?globe ?globeLabel ORDER BY DESC(?c) Change-Id: I049866d40d8ad4903f2445b6bf1fdf8a164202a3 (cherry picked from commit 9192099fb51570251e440e0be39959b0c8c7c465) --- M pywikibot/families/wikidata_family.py 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/99/291199/1 diff --git a/pywikibot/families/wikidata_family.py b/pywikibot/families/wikidata_family.py index 4340f3a..13f5546 100644 --- a/pywikibot/families/wikidata_family.py +++ b/pywikibot/families/wikidata_family.py @@ -56,12 +56,15 @@ 'dione': 'http://www.wikidata.org/entity/Q15040', 'earth': 'http://www.wikidata.org/entity/Q2', 'enceladus': 'http://www.wikidata.org/entity/Q3303', +'eros': 'http://www.wikidata.org/entity/Q16711', 'europa': 'http://www.wikidata.org/entity/Q3143', 'ganymede': 'http://www.wikidata.org/entity/Q3169', +'gaspra': 'http://www.wikidata.org/entity/Q158244', 'hyperion': 'http://www.wikidata.org/entity/Q15037', 'iapetus': 'http://www.wikidata.org/entity/Q17958', 'io': 'http://www.wikidata.org/entity/Q3123', 'jupiter': 'http://www.wikidata.org/entity/Q319', +'lutetia': 'http://www.wikidata.org/entity/Q107556', 'mars': 'http://www.wikidata.org/entity/Q111', 'mercury': 'http://www.wikidata.org/entity/Q308', 'mimas': 'http://www.wikidata.org/entity/Q15034', -- To view, visit https://gerrit.wikimedia.org/r/291199 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I049866d40d8ad4903f2445b6bf1fdf8a164202a3 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Smalyshev ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add PyPy builds - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/291155 Change subject: Add PyPy builds .. Add PyPy builds - unicodedata2 and lunatic-python are not PyPy compatible Change-Id: Ide8bcef49499d7f3bb7bcbf00bde3d42936e5672 --- M .travis.yml M pywikibot/__init__.py M requirements.txt M setup.py M tests/api_tests.py M tests/bot_tests.py M tests/i18n_tests.py M tests/pwb_tests.py M tests/script_tests.py M tests/tools_tests.py M tox.ini 11 files changed, 156 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/55/291155/1 diff --git a/.travis.yml b/.travis.yml index a0186ad..332e6a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ sudo: false python: + - 'pypy' - '2.7' - '3.3' - '3.4' @@ -30,10 +31,27 @@ # Instead install requests in the before_script step below. - if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then rm requirements.txt ; fi + # PyPy `pwb` based tests fail under plain unittest, but work under pytest + - if [[ "$TRAVIS_PYTHON_VERSION" = "pypy" ]]; then USE_PYTEST=1; fi + # When the env variable USE_NOSE or USE_PYTEST is set, the appropriate # tool is used, else PYTEST is taken as the default - - if [[ "$PYSETUP_TEST_EXTRAS" != '1' && "$USE_NOSE" != '1' && "$USE_PYTEST" != '1' ]]; then - export USE_PYTEST=1 ; + - | +if [[ "$USE_NOSE" != '1' && "$USE_PYTEST" != '1' ]]; then + if [[ "$NO_NET" == '1' ]]; then +export USE_PYTEST=1 + elif [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then +export USE_PYTEST=1 + fi +fi + + - if [[ -z "$FAMILY" ]]; then FAMILY=test; fi + - if [[ -z "$LANGUAGE" ]]; then LANGUAGE=test; fi + + - | +if [[ "$NO_NET" == '1' ]]; then + echo "Running no tests requiring network access" + echo "(however generate_family_file uses network)" fi - if [[ "$SITE_ONLY" == '1' ]]; then @@ -48,12 +66,29 @@ export PYWIKIBOT2_TEST_WRITE_FAIL=1 ; fi + # Set the default pypy version to be 2.6.1 + - if [[ "$PYPY_VERSION" != '' ]]; then PYPY_VERSION=2.6.1; fi + + - | # Based on Vlad Frolov's MIT licensed https://github.com/travis-ci/travis-ci/issues/5027#issuecomment-170939193 +if [[ "$TRAVIS_PYTHON_VERSION" = "pypy" && "$PYPY_VERSION" != 'default' ]]; then + export PYENV_ROOT="$HOME/.pyenv" + if [[ -f "$PYENV_ROOT/bin/pyenv" ]]; then +pushd "$PYENV_ROOT" && git pull && popd + else +rm -rf "$PYENV_ROOT" && git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT" + fi + "$PYENV_ROOT/bin/pyenv" install --skip-existing "pypy-$PYPY_VERSION" + virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION" + source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate" + python --version +fi + before_script: - pip install -r dev-requirements.txt script: # Install security packages for requests to support HTTPS in site_detect - - if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then + - if [[ "$PYSETUP_TEST_EXTRAS" != '1' && "$NO_NET" != '1' ]]; then pip install mwoauth -r requests-requirements.txt ; fi @@ -100,12 +135,17 @@ nosetests --version ; if [[ "$SITE_ONLY" == "1" ]]; then python setup.py nosetests --tests tests --verbosity=2 -a "family=$FAMILY,code=$LANGUAGE" --with-trim --with-coverage --cover-package=. ; + elif [[ "$NO_NET" == "1" ]]; then +python setup.py nosetests --tests tests --verbosity=2 -a "!net" --with-trim --with-coverage --cover-package=. ; else python setup.py nosetests --tests tests --verbosity=2 --with-trim --with-coverage --cover-package=. ; fi ; elif [[ "$USE_PYTEST" == "1" ]]; then + py.test --version ; if [[ "$SITE_ONLY" == "1" ]]; then python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=. -a \"family=='$FAMILY' and code=='$LANGUAGE'\"" ; + elif [[ "$NO_NET" == "1" ]]; then +python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=. -a \"not net\"" ; else python setup.py pytest --addopts="-vvv -s --timeout=$TEST_TIMEOUT --cov=." ; fi @@ -134,6 +174,14 @@ matrix: include: +# Test the Ubuntu precise pypy (2.5) without network +- python: 'pypy' + env: PYPY_VERSION=default NO_NET=1 USE_PYTEST=1 +- python: 'pypy' + env: PYPY_VERSION=default NO_NET=1 USE_NOSE=1 +# Test the Ubuntu precise pypy (2.5) with network; fails with T136382 +- python: 'pypy' + env: PYPY_VERSION=default - python: '2.7_with_system_site_packages' # equivalent to virtualenv: system_site_packages: true env: LANGUAGE=he FAMILY=wikivoyage DIST=precise-sudo PYWIKIBOT2_TEST_NO_RC=1 dist: precise @@ -174,6 +222,16 @@ env: LANGUAGE=ar FAMILY=wiktionary PYWIKIBOT2_TEST_NO_RC=1
[MediaWiki-commits] [Gerrit] [bugfix] Fix test_translateMagicWords test - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290927 Change subject: [bugfix] Fix test_translateMagicWords test .. [bugfix] Fix test_translateMagicWords test Bug: T132557 Change-Id: Ia845114619a40e639abdc415e37b793a1024f508 (cherry picked from commit 585a0d6d884cd5ec76f1969d2e6e40755c17b757) --- M tests/cosmetic_changes_tests.py 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/27/290927/1 diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index f864c76..8d28a3c 100644 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Test cosmetic_changes module.""" # -# (C) Pywikibot team, 2015 +# (C) Pywikibot team, 2015-2016 # # Distributed under the terms of the MIT license. # @@ -45,11 +45,11 @@ def test_translateMagicWords(self): """Test translateMagicWords method.""" self.assertEqual( -'[[File:Foo.bar|mini]]', +'[[File:Foo.bar|miniatur]]', self.cct.translateMagicWords('[[File:Foo.bar|thumb]]')) self.assertEqual( -'[[File:Foo.bar|mini]]', -self.cct.translateMagicWords('[[File:Foo.bar|miniatur]]')) +'[[File:Foo.bar|miniatur]]', +self.cct.translateMagicWords('[[File:Foo.bar|mini]]')) def test_cleanUpLinks_pipes(self): """Test cleanUpLinks method.""" -- To view, visit https://gerrit.wikimedia.org/r/290927 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia845114619a40e639abdc415e37b793a1024f508 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Xqt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix ID for Rhea - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290926 Change subject: Fix ID for Rhea .. Fix ID for Rhea Q108419 is the wrong Rhea - this is the female Titan, Q15050 is the moon of Saturn Change-Id: I1d15e017e1216c8c25af199da01d70be4c13478a (cherry picked from commit 21570f1f25b2a390ee32b804b85971fa04cc0001) --- M pywikibot/families/wikidata_family.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/26/290926/1 diff --git a/pywikibot/families/wikidata_family.py b/pywikibot/families/wikidata_family.py index 181c4c4..4340f3a 100644 --- a/pywikibot/families/wikidata_family.py +++ b/pywikibot/families/wikidata_family.py @@ -71,7 +71,7 @@ 'phobos': 'http://www.wikidata.org/entity/Q7547', 'phoebe': 'http://www.wikidata.org/entity/Q17975', 'pluto': 'http://www.wikidata.org/entity/Q339', -'rhea': 'http://www.wikidata.org/entity/Q108419', +'rhea': 'http://www.wikidata.org/entity/Q15050', 'tethys': 'http://www.wikidata.org/entity/Q15047', 'titan': 'http://www.wikidata.org/entity/Q2565', 'titania': 'http://www.wikidata.org/entity/Q3322', -- To view, visit https://gerrit.wikimedia.org/r/290926 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1d15e017e1216c8c25af199da01d70be4c13478a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Smalyshev ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add .coveragerc and codecov.yml - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290705 Change subject: Add .coveragerc and codecov.yml .. Add .coveragerc and codecov.yml Do not cover __main__ block in tests/ as they exists only to allow tests to be invoked without a test runner. Also ignore some test option code in tests/__init__.py Change-Id: Iec6260e4d44713f0cbb0fa5dd8eacc7aa8de6c4d --- A .codecov.yml A .coveragerc M tests/add_text_tests.py M tests/api_tests.py M tests/archivebot_tests.py M tests/basepage_tests.py M tests/bot_tests.py M tests/cache_tests.py M tests/category_bot_tests.py M tests/category_tests.py M tests/checkimages_tests.py M tests/cosmetic_changes_tests.py M tests/data_ingestion_tests.py M tests/date_tests.py M tests/deletionbot_tests.py M tests/deprecation_tests.py M tests/diff_tests.py M tests/disambredir_tests.py M tests/djvu_tests.py M tests/dry_api_tests.py M tests/dry_site_tests.py M tests/edit_failure_tests.py M tests/edit_tests.py M tests/exceptions_tests.py M tests/family_tests.py M tests/file_tests.py M tests/fixes_tests.py M tests/http_tests.py M tests/i18n_tests.py M tests/interwiki_graph_tests.py M tests/interwiki_link_tests.py M tests/interwikidata_tests.py M tests/isbn_tests.py M tests/l10n_tests.py M tests/link_tests.py M tests/logentry_tests.py M tests/mediawikiversion_tests.py M tests/namespace_tests.py M tests/oauth_tests.py M tests/page_tests.py M tests/pagegenerators_tests.py M tests/paraminfo_tests.py M tests/patrolbot_tests.py M tests/plural_tests.py M tests/proofreadpage_tests.py M tests/protectbot_tests.py M tests/pwb_tests.py M tests/python_tests.py M tests/reflinks_tests.py M tests/replacebot_tests.py M tests/script_tests.py M tests/site_detect_tests.py M tests/site_tests.py M tests/sparql_tests.py M tests/template_bot_tests.py M tests/tests_tests.py M tests/textlib_tests.py M tests/thread_tests.py M tests/timestamp_tests.py M tests/timestripper_tests.py M tests/tk_tests.py M tests/tools_chars_tests.py M tests/tools_formatter_tests.py M tests/tools_ip_tests.py M tests/tools_tests.py M tests/ui_options_tests.py M tests/ui_tests.py M tests/upload_tests.py M tests/uploadbot_tests.py M tests/user_tests.py M tests/weblib_tests.py M tests/weblinkchecker_tests.py M tests/wikibase_edit_tests.py M tests/wikibase_tests.py M tests/wikidataquery_tests.py M tests/wikistats_tests.py M tests/xmlreader_tests.py 77 files changed, 112 insertions(+), 75 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/05/290705/1 diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000..9602e90 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,29 @@ +codecov: + bot: jayvdb + +coverage: + status: +project: + default: +enabled: yes +patch: + default: +enabled: yes +changes: + default: +enabled: yes + + ignore: +- ez_setup.py +- tests/*edit*.py +- tests/*upload*.py + + notify: +irc: + default: +server: chat.freenode.net +channel: pywikibot + +gitter: + default: +url: https://webhooks.gitter.im/e/f312b840da1c40d9f4be diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000..cf272bf --- /dev/null +++ b/.coveragerc @@ -0,0 +1,8 @@ +[report] +exclude_lines = +if __debug__ and not PY2: # pyflakes workaround + +# Have to re-enable the standard pragma +pragma: no cover + +if .PYWIKIBOT_TEST_.*. in os.environ: diff --git a/tests/add_text_tests.py b/tests/add_text_tests.py index 9c90ef6..5430858 100644 --- a/tests/add_text_tests.py +++ b/tests/add_text_tests.py @@ -46,5 +46,5 @@ newtext) -if __name__ == "__main__": +if __name__ == '__main__': # pragma: no cover unittest.main() diff --git a/tests/api_tests.py b/tests/api_tests.py index 3e3e61a..c236f68 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -1026,7 +1026,7 @@ self.assertEqual(result, expect) self.assertIsInstance(result, str) -if __name__ == '__main__': +if __name__ == '__main__': # pragma: no cover try: unittest.main() except SystemExit: diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py index bf07034..9ea2ab8 100644 --- a/tests/archivebot_tests.py +++ b/tests/archivebot_tests.py @@ -93,7 +93,7 @@ # 'th': year is 2552 while regex assumes 19..|20.., might be fixed -if __name__ == '__main__': +if __name__ == '__main__': # pragma: no cover try: unittest.main() except SystemExit: diff --git a/tests/basepage_tests.py b/tests/basepage_tests.py index 8017671..3a1e66b 100644 --- a/tests/basepage_tests.py +++ b/tests/basepage_tests.py @@ -113,7 +113,7 @@ self.assertFalse(self._page.isCategoryRedirect()) self.assertTrue(self._page.botMayEdit()) -if __name__ == '__main__': +if __name__ == '__main__': # pragma: no cover try: unittest.mai
[MediaWiki-commits] [Gerrit] Use Python 3 compatible flake8-mock - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290655 Change subject: Use Python 3 compatible flake8-mock .. Use Python 3 compatible flake8-mock a57f1c introduced flake8-mock, however it fails to install on Windows on Python 3, an issue I had raised a month ago. (https://github.com/aleGpereira/flake8-mock/issues/3) Change-Id: I167f13918671d93075b8920527704113e868a90d --- M dev-requirements.txt M tox.ini 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/55/290655/1 diff --git a/dev-requirements.txt b/dev-requirements.txt index 44499a0..e8bab19 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -17,7 +17,7 @@ pyflakes>=0.9 flake8 flake8-docstrings>=0.2.6 -flake8-mock +git+https://github.com/jayvdb/flake8-mock@use-ascii-readme codecov coverage mock ; python_version < '3' diff --git a/tox.ini b/tox.ini index ea79390..d0052b8 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ flake8-import-order flake8-tuple>=0.2.8 flake8-print>=2.0.1 - flake8-mock + git+https://github.com/jayvdb/flake8-mock@use-ascii-readme [testenv:flake8-py3] commands = -- To view, visit https://gerrit.wikimedia.org/r/290655 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I167f13918671d93075b8920527704113e868a90d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [bugfix] pass User page object to NotEmailableError - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290638 Change subject: [bugfix] pass User page object to NotEmailableError .. [bugfix] pass User page object to NotEmailableError NotEmailableError is derived from PageRelatedError and expect a page object as first parameter but got a string. Bug: T135364 Change-Id: I5aad3aaa76802884b744f89a633d716e1aab5286 --- M pywikibot/page.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/38/290638/1 diff --git a/pywikibot/page.py b/pywikibot/page.py index a9c7a4e..a78ed9a 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -2843,7 +2843,7 @@ @rtype: bool """ if not self.isEmailable(): -raise NotEmailableError('%s is not mailable' % self.username) +raise NotEmailableError(self) if not self.site.has_right('sendemail'): raise UserRightsError('You don\'t have permission to send mail') -- To view, visit https://gerrit.wikimedia.org/r/290638 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5aad3aaa76802884b744f89a633d716e1aab5286 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Xqt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Run codecov on CI job failure - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290147 Change subject: Run codecov on CI job failure .. Run codecov on CI job failure Bug: T74863 Change-Id: Ic18750859336034c77d5e8757f6bd9cb7b74bd3a --- M .appveyor.yml M .travis.yml 2 files changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/47/290147/1 diff --git a/.appveyor.yml b/.appveyor.yml index 6e24d79..c7eff52 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -97,7 +97,10 @@ - set PYSETUP_TEST_NO_UI=1 - "%CMD_IN_ENV% coverage run setup.py test" -after_test: +on_failure: + - codecov + +on_success: - codecov artifacts: diff --git a/.travis.yml b/.travis.yml index fa8fef8..87954ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,6 +115,9 @@ after_success: codecov +after_failure: +codecov + env: global: # This is the encrypted password for Wikimedia SUL user 'Pywikibot-test', -- To view, visit https://gerrit.wikimedia.org/r/290147 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic18750859336034c77d5e8757f6bd9cb7b74bd3a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Travis workaround for TLSv1.2 on precise container - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290146 Change subject: Travis workaround for TLSv1.2 on precise container .. Travis workaround for TLSv1.2 on precise container Use debian-sid libssl1.0.0 on Precise containers. This debian sid package conflicts with Ubuntu packages graphviz and python-ipaddr, so they are only added on Trusty and Precise sudo builds. requests[security] was added in requests 2.4.1 and requests[security] added a pyOpenSSL>=0.13 dependency in requests 2.9.0. As precise-sudo has pyOpenSSL 0.12, and trusty has requests 2.2.1, these both need to be upgraded by pip otherwise they fail in setup.py which will not overwrite distribution packaged libraries with newer versions. Bug: T134647 Change-Id: Iabf344a417299214cdb92c5776cbe580cb6989e5 --- M .travis.yml M requests-requirements.txt M requirements.txt 3 files changed, 27 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/46/290146/1 diff --git a/.travis.yml b/.travis.yml index fa8fef8..e089d78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,12 @@ addons: apt: +sources: + - debian-sid packages: + - libssl1.0.0 - djvulibre-bin - - graphviz - liblua5.1-0-dev - - python-ipaddr before_install: # When PYSETUP_TEST_EXTRAS is not enabled, do not allow the @@ -131,11 +132,27 @@ matrix: include: - python: '2.7_with_system_site_packages' # equivalent to virtualenv: system_site_packages: true - env: LANGUAGE=he FAMILY=wikivoyage SITE_ONLY=1 -- python: '2.7' + env: LANGUAGE=he FAMILY=wikivoyage DIST=precise-sudo PYWIKIBOT2_TEST_NO_RC=1 + dist: precise + sudo: required + addons: +apt: + packages: +- djvulibre-bin +- graphviz +- liblua5.1-0-dev +- python-ipaddr +- python: '2.7_with_system_site_packages' env: LANGUAGE=nb FAMILY=wikipedia DIST=trusty dist: trusty sudo: required + addons: +apt: + packages: +- djvulibre-bin +- graphviz +- liblua5.1-0-dev +- python-ipaddr - python: '2.7' env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org" - python: '3.3' diff --git a/requests-requirements.txt b/requests-requirements.txt index 778c9f6..4ad0a88 100644 --- a/requests-requirements.txt +++ b/requests-requirements.txt @@ -1,7 +1,7 @@ -requests +requests>=2.4.1 # requests security extra # Bug T105767 on Python 2.7 release 9+ -pyOpenSSL ; python_full_version < '2.7.9' or python_version >= '3' +pyOpenSSL>=0.13 ; python_full_version < '2.7.9' or python_version >= '3' ndg-httpsclient ; python_full_version < '2.7.9' or python_version >= '3' pyasn1 ; python_full_version < '2.7.9' or python_version >= '3' diff --git a/requirements.txt b/requirements.txt index 3658030..9b4400a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,10 +19,10 @@ # $ awk -F '[#>=]' '{print $1}' requirements.txt | xargs apt-cache search # mandatory; see README.conversion.txt -requests +requests>=2.4.1 # requests security extra -pyOpenSSL ; python_full_version < '2.7.9' +pyOpenSSL>=0.13 ; python_full_version < '2.7.9' ndg-httpsclient ; python_full_version < '2.7.9' pyasn1 ; python_full_version < '2.7.9' @@ -82,6 +82,8 @@ # scripts/script_wui.py depends on Lua, which is not available using pip # but can be obtained from: https://github.com/bastibe/lunatic-python +# However, a better fork is: https://github.com/AlereDevices/lunatic-python +# Also script_wui.py is not currently functional, so it isnt installed here. # core HTML comparison parser in diff module beautifulsoup4 -- To view, visit https://gerrit.wikimedia.org/r/290146 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iabf344a417299214cdb92c5776cbe580cb6989e5 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Exclude branch 'nexqt' from Travis and Appveyor - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/290141 Change subject: Exclude branch 'nexqt' from Travis and Appveyor .. Exclude branch 'nexqt' from Travis and Appveyor Xqt is using 'nexqt' as a private branch on the Wikimedia account, where he +2's his own changes, which adds lots of odd results to the official Wikimedia pywikibot-core repository on https://travis-ci.org, https://ci.appveyor.com and https://codecov.io Developers can run builds under their own account, as described in tests/README.rst. Change-Id: I218378f85b5c4ccaaf432d1b3ff83a500738a871 --- M .appveyor.yml M .travis.yml 2 files changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/41/290141/1 diff --git a/.appveyor.yml b/.appveyor.yml index 6e24d79..f4e0f84 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -100,5 +100,9 @@ after_test: - codecov +branches: + except: +- nexqt + artifacts: - path: dist\* .coverage coverage.xml diff --git a/.travis.yml b/.travis.yml index fa8fef8..eed13bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -155,6 +155,10 @@ - python: '2.6' env: LANGUAGE=wikidata FAMILY=wikidata SITE_ONLY=1 +branches: + except: +- nexqt + notifications: email: recipients: -- To view, visit https://gerrit.wikimedia.org/r/290141 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I218378f85b5c4ccaaf432d1b3ff83a500738a871 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use flake8-mock and fix mock.assert_called_once - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/289894 Change subject: Use flake8-mock and fix mock.assert_called_once .. Use flake8-mock and fix mock.assert_called_once assert_called_once doesnt do anything. assert_called_once_with is the correct function name, but it is best avoided by using call_count. Also enable flake8-mock, which flags this as M001. Change-Id: I9f6e0c5c2b0f41b5b6d4cef33dcc3829b8dc1e05 --- M dev-requirements.txt M tests/diff_tests.py M tox.ini 3 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/94/289894/1 diff --git a/dev-requirements.txt b/dev-requirements.txt index baed441..44499a0 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -17,6 +17,7 @@ pyflakes>=0.9 flake8 flake8-docstrings>=0.2.6 +flake8-mock codecov coverage mock ; python_version < '3' diff --git a/tests/diff_tests.py b/tests/diff_tests.py index 402ad74..b94911f 100644 --- a/tests/diff_tests.py +++ b/tests/diff_tests.py @@ -94,7 +94,7 @@ @patch('{0}.__import__'.format('__builtin__' if PY2 else 'builtins'), - side_effect=ImportError) + side_effect=ImportError, autospec=True) class TestNoBeautifulSoup(TestCase): """Test functions when BeautifulSoup is not installes.""" @@ -104,7 +104,7 @@ def test_html_comparator(self, mocked_import): """Test html_comparator when bs4 not installed.""" self.assertRaises(ImportError, html_comparator, '') -mocked_import.assert_called_once() +self.assertEqual(mocked_import.call_count, 1) self.assertIn('bs4', mocked_import.call_args[0]) diff --git a/tox.ini b/tox.ini index 040e501..ea79390 100644 --- a/tox.ini +++ b/tox.ini @@ -38,6 +38,7 @@ flake8-import-order flake8-tuple>=0.2.8 flake8-print>=2.0.1 + flake8-mock [testenv:flake8-py3] commands = -- To view, visit https://gerrit.wikimedia.org/r/289894 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9f6e0c5c2b0f41b5b6d4cef33dcc3829b8dc1e05 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add a trusty build - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/289818 Change subject: Add a trusty build .. Add a trusty build Use ht.wikipedia as it is an ArticlePlaceholder trial site Change-Id: Ic248ecb7fa28a0168bf5c90750cc107924ab8c75 --- M .travis.yml 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/18/289818/1 diff --git a/.travis.yml b/.travis.yml index efd9c68..ebf6b6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -126,6 +126,10 @@ - python: '2.7_with_system_site_packages' # equivalent to virtualenv: system_site_packages: true env: LANGUAGE=he FAMILY=wikivoyage SITE_ONLY=1 - python: '2.7' + env: LANGUAGE=ht FAMILY=wikipedia DIST=trusty + dist: trusty + sudo: required +- python: '2.7' env: LANGUAGE=en FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="en.wikipedia.beta.wmflabs.org" - python: '3.3' env: LANGUAGE=zh FAMILY=wpbeta SITE_ONLY=1 OAUTH_DOMAIN="zh.wikipedia.beta.wmflabs.org" -- To view, visit https://gerrit.wikimedia.org/r/289818 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic248ecb7fa28a0168bf5c90750cc107924ab8c75 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Re-enable APT addon for jobs in matrix include - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/289659 Change subject: Re-enable APT addon for jobs in matrix include .. Re-enable APT addon for jobs in matrix include The installation of apt packages was inadvertantly disabled in August 2015 with 8004cdfe29 due to https://github.com/travis-ci/travis-ci/issues/5405 . Bug: T135701 Change-Id: Iaaa562a145b3aca8737af4ac3fc2418496d2747a --- M .travis.yml 1 file changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/59/289659/1 diff --git a/.travis.yml b/.travis.yml index 400862f..efd9c68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,7 @@ - '2.6' # OSX builds do not yet support Python -os: - - linux +os: linux addons: apt: -- To view, visit https://gerrit.wikimedia.org/r/289659 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaaa562a145b3aca8737af4ac3fc2418496d2747a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use py.test for some Travis jobs with 300s timeout - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/289385 Change subject: Use py.test for some Travis jobs with 300s timeout .. Use py.test for some Travis jobs with 300s timeout Use pytest-runner to run tests using py.test and pytest-timeout to kill jobs which take too long. Use py.text except for SITE_ONLY=1 or PYSETUP_TEST_EXTRAS=1 Bug: T115313 Change-Id: Iae8a77918a3a4ce5a1dba731be6d47716b1c8d02 --- M .travis.yml M dev-requirements.txt M tests/README.rst M tests/script_tests.py M tests/weblib_tests.py M tox.ini 6 files changed, 48 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/85/289385/1 diff --git a/.travis.yml b/.travis.yml index 90cbacb..15d08b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,12 @@ # Instead install requests in the before_script step below. - if [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then rm requirements.txt ; fi - - if [[ "$SITE_ONLY" == '1' ]]; then export USE_NOSE=1; fi + - if [[ "$SITE_ONLY" == '1' ]]; then + export USE_NOSE=1 ; +elif [[ "$PYSETUP_TEST_EXTRAS" != '1' ]]; then + export USE_PYTEST=1 ; +fi + - export GITHUB_USER=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 1` - mkdir ~/.python-eggs - chmod 700 ~/.python-eggs @@ -95,6 +100,9 @@ else python setup.py nosetests --tests tests --verbosity=2 --with-coverage --cover-package=. ; fi ; +elif [[ "$USE_PYTEST" == "1" ]]; then + pip install --upgrade pytest-runner pytest-cov pytest-timeout "pytest>=2.8.0" ; + python setup.py pytest --addopts="-vvv -s --timeout=300 --cov=." ; else coverage run setup.py test ; fi diff --git a/dev-requirements.txt b/dev-requirements.txt index d990436..65c3ee8 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -2,6 +2,14 @@ # unittest2==0.8.0 ; python_full_version < '2.7.3' +pytest +# These are used by only some Travis builds +# pytest-timeout needs >=2.8.0 +# pytest>=2.8.0 +# pytest-timeout +# pytest-runner +# pytest-cov + six nose diff --git a/tests/README.rst b/tests/README.rst index 9c80c36..fff848f 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -34,6 +34,10 @@ python setup.py nosetests --tests tests +:: + +pip install pytest-runner +python setup.py pytest Module unittest ~~~ @@ -48,6 +52,13 @@ :: nosetests -v + +pytest +~~ + +:: + +py.test tox ~~~ @@ -67,6 +78,7 @@ :: python -m unittest -v tests.api_tests tests.site_tests +python -m unittest -v tests.api_tests.TestParamInfo.test_init nose @@ -74,6 +86,15 @@ :: nosetests -v tests.api_tests tests.site_tests +python -m unittest -v tests.api_tests:TestParamInfo.test_init + +pytest +~~ + +:: + +py.test -s -v tests/api_tests.py tests/site_tests.py +py.test -s -v tests/api_tests.py::TestParamInfo::test_init pwb ~~~ @@ -82,6 +103,7 @@ python pwb.py tests/api_tests.py -v python pwb.py tests/site_tests.py -v +python pwb.py tests/api_tests.py -v TestParamInfo.test_init env ~~~ diff --git a/tests/script_tests.py b/tests/script_tests.py index 4fdd9ec..5837e98 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -363,6 +363,8 @@ # Disable test by default in nosetests if script_name in unrunnable_script_list: +# flag them as an expectedFailure due to py.test (T135594) +dct[test_name] = unittest.expectedFailure(dct[test_name]) dct[test_name].__test__ = False return super(TestScriptMeta, cls).__new__(cls, name, bases, dct) diff --git a/tests/weblib_tests.py b/tests/weblib_tests.py index 13c5a13..3ef7c70 100644 --- a/tests/weblib_tests.py +++ b/tests/weblib_tests.py @@ -77,6 +77,7 @@ self.assertOneDeprecation() return archivedversion +@unittest.expectedFailure # See T110640 def testWebCiteOlder(self): """Test WebCite for https://google.com as of January 2013.""" archivedversion = self._get_archive_url('https://google.com', '20130101') diff --git a/tox.ini b/tox.ini index 5d34c3a..040e501 100644 --- a/tox.ini +++ b/tox.ini @@ -152,3 +152,9 @@ [pep257] # see explanations above ignore = D105,D211 + +[pytest] +python_files=tests/*.py +# disable recursing into tests/pwb, as that prints the environment, +# exposing any secure variables in Travis. +norecursedirs=.git .svn .tox pwb -- To view, visit https://gerrit.wikimedia.org/r/289385 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iae8a77918a3a4ce5a1dba731be6d47716b1c8d02 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://
[MediaWiki-commits] [Gerrit] Activate nosetrim to reduce repeated errors - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/289355 Change subject: Activate nosetrim to reduce repeated errors .. Activate nosetrim to reduce repeated errors The OAuth jobs for wmfbeta sites are failing due to an authentication problem, causing mosts tests to fail. Nose normally and helpfully emits a lot of logging information for failed jobs. However when there is a systemic problem, as currently occurs with the wmfbeta sites, the result is the job logs are very large, which affects developers ability to understand the failures and it exceeds the Travis maximum log size. Change-Id: I048e04a9451d25bf6893755bf73007f944578191 --- M .travis.yml M dev-requirements.txt 2 files changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/55/289355/1 diff --git a/.travis.yml b/.travis.yml index 90cbacb..1930065 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,9 +91,9 @@ nosetests --version ; if [[ "$SITE_ONLY" == "1" ]]; then echo "Running site tests only code ${LANGUAGE} on family ${FAMILY}" ; -python setup.py nosetests --tests tests --verbosity=2 -a "family=$FAMILY,code=$LANGUAGE" --with-coverage --cover-package=. ; +python setup.py nosetests --tests tests --verbosity=2 -a "family=$FAMILY,code=$LANGUAGE" --with-trim --with-coverage --cover-package=. ; else -python setup.py nosetests --tests tests --verbosity=2 --with-coverage --cover-package=. ; +python setup.py nosetests --tests tests --verbosity=2 --with-trim --with-coverage --cover-package=. ; fi ; else coverage run setup.py test ; diff --git a/dev-requirements.txt b/dev-requirements.txt index d990436..8243906 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,6 +5,7 @@ six nose +git+https://github.com/jayvdb/nosetrim@py3 pep257>=0.6 pyflakes>=0.9 -- To view, visit https://gerrit.wikimedia.org/r/289355 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I048e04a9451d25bf6893755bf73007f944578191 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] WikibaseSearchItemPageGenerator non-verbose mode - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/289339 Change subject: WikibaseSearchItemPageGenerator non-verbose mode .. WikibaseSearchItemPageGenerator non-verbose mode 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. Change-Id: Ia8b0e97930a94945d3ed2cdf593887ebff8a3e5c --- M pywikibot/pagegenerators.py M tests/pagegenerators_tests.py 2 files changed, 20 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/39/289339/1 diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 6c7a2b2..e42ba58 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -838,7 +838,8 @@ value = params[-1] lang = params[0] if len(params) == 2 else None gen = WikibaseSearchItemPageGenerator(value, language=lang, - site=self.site) + site=self.site, + verbose=config.verbose_output) elif arg == '-search': if not value: value = pywikibot.input('What do you want to search for?') @@ -2688,7 +2689,8 @@ return WikidataPageFromItemGenerator(items_pages, site) -def WikibaseSearchItemPageGenerator(text, language=None, total=None, site=None): +def WikibaseSearchItemPageGenerator(text, language=None, total=None, site=None, +verbose=None): """ Generate pages that contain the provided text. @@ -2702,6 +2704,8 @@ @type total: int or None @param site: Site for generator results. @type site: L{pywikibot.site.BaseSite} +@param verbose: Display an item count if True or None +@type verbose: bool or None """ if site is None: site = pywikibot.Site() @@ -2710,7 +2714,9 @@ repo = site.data_repository() data = repo.search_entities(text, language, limit=total) -pywikibot.output(u'retrieved %d items' % len(list(data))) +if verbose is None or verbose: +data = list(data) +pywikibot.output('retrieved %d items' % len(data)) for item in data: yield pywikibot.ItemPage(repo, item['id']) diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index b1a0057..12caea2 100755 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -970,7 +970,7 @@ 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.""" @@ -978,13 +978,20 @@ gf.handleArg('-searchitem:pl:abc') 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') 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/289339 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia8b0e97930a94945d3ed2cdf593887ebff8a3e5c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add mock to test dependencies - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/286293 Change subject: Add mock to test dependencies .. Add mock to test dependencies Change-Id: I5be552c7c0fe86113071ee03a4bec52567a7a9a0 --- M setup.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/93/286293/1 diff --git a/setup.py b/setup.py index 2457f81..fa1da3a 100644 --- a/setup.py +++ b/setup.py @@ -178,7 +178,7 @@ # These extra dependencies are needed other unittest fails to load tests. if sys.version_info[0] == 2: -test_deps += extra_deps['csv'] +test_deps += extra_deps['csv'] + ['mock'] else: test_deps += ['six'] -- To view, visit https://gerrit.wikimedia.org/r/286293 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5be552c7c0fe86113071ee03a4bec52567a7a9a0 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] PyFlakes 1.1 has been released - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/282306 Change subject: PyFlakes 1.1 has been released .. PyFlakes 1.1 has been released Change-Id: Id161e41c47acf44141817798f4128d6b8ac30934 --- M tox.ini 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/06/282306/1 diff --git a/tox.ini b/tox.ini index e52aa93..d9fb25d 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ flake8 --doctests {posargs} basepython = python2.7 deps = flake8 - git+https://github.com/pyflakes/pyflakes.git + pyflakes >= 1.1 hacking flake8-docstrings<0.2.2 flake8-putty>=0.2.0 @@ -45,7 +45,7 @@ flake8 --doctests {posargs} basepython = python3 deps = flake8 - git+https://github.com/pyflakes/pyflakes.git + pyflakes >= 1.1 flake8-docstrings<0.2.2 flake8-putty>=0.2.0 -- To view, visit https://gerrit.wikimedia.org/r/282306 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id161e41c47acf44141817798f4128d6b8ac30934 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use flake8-putty 0.3.0 auto ignore - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/282082 Change subject: Use flake8-putty 0.3.0 auto ignore .. Use flake8-putty 0.3.0 auto ignore Instead of flake8's general # noqa, flake8-putty 0.3.0 allows individual codes to be disabled with '# flake8: disable=xxx' Change-Id: I21ee56755311c4c5f9cd427e2ce8aca35568b7f7 --- M pywikibot/comms/http.py M scripts/flickrripper.py M tox.ini 3 files changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/82/282082/1 diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index 260f486..30df06f 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -93,7 +93,7 @@ message = 'Closing network session.' if hasattr(sys, 'last_type'): # we quit because of an exception -print(sys.last_type) # noqa: print +print(sys.last_type) # flake8: disable=T001 critical(message) else: log(message) diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py index 7fa9bce..7f5a20b 100755 --- a/scripts/flickrripper.py +++ b/scripts/flickrripper.py @@ -50,8 +50,8 @@ import flickrapi# see: http://stuvel.eu/projects/flickrapi except ImportError as e: print('This script requires the python flickrapi module. \n' - 'See: http://stuvel.eu/projects/flickrapi') # noqa: print -print(e) # noqa: print + 'See: http://stuvel.eu/projects/flickrapi') # flake8: disable=T001 +print(e) # flake8: disable=T001 sys.exit(1) import pywikibot diff --git a/tox.ini b/tox.ini index e52aa93..93fe69f 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ git+https://github.com/pyflakes/pyflakes.git hacking flake8-docstrings<0.2.2 - flake8-putty>=0.2.0 + flake8-putty>=0.3.0 flake8-coding flake8-future-import flake8-string-format @@ -47,7 +47,7 @@ deps = flake8 git+https://github.com/pyflakes/pyflakes.git flake8-docstrings<0.2.2 - flake8-putty>=0.2.0 + flake8-putty>=0.3.0 [testenv:nose] commands = @@ -116,6 +116,7 @@ max_line_length = 100 accept-encodings = utf-8 require-code = true +putty-auto-ignore = true putty-ignore = pwb.py,scripts/interwiki.py,scripts/flickrripper.py,pywikibot/site.py, /# noqa: E731/ : +E731 generate_family_file.py : +T001, T003 -- To view, visit https://gerrit.wikimedia.org/r/282082 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I21ee56755311c4c5f9cd427e2ce8aca35568b7f7 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix incorrect use of quad quotes for docstring - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/278704 Change subject: Fix incorrect use of quad quotes for docstring .. Fix incorrect use of quad quotes for docstring Added in 5a94f9e1 Change-Id: Icb86387d6f8457f6091d75b39fde68ba4c292501 --- M pywikibot/cosmetic_changes.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/04/278704/1 diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py index 7ba4c8e..6afa7b0 100755 --- a/pywikibot/cosmetic_changes.py +++ b/pywikibot/cosmetic_changes.py @@ -617,7 +617,7 @@ return text def resolveHtmlEntities(self, text): -Resolve html entities.""" +"""Replace HTML entities with unicode.""" ignore = [ 38, # Ampersand (&) 39, # Single quotation mark (") - bug T26093 -- To view, visit https://gerrit.wikimedia.org/r/278704 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb86387d6f8457f6091d75b39fde68ba4c292501 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Additional tests for CC fixArabicLetters - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/278599 Change subject: Additional tests for CC fixArabicLetters .. Additional tests for CC fixArabicLetters More coverage of functionality, especially of comma exception. Change-Id: I019e13bc91cd65554d609de47efeecfd94e24f08 --- M tests/cosmetic_changes_tests.py 1 file changed, 35 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/99/278599/1 diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index 80a0595..0a9ca16 100644 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -300,12 +300,45 @@ family = 'wikipedia' code = 'fa' -def test_fixArabicLetters(self): -"""Test fixArabicLetters.""" +def test_fixArabicLetters_comma(self): +"""Test fixArabicLetters comma.""" +self.assertEqual(self.cct.fixArabicLetters(','), '،') self.assertEqual(self.cct.fixArabicLetters('A,b,ا,۴,'), 'A,b،ا،۴،') + +def test_fixArabicLetters_comma_skip(self): +"""Test fixArabicLetters Latin comma not replaced.""" +self.assertEqual(self.cct.fixArabicLetters('a", b'), 'a", b') +self.assertEqual(self.cct.fixArabicLetters('a, "b'), 'a, "b') +self.assertEqual(self.cct.fixArabicLetters('a", "b'), 'a", "b') +# spaces are not required +self.assertEqual(self.cct.fixArabicLetters('a",b'), 'a",b') +self.assertEqual(self.cct.fixArabicLetters('a,"b'), 'a,"b') +self.assertEqual(self.cct.fixArabicLetters('a","b'), 'a","b') +# quotes are a 'non-Farsi' character; additional non-Farsi not needed +self.assertEqual(self.cct.fixArabicLetters('",b'), '",b') +self.assertEqual(self.cct.fixArabicLetters('a,"'), 'a,"') +self.assertEqual(self.cct.fixArabicLetters('","'), '","') + +# A single quotation is a 'non-Farsi' character +self.assertEqual(self.cct.fixArabicLetters("',b"), "',b") +self.assertEqual(self.cct.fixArabicLetters("a,'"), "a,'") +self.assertEqual(self.cct.fixArabicLetters("','"), "','") + +# A space is a 'non-Farsi' character +self.assertEqual(self.cct.fixArabicLetters('a", ۴'), 'a", ۴') +self.assertEqual(self.cct.fixArabicLetters(' , '), ' , ') + +def test_fixArabicLetters_letters(self): +self.assertEqual(self.cct.fixArabicLetters('ك'), + 'ک') +self.assertEqual(self.cct.fixArabicLetters('ي'), + 'ی') +self.assertEqual(self.cct.fixArabicLetters('ى'), + 'ی') self.assertEqual(self.cct.fixArabicLetters('كي'), 'کی') + # Once numbering fixes are enabled we can add tests. if __name__ == '__main__': -- To view, visit https://gerrit.wikimedia.org/r/278599 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I019e13bc91cd65554d609de47efeecfd94e24f08 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] tests.utils.execute: accept locale 'C' or missing - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/278300 Change subject: tests.utils.execute: accept locale 'C' or missing .. tests.utils.execute: accept locale 'C' or missing As per f7ecddb, for the test suite Bug: T129406 Change-Id: If097b88c44a9726958511ec77ce57b90db37d00d --- M tests/utils.py 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/00/278300/1 diff --git a/tests/utils.py b/tests/utils.py index bc5cfa2..9c09991 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -806,7 +806,11 @@ # A complete locale string needs to be created, so the country code # is guessed, however it is discarded when loading config. if config.userinterface_lang: -current_locale = locale.getdefaultlocale()[0].split('.')[0] +current_locale = locale.getdefaultlocale()[0] +if current_locale in [None, 'C']: +current_locale = 'en' +else: +current_locale = current_locale.split('.')[0] locale_prefix = str(config.userinterface_lang + '_') if not current_locale.startswith(locale_prefix): -- To view, visit https://gerrit.wikimedia.org/r/278300 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If097b88c44a9726958511ec77ce57b90db37d00d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Disable other languages for musicbrainz wiki - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/278309 Change subject: Disable other languages for musicbrainz wiki .. Disable other languages for musicbrainz wiki wiki.musicbrainz.org is reporting that it has languages 'ab' and 'lb', when these are actually interwiki links not interlanguage links. Bug: T130381 Change-Id: I4761396f4c4ede1cb2dd90cfb9cfac56220b8b9a --- M .travis.yml 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/09/278309/1 diff --git a/.travis.yml b/.travis.yml index 81b9956..90cbacb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ - mkdir ~/.pywikibot - - python pwb.py generate_family_file 'https://wiki.musicbrainz.org/' musicbrainz + - python pwb.py generate_family_file 'https://wiki.musicbrainz.org/' musicbrainz 'n' - if [[ $FAMILY == 'wpbeta' ]]; then python -m generate_family_file 'http://'$LANGUAGE'.wikipedia.beta.wmflabs.org/' 'wpbeta' 'n' ; fi -- To view, visit https://gerrit.wikimedia.org/r/278309 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4761396f4c4ede1cb2dd90cfb9cfac56220b8b9a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Check a valid WebCite memento link - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/277213 Change subject: Check a valid WebCite memento link .. Check a valid WebCite memento link The WebCite timegate URL returns a 400 error if a URI is not provided. Use a valid timemap URL instead, as it has a small response payload. Bug: T128998 Change-Id: I9cb473279bb95d056751a3ce41fe809fb62ed283 --- M tests/weblinkchecker_tests.py 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/13/277213/1 diff --git a/tests/weblinkchecker_tests.py b/tests/weblinkchecker_tests.py index 2080d98..5e052e2 100644 --- a/tests/weblinkchecker_tests.py +++ b/tests/weblinkchecker_tests.py @@ -52,7 +52,8 @@ """Test WebCite Memento using old weblib tests.""" timegate_uri = 'http://timetravel.mementoweb.org/webcite/timegate/' -hostname = timegate_uri +hostname = ('http://timetravel.mementoweb.org/webcite/' +'timemap/json/http://google.com') class TestMementoWebCite(MementoTestCase): @@ -60,7 +61,8 @@ """New WebCite Memento tests.""" timegate_uri = 'http://timetravel.mementoweb.org/webcite/timegate/' -hostname = timegate_uri +hostname = ('http://timetravel.mementoweb.org/webcite/' +'timemap/json/http://google.com') def test_newest(self): """Test WebCite for newest https://google.com."""; -- To view, visit https://gerrit.wikimedia.org/r/277213 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9cb473279bb95d056751a3ce41fe809fb62ed283 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Revert "[IMPR] Simplify arg parsing in handle_args method" - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/275776 Change subject: Revert "[IMPR] Simplify arg parsing in handle_args method" .. Revert "[IMPR] Simplify arg parsing in handle_args method" This reverts commit 665d824e4c1a1ba0edab85077ea52d20329a6dca. Change-Id: Ida03771a1e446673b5d33d34f58878284235de18 --- M pywikibot/bot.py 1 file changed, 33 insertions(+), 27 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/76/275776/1 diff --git a/pywikibot/bot.py b/pywikibot/bot.py index a1a837a..18436db 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -841,32 +841,35 @@ username = None do_help = None if do_help else False for arg in args: -option, sep, value = arg.partition(':') -if do_help is not False and option == '-help': +if do_help is not False and arg == '-help': do_help = True -elif option == '-dir': +elif arg.startswith('-dir:'): pass -elif option == '-family': -config.family = value -elif option == '-lang': -config.mylang = value -elif option == '-user:': -username = value -elif option in ('-putthrottle', '-pt'): -config.put_throttle = int(value) -elif option == '-log': +elif arg.startswith('-family:'): +config.family = arg[len("-family:"):] +elif arg.startswith('-lang:'): +config.mylang = arg[len("-lang:"):] +elif arg.startswith("-user:"): +username = arg[len("-user:"):] +elif arg.startswith('-putthrottle:'): +config.put_throttle = int(arg[len("-putthrottle:"):]) +elif arg.startswith('-pt:'): +config.put_throttle = int(arg[len("-pt:"):]) +elif arg == '-log': if moduleName not in config.log: config.log.append(moduleName) -if value: -config.logfilename = value -elif option == '-nolog': +elif arg.startswith('-log:'): +if moduleName not in config.log: +config.log.append(moduleName) +config.logfilename = arg[len("-log:"):] +elif arg == '-nolog': if moduleName in config.log: config.log.remove(moduleName) -elif option in ('-cosmeticchanges', '-cc'): +elif arg in ('-cosmeticchanges', '-cc'): config.cosmetic_changes = not config.cosmetic_changes output(u'NOTE: option cosmetic_changes is %s\n' % config.cosmetic_changes) -elif option == '-simulate': +elif arg == '-simulate': config.simulate = True # # DEBUG control: @@ -893,28 +896,31 @@ #If used, "-debug" turns on file logging, regardless of any #other settings. # -elif option == '-debug': +elif arg == '-debug': if moduleName not in config.log: config.log.append(moduleName) -if value: -if value not in config.debug_log: -config.debug_log.append(value) -elif '' not in config.debug_log: +if "" not in config.debug_log: config.debug_log.append("") -elif option in ('-verbose', '-v'): +elif arg.startswith("-debug:"): +if moduleName not in config.log: +config.log.append(moduleName) +component = arg[len("-debug:"):] +if component not in config.debug_log: +config.debug_log.append(component) +elif arg in ('-verbose', '-v'): config.verbose_output += 1 -elif option == '-daemonize': -redirect_std = value if value else None +elif arg.startswith('-daemonize'): +redirect_std = arg[len('-daemonize:'):] if ':' in arg else None daemonize.daemonize(redirect_std=redirect_std) else: # the argument depends on numerical config settings # e.g. -maxlag: try: -_arg = option[1:] +_arg, _val = arg[1:].split(':') # explicitly check for int (so bool doesn't match) if not isinstance(getattr(config, _arg), int): raise TypeError -setattr(config, _arg, int(value)) +setattr(config, _arg, int(_val)) except (ValueError, TypeError, AttributeError): # argument not global -> specific bot script will take care nonGlobalArgs.append(arg) -- To view, visit https://gerrit.wikimedia.org/r/275776 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ida03771a1e446673b5d33d34f58878284235de18 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/cor
[MediaWiki-commits] [Gerrit] Re-add featured script to the auto run list - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/275717 Change subject: Re-add featured script to the auto run list .. Re-add featured script to the auto run list It was removed in 38ac044 when featured was moved into scripts/archive. Also tidy other parts of that commit, including adding a deprecation warning to the featured.py script. Bug: T128955 Change-Id: I1e373b9229b479227e3df30b51cb20915d1f0c47 --- M scripts/archive/README M scripts/archive/featured.py M tests/script_tests.py M tox.ini 4 files changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/17/275717/1 diff --git a/scripts/archive/README b/scripts/archive/README index 92d5958..1e70cad 100644 --- a/scripts/archive/README +++ b/scripts/archive/README @@ -1 +1,6 @@ -This folder consists scripts that will not maintened but we keep them for historical reasons. +This folder consists scripts that will not be improved, but are kept for +backwards compatibility with a deprecation notice. + +featured.py is no longer compatible with Wikimedia sites, and no other wiki +online could be found that is compatible with this script. +See https://phabricator.wikimedia.org/T128955 for more information. diff --git a/scripts/archive/featured.py b/scripts/archive/featured.py index a29b05f..92d21de 100755 --- a/scripts/archive/featured.py +++ b/scripts/archive/featured.py @@ -75,6 +75,7 @@ from pywikibot import i18n, textlib, config from pywikibot.pagegenerators import PreloadingGenerator +from pywikibot.tools import issue_deprecation_warning from pywikibot.tools.formatter import color_format if sys.version_info[0] > 2: @@ -619,6 +620,9 @@ @param args: command line arguments @type args: list of unicode """ +issue_deprecation_warning( +'featured.py script', 'Wikibase Client extension', +0, UserWarning) options = {} for arg in pywikibot.handle_args(args): if arg.startswith('-fromlang:'): diff --git a/tests/script_tests.py b/tests/script_tests.py index c0bb625..4fdd9ec 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -122,6 +122,7 @@ 'checkimages', 'clean_sandbox', 'disambredir', +'featured', 'imagerecat', 'login', 'lonelypages', diff --git a/tox.ini b/tox.ini index b01f51a..b3f567d 100644 --- a/tox.ini +++ b/tox.ini @@ -128,7 +128,7 @@ tests/pwb/ : +T001, T003 scripts/casechecker.py,scripts/imagetransfer.py : +T001, T003 scripts/maintenance/make_i18n_dict.py : +T001, T003 -scripts/archive/ : +D102, D103 +scripts/archive/featured.py : +D102, D103 scripts/script_wui.py : +D102 scripts/makecat.py : +D103 scripts/interwiki.py,/""/ : +P102 -- To view, visit https://gerrit.wikimedia.org/r/275717 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1e373b9229b479227e3df30b51cb20915d1f0c47 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Expand wikistats datatype tests - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/275511 Change subject: Expand wikistats datatype tests .. Expand wikistats datatype tests Bug: T128990 Change-Id: I6529c73c327da7272486cb479c6de8a2052b20a5 --- M tests/wikistats_tests.py 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/11/275511/1 diff --git a/tests/wikistats_tests.py b/tests/wikistats_tests.py index 4d59623..e255968 100644 --- a/tests/wikistats_tests.py +++ b/tests/wikistats_tests.py @@ -30,6 +30,9 @@ self.assertIn('prefix', top) self.assertIn('total', top) self.assertEqual(top['prefix'], 'en') +self.assertTrue(all(isinstance(key, UnicodeType) +for key in top.keys() +if key is not None)) self.assertIsInstance(top['total'], UnicodeType) self.assertEqual(ws.languages_by_size('wikipedia')[0], 'en') self.assertEqual(ws.languages_by_size('wikisource')[0], 'fr') @@ -44,7 +47,13 @@ self.assertIn('en', data) self.assertIn('ht', data) self.assertGreater(int(data['en']['total']), 400) -data = ws.get_dict +data = data['en'] +self.assertTrue(all(isinstance(key, UnicodeType) +for key in data.keys() +if key is not None)) +self.assertIsInstance(data['total'], UnicodeType) +self.assertIn('prefix', data) +self.assertIn('total', data) def test_xml(self): """Test XML.""" @@ -54,6 +63,13 @@ self.assertIn('en', data) self.assertIn('id', data) self.assertGreater(int(data['fr']['total']), 160) +data = data['fr'] +self.assertTrue(all(isinstance(key, UnicodeType) +for key in data.keys() +if key is not None)) +self.assertIsInstance(data['total'], UnicodeType) +self.assertIn('prefix', data) +self.assertIn('total', data) if __name__ == '__main__': -- To view, visit https://gerrit.wikimedia.org/r/275511 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6529c73c327da7272486cb479c6de8a2052b20a5 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix -cat pagegenerator - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/275272 Change subject: Fix -cat pagegenerator .. Fix -cat pagegenerator -cat without an argument was broken in 343b875 This broken unit test test_pagegen_i18n_input Also properly deprecated the old 'arg' argument for public GeneratorFactory.getCategory and .getCategoryGen which was also a breaking change in 343b875. Change-Id: Ifca4c65737e1f67f14576f540bdafcd0b82daf4c --- M pywikibot/pagegenerators.py 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/72/275272/1 diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 2f80a3b..7c9854e 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -475,6 +475,7 @@ return dupfiltergen +@deprecated_args(arg='category') def getCategory(self, category): """ Return Category and start as defined by category. @@ -483,7 +484,7 @@ @type category: str @rtype: tuple """ -if category.startswith('-'): # old arg parameter +if category and category.startswith('-'): categoryname = category.partition(':')[2] issue_deprecation_warning( 'The usage of "{0}" as actual parameter of ' @@ -491,6 +492,7 @@ categoryname, 2, ArgumentDeprecationWarning) else: categoryname = category + if not categoryname: categoryname = i18n.input( 'pywikibot-enter-category-name', @@ -512,6 +514,7 @@ defaultNamespace=14)) return cat, startfrom +@deprecated_args(arg='category') def getCategoryGen(self, category, recurse=False, content=False, gen_func=None): """ -- To view, visit https://gerrit.wikimedia.org/r/275272 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifca4c65737e1f67f14576f540bdafcd0b82daf4c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] listpages.py: Fix help docstring - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/275267 Change subject: listpages.py: Fix help docstring .. listpages.py: Fix help docstring Replace -dir with -save in docstring. Change-Id: Ic17d6255a532c3959ac0924314fe2f01f4d53ea6 (cherry picked from commit 08af9606decaf405a034f4f5a9275c7eb56a4b32) --- M scripts/listpages.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/67/275267/1 diff --git a/scripts/listpages.py b/scripts/listpages.py index c89be5a..30d71ca 100755 --- a/scripts/listpages.py +++ b/scripts/listpages.py @@ -43,7 +43,7 @@ -get Page content is printed. -saveSave Page content to a file named as page.title(as_filename=True). - Directory can be set with -dir:dir_name + Directory can be set with -save:dir_name If no dir is specified, current direcory will be used. -encode File encoding can be specified with '-encode:name' (name must be a -- To view, visit https://gerrit.wikimedia.org/r/275267 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic17d6255a532c3959ac0924314fe2f01f4d53ea6 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Mpaa ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update config.default_edit_summary - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/275129 Change subject: Update config.default_edit_summary .. Update config.default_edit_summary Pywikibot master is now 3.0, but config.default_edit_summary is reporting 'Pywikibot v.2'. Set the config variable to 'Pywikibot ' + __release__ Change-Id: I189220154db22abe608e2d683eb0d395066f928c --- M pywikibot/config2.py 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/29/275129/1 diff --git a/pywikibot/config2.py b/pywikibot/config2.py index 7fc9d7a..23bdcd8 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -52,6 +52,7 @@ from warnings import warn +from pywikibot import __release__ from pywikibot.logging import error, output, warning from pywikibot.tools import PY2 @@ -218,7 +219,7 @@ # edit summary to use if not supplied by bot script # WARNING: this should NEVER be used in practice, ALWAYS supply a more # relevant summary for bot edits -default_edit_summary = u'Pywikibot v.2' +default_edit_summary = 'Pywikibot ' + __release__ # What permissions to use to set private files to it # such as password file. -- To view, visit https://gerrit.wikimedia.org/r/275129 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I189220154db22abe608e2d683eb0d395066f928c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add flake8-tuple - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/274075 Change subject: Add flake8-tuple .. Add flake8-tuple Detects `x = a,` requiring that construct is `x = (a, )` Change-Id: I7c5133fef51c768369488319349290cac994d596 --- M tox.ini 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/75/274075/1 diff --git a/tox.ini b/tox.ini index b01f51a..110ae33 100644 --- a/tox.ini +++ b/tox.ini @@ -36,6 +36,7 @@ flake8-future-import flake8-string-format flake8-import-order + flake8-tuple>=0.2.4 flake8-print>=2.0.1 [testenv:flake8-py3] -- To view, visit https://gerrit.wikimedia.org/r/274075 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c5133fef51c768369488319349290cac994d596 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use flake8-docstrings>=0.2.5 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/271425 Change subject: Use flake8-docstrings>=0.2.5 .. Use flake8-docstrings>=0.2.5 (Fails at the moment) Bug: T119790 Change-Id: I8d42e5e710f544e365063047e8e17e4d56a8b7a7 --- M tox.ini 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/25/271425/1 diff --git a/tox.ini b/tox.ini index 5437e66..fb6cc07 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ deps = flake8 git+https://github.com/pyflakes/pyflakes.git hacking - flake8-docstrings<0.2.2 + flake8-docstrings>=0.2.5 flake8-putty>=0.2.0 flake8-coding flake8-future-import @@ -45,7 +45,7 @@ basepython = python3 deps = flake8 git+https://github.com/pyflakes/pyflakes.git - flake8-docstrings<0.2.2 + flake8-docstrings>=0.2.5 flake8-putty>=0.2.0 [testenv:nose] -- To view, visit https://gerrit.wikimedia.org/r/271425 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8d42e5e710f544e365063047e8e17e4d56a8b7a7 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove multiple spaces before operator - change (operations...kafkatee)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/267660 Change subject: Remove multiple spaces before operator .. Remove multiple spaces before operator Allows pep8 rule E221 to be enabled. Change-Id: I037ebefdeb05a890cf4b4c1af8a051be77a95594 --- M files/kafkatee_ganglia.py M tox.ini 2 files changed, 9 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet/kafkatee refs/changes/60/267660/1 diff --git a/files/kafkatee_ganglia.py b/files/kafkatee_ganglia.py index 16cc994..f2fd2e8 100755 --- a/files/kafkatee_ganglia.py +++ b/files/kafkatee_ganglia.py @@ -153,15 +153,15 @@ per_second_key_suffix = 'per_second' def __init__(self, stats_file='/var/cache/kafkatee/kafkatee.stats.json', key_separator='.'): -self.stats_file = stats_file -self.key_separator= key_separator +self.stats_file = stats_file +self.key_separator = key_separator # NOTE: It might be more elegant to # store the JSON object as it comes back from stats_file, # rather than keeping the state in the flattened hash. # latest flattnened stats as read from stats_file -self.flattened_stats = {} +self.flattened_stats = {} # previous flattened stats as read from stats_file self.flattened_stats_previous = {} @@ -260,7 +260,7 @@ JSON stats, not the time since update_stats() was last called. ''' # The timestamp will be keyed as 'kafka.rdkafka.time' -timestamp_key = self.key_separator.join(key.split(self.key_separator)[0:2] + ['time']) +timestamp_key = self.key_separator.join(key.split(self.key_separator)[0:2] + ['time']) # if we don't yet have a previous value from which to calculate a # rate, just return 0 for now @@ -333,10 +333,10 @@ global time_max global last_run_timestamp -stats_file = params.get('stats_file', '/var/cache/kafkatee/kafkatee.stats.json') -key_separator = params.get('key_separator', '.') +stats_file = params.get('stats_file', '/var/cache/kafkatee/kafkatee.stats.json') +key_separator = params.get('key_separator', '.') ganglia_groups = params.get('groups', 'kafka') -time_max = int(params.get('tmax', time_max)) +time_max = int(params.get('tmax', time_max)) kafkatee_stats = KafkateeStats(stats_file, key_separator) # Run update_stats() so that we'll have a list of stats keys that will @@ -565,7 +565,7 @@ cmdline.print_help() cmdline.error("Must supply statsfile argument.") -cli_options.stats_file = arguments[0] +cli_options.stats_file = arguments[0] # Turn the optparse.Value object into a regular dict # so we can pass it to metric_init diff --git a/tox.ini b/tox.ini index 776ee15..897a40b 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,5 @@ [flake8] max-line-length = 150 -; E221 multiple spaces before operator ; E241 multiple spaces after ':' -ignore = E221,E241 +ignore = E241 -- To view, visit https://gerrit.wikimedia.org/r/267660 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I037ebefdeb05a890cf4b4c1af8a051be77a95594 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet/kafkatee Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] color logging fixes - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/265462 Change subject: color logging fixes .. color logging fixes afe2555d7 implemented color_format, which uses str.format {} syntax, but two messages in reflinks were not converted from %s syntax to {}. Bug: T123887 Change-Id: I8e6916153428689dc4c6410bebfc9c771d8813d8 --- M scripts/reflinks.py 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/62/265462/1 diff --git a/scripts/reflinks.py b/scripts/reflinks.py index 0474deb..814e1ce 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -38,7 +38,7 @@ one from i18n/reflinks.py """ # (C) Nicolas Dumazet (NicDumZ), 2008 -# (C) Pywikibot team, 2008-2015 +# (C) Pywikibot team, 2008-2016 # # Distributed under the terms of the MIT license. # @@ -587,7 +587,7 @@ # example : http://www.adminet.com/jo/20010615¦/ECOC0100037D.html # in [[fr:Cyanure]] pywikibot.output(color_format( -'{lightred}Bad link{default} : %s in %s', +'{lightred}Bad link{default} : {0} in {1}', ref.url, page.title(asLink=True))) continue except (URLError, @@ -638,7 +638,7 @@ continue elif not self.MIME.search(contentType): pywikibot.output(color_format( -'{lightyellow}WARNING{default} : media : %s ', +'{lightyellow}WARNING{default} : media : {0} ', ref.link)) repl = ref.refLink() new_text = new_text.replace(match.group(), repl) -- To view, visit https://gerrit.wikimedia.org/r/265462 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8e6916153428689dc4c6410bebfc9c771d8813d8 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove old unneeded URL exclusion rules - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/265442 Change subject: Remove old unneeded URL exclusion rules .. Remove old unneeded URL exclusion rules No problems are experienced now accessing these URLs. Bug: T124015 Change-Id: I1f33969058fc67f8437f2f92325faba636a9c81c --- M scripts/weblinkchecker.py 1 file changed, 3 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/42/265442/1 diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py index d1f0834..7aa40b0 100755 --- a/scripts/weblinkchecker.py +++ b/scripts/weblinkchecker.py @@ -162,19 +162,13 @@ # Other special cases # bot somehow can't handle their redirects: +# TODO: T124140 re.compile(r'.*[\./@]gso\.gbv\.de(/.*)?'), + re.compile(r'.*[\./@]berlinonline\.de(/.*)?'), # above entry to be manually fixed per request at [[de:Benutzer:BLueFiSH.as/BZ]] # bot can't handle their redirects: -re.compile(r'.*[\./@]bodo\.kommune\.no(/.*)?'), -re.compile(r'.*[\./@]jpl\.nasa\.gov(/.*)?'), # bot rejected on the site -re.compile(r'.*[\./@]itis\.gov(/.*)?'), # bot rejected on the site -re.compile(r'.*[\./@]cev\.lu(/.*)?'), # bot rejected on the site -# very slow response resulting in bot error: -re.compile(r'.*[\./@]science\.ksc\.nasa\.gov(/.*)?'), -re.compile(r'.*[\./@]britannica\.com(/.*)?'), # HTTP redirect loop -# bot rejected on the site: -re.compile(r'.*[\./@]quickfacts\.census\.gov(/.*)?'), + # bot rejected on the site, already archived re.compile(r'.*[\./@]web\.archive\.org(/.*)?'), ] -- To view, visit https://gerrit.wikimedia.org/r/265442 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1f33969058fc67f8437f2f92325faba636a9c81c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Include family name in assertion - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/265225 Change subject: Include family name in assertion .. Include family name in assertion If a family module contains an invalid character an assertion is raised, however it doesnt indicate which family module is incorrectly named. Change-Id: I337ff16663a3d875a7dd56679a869ae82499db1c --- M pywikibot/family.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/25/265225/1 diff --git a/pywikibot/family.py b/pywikibot/family.py index ce3f6c4..7a5f23b 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -896,7 +896,7 @@ fam = config.family assert all(x in NAME_CHARACTERS for x in fam), \ -'Name of family must be ASCII character' +'Name of family %s must be ASCII characters' % fam if fam in Family._families: return Family._families[fam] -- To view, visit https://gerrit.wikimedia.org/r/265225 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I337ff16663a3d875a7dd56679a869ae82499db1c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove unneeded catching of httplib ValueError - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/264931 Change subject: Remove unneeded catching of httplib ValueError .. Remove unneeded catching of httplib ValueError Bug: T124010 Change-Id: I5f1b5bca386610c4f974358792d45ad01756c20d --- M scripts/reflinks.py 1 file changed, 1 insertion(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/31/264931/1 diff --git a/scripts/reflinks.py b/scripts/reflinks.py index 0474deb..03ac5ca 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -597,10 +597,7 @@ pywikibot.output(u'Can\'t retrieve page %s : %s' % (ref.url, e)) continue -except ValueError: -# Known bug of httplib, google for : -# "httplib raises ValueError reading chunked content" -continue + # remove
[MediaWiki-commits] [Gerrit] Allow Coordinate.precision to be None - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/264740 Change subject: Allow Coordinate.precision to be None .. Allow Coordinate.precision to be None Wikibase has coordinates without a precision. They cause an exception when saving unmodified. Also add a setter for Coordinate.precision, so existing data without a precision can be improved. Bug: T123910 Change-Id: I9ce758c7271c78ba9b97bf2f52b4b34160d935e1 --- M pywikibot/__init__.py 1 file changed, 12 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/40/264740/1 diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index c2f4dd5..d3353d4 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -331,6 +331,11 @@ u""" Return the precision of the geo coordinate. +The precision is calculated if the Coordinate does not have a precision, +and self._dim is set. + +When no precision and no self._dim exists, None is returned. + The biggest error (in degrees) will be given by the longitudinal error; the same error in meters becomes larger (in degrees) further up north. We can thus ignore the latitudinal error. @@ -346,13 +351,19 @@ Therefore:: precision = math.degrees(self._dim/(radius*math.cos(math.radians(self.lat + +@rtype: float or None """ -if not self._precision: +if self._precision is None and self._dim is not None: radius = 6378137 # TODO: Support other globes self._precision = math.degrees( self._dim / (radius * math.cos(math.radians(self.lat return self._precision +@precision.setter +def precision(self, value): +self._precision = value + def precisionToDim(self): """Convert precision from Wikibase to GeoData's dim.""" raise NotImplementedError -- To view, visit https://gerrit.wikimedia.org/r/264740 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9ce758c7271c78ba9b97bf2f52b4b34160d935e1 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Sync ps_mem.py from origin - change (operations/puppet)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/264028 Change subject: Sync ps_mem.py from origin .. Sync ps_mem.py from origin Sync ps_mem.py from https://github.com/pixelb/ps_mem/ which has been improved to pass pyflakes. Change-Id: If24ac49e96adb1e471764b615c3e87a647627c3f --- M modules/admin/files/home/ori/.binned/ps_mem.py 1 file changed, 103 insertions(+), 127 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/28/264028/1 diff --git a/modules/admin/files/home/ori/.binned/ps_mem.py b/modules/admin/files/home/ori/.binned/ps_mem.py index 274c955..f3fd2e5 100755 --- a/modules/admin/files/home/ori/.binned/ps_mem.py +++ b/modules/admin/files/home/ori/.binned/ps_mem.py @@ -3,9 +3,9 @@ # Try to determine how much RAM is currently being used per program. # Note per _program_, not per process. So for example this script # will report RAM used by all httpd process together. In detail it reports: -# sum(private RAM for program processes) + sum(Shared RAM for program -# processes) The shared RAM is problematic to calculate, and this script -# automatically selects the most accurate method available for your kernel. +# sum(private RAM for program processes) + sum(Shared RAM for program processes) +# The shared RAM is problematic to calculate, and this script automatically +# selects the most accurate method available for your kernel. # Licence: LGPLv2 # Author: p...@draigbrady.com @@ -31,13 +31,12 @@ # which fixes the possible race between reading # RSS with ps, and shared memory with this program. # Also we can show non truncated command names. -# V1.8 28 Sep 2007 More accurate matching for stats in -# /proc/$pid/smaps as otherwise could match libraries -# causing a crash. +# V1.8 28 Sep 2007 More accurate matching for stats in /proc/$pid/smaps +# as otherwise could match libraries causing a crash. # Patch from patrice.bouchand.fed...@gmail.com # V1.9 20 Feb 2008 Fix invalid values reported when PSS is available. # Reported by Andrey Borzenkov -# V3.3 24 Jun 2014 +# V3.6 16 Oct 2015 # http://github.com/pixelb/scripts/commits/master/scripts/ps_mem.py # Notes: @@ -45,7 +44,7 @@ # All interpreted programs where the interpreter is started # by the shell or with env, will be merged to the interpreter # (as that's what's given to exec). For e.g. all python programs -# starting with "# !/usr/bin/env python" will be grouped under python. +# starting with "#!/usr/bin/env python" will be grouped under python. # You can change this by using the full command line but that will # have the undesirable affect of splitting up programs started with # differing parameters (for e.g. mingetty tty[1-6]). @@ -80,16 +79,6 @@ import os import sys -try: -# md5 module is deprecated on python 2.6 -# so try the newer hashlib first -import hashlib -md5_new = hashlib.md5 -except ImportError: -import md5 -md5_new = md5.new - - # The following exits cleanly on Ctrl-C or EPIPE # while treating other exceptions as before. def std_exceptions(etype, value, tb): @@ -106,24 +95,12 @@ # Define some global variables # -PAGESIZE = os.sysconf("SC_PAGE_SIZE") / 1024 # KiB +PAGESIZE = os.sysconf("SC_PAGE_SIZE") / 1024 #KiB our_pid = os.getpid() have_pss = 0 -help_msg = """Usage: ps_mem [OPTION]... -Show program core memory usage - - -h, -help Show this help - -p [,pid2,...pidN] Only show memory usage PIDs in the specified list - -s, --split-argsShow and separate by, all command line arguments - -t, --total Show only the total value - -w Measure and show process memory every N seconds - -""" - class Proc: - def __init__(self): uname = os.uname() if uname[0] == "FreeBSD": @@ -136,11 +113,14 @@ def open(self, *args): try: -return open(self.path(*args)) +if sys.version_info < (3,): +return open(self.path(*args)) +else: +return open(self.path(*args), errors='ignore') except (IOError, OSError): val = sys.exc_info()[1] -if (val.errno == errno.ENOENT or # kernel thread or process gone -val.errno == errno.EPERM): +if (val.errno == errno.ENOENT or # kernel thread or process gone +val.errno == errno.EPERM): raise LookupError raise @@ -192,14 +172,19 @@ return (split_args, pids_to_show, watch, only_total) - def help(): -global help_msg +help_msg = 'Usage: ps_mem [OPTION]...\n' \ +'Show pro
[MediaWiki-commits] [Gerrit] Add flake8 rule for selected modules - change (operations/puppet)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263866 Change subject: Add flake8 rule for selected modules .. Add flake8 rule for selected modules Significant number of Python files fail pyflakes rules. Fix the simplest of them, and exclude the remainder to be analysed more carefully for side-effects. Change-Id: I9c921213e36d1d8a3aafce1cf2039172b3c882c9 --- M files/misc/PacketLossLogtailer.py M files/misc/demux.py M files/misc/rolematcher.py M modules/base/files/labs/puppetalert.py M modules/dataset/files/labs/wmfdumpsmirror.py M modules/diamond/files/collector/localcrontab.py M modules/elasticsearch/files/monitor/wmfelastic.py M modules/hhvm/files/monitoring/hhvm_apc.py M modules/icinga/files/check_legal_html.py M modules/icinga/files/purge-nagios-resources.py M modules/mw_rc_irc/files/monitor/ircd_stats.py M modules/openstack/files/spreadcheck.py M modules/pybal/files/pybal_state.py M modules/swift/files/SwiftMedia/wmf/rewrite_integration_test.py M modules/toollabs/files/gridscripts/runninggridjobsmail.py M modules/toollabs/files/gridscripts/runninggridtasks.py M modules/toollabs/files/kube2dynproxy.py M modules/toollabs/manifests/genpp/genpp.py M modules/toollabs/manifests/genpp/python.py M modules/varnish/files/zerofetch.py M modules/wdqs/files/monitor/wdqs_updater.py M tox.ini 22 files changed, 38 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/66/263866/1 diff --git a/files/misc/PacketLossLogtailer.py b/files/misc/PacketLossLogtailer.py index 4c342a0..0cff4a2 100644 --- a/files/misc/PacketLossLogtailer.py +++ b/files/misc/PacketLossLogtailer.py @@ -171,7 +171,9 @@ self.lock.acquire() try: mydata = self.deep_copy() -check_time = self.get_check_duration() +# get_check_duration called only to raise LogtailerStateException +# if appropriate +self.get_check_duration() self.reset_state() self.lock.release() except LogtailerStateException, e: diff --git a/files/misc/demux.py b/files/misc/demux.py index 26b452c..a58130f 100755 --- a/files/misc/demux.py +++ b/files/misc/demux.py @@ -6,7 +6,6 @@ # Simple python script for demultiplexing MediaWiki log files import argparse -import os import re import string import sys diff --git a/files/misc/rolematcher.py b/files/misc/rolematcher.py index 583c134..6493a19 100644 --- a/files/misc/rolematcher.py +++ b/files/misc/rolematcher.py @@ -1,5 +1,5 @@ -# -*- coding: utf-8 -*- #!/usr/bin/env python +# -*- coding: utf-8 -*- ''' This script parses the packet-loss.log file and for each server entry @@ -15,6 +15,7 @@ PacketLossLogTailer.py is the regular point of entry. ''' +import httplib import re import urllib2 import json diff --git a/modules/base/files/labs/puppetalert.py b/modules/base/files/labs/puppetalert.py index facd0e2..4fade7f 100755 --- a/modules/base/files/labs/puppetalert.py +++ b/modules/base/files/labs/puppetalert.py @@ -17,7 +17,6 @@ Send an alert email to project admins about a puppet failure. This is meant to be run on the affected instance. """ -import argparse import calendar import time import ldap diff --git a/modules/dataset/files/labs/wmfdumpsmirror.py b/modules/dataset/files/labs/wmfdumpsmirror.py index e735c89..fae9ef9 100644 --- a/modules/dataset/files/labs/wmfdumpsmirror.py +++ b/modules/dataset/files/labs/wmfdumpsmirror.py @@ -2,9 +2,9 @@ import os import re import sys -import subprocess import shutil import multiprocessing + from subprocess import Popen, PIPE from Queue import Empty diff --git a/modules/diamond/files/collector/localcrontab.py b/modules/diamond/files/collector/localcrontab.py index 17ef717..0b6aabb 100644 --- a/modules/diamond/files/collector/localcrontab.py +++ b/modules/diamond/files/collector/localcrontab.py @@ -8,8 +8,9 @@ """ import subprocess -import os + import diamond.collector + from diamond.collector import str_to_bool diff --git a/modules/elasticsearch/files/monitor/wmfelastic.py b/modules/elasticsearch/files/monitor/wmfelastic.py index 462094a..f96b073 100644 --- a/modules/elasticsearch/files/monitor/wmfelastic.py +++ b/modules/elasticsearch/files/monitor/wmfelastic.py @@ -213,7 +213,7 @@ for metric in self.health_metrics: try: gmetrics[metric] = chealth[metric] -except KeyError, e: +except KeyError: self.errors += 1 pass return gmetrics @@ -226,7 +226,7 @@ try: value = self.dict_digger(depth, cstats) gmetrics[m] = value -except KeyError, e: +except KeyError: self.errors += 1 pass return gmetrics @@ -241,7 +241,7 @@ try: value = self.dict
[MediaWiki-commits] [Gerrit] Incorrect syntax in RCStreamCollector.collect - change (operations/puppet)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263848 Change subject: Incorrect syntax in RCStreamCollector.collect .. Incorrect syntax in RCStreamCollector.collect `except IOError, ValueError:` assigns the exception to ValueError. Added in 21be64bf. Change-Id: I361261b2ba58d44fd0774859432f720790aca980 --- M modules/rcstream/files/diamond_collector.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/48/263848/1 diff --git a/modules/rcstream/files/diamond_collector.py b/modules/rcstream/files/diamond_collector.py index 5ea44bb..3be0d87 100644 --- a/modules/rcstream/files/diamond_collector.py +++ b/modules/rcstream/files/diamond_collector.py @@ -40,7 +40,7 @@ for backend in backends: try: stat = self.get_backend_stats(backend) -except IOError, ValueError: +except (IOError, ValueError): self.log.exception('Failed to check backend %s', backend) else: stats.append(stat) -- To view, visit https://gerrit.wikimedia.org/r/263848 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I361261b2ba58d44fd0774859432f720790aca980 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Pin pep8==1.5.7 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263662 Change subject: Pin pep8==1.5.7 .. Pin pep8==1.5.7 pep8 1.7.0 includes a regression in the handling of E731 which causes '# noqa' to be ignored. Change-Id: If8a22d57f4b2b22695314810825b80c7b581a07b --- M dev-requirements.txt M tox.ini 2 files changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/62/263662/1 diff --git a/dev-requirements.txt b/dev-requirements.txt index 81f4b4a..a597c7c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,6 +6,7 @@ nose +pep8==1.5.7 pep257>=0.6 pyflakes>=0.9 flake8 diff --git a/tox.ini b/tox.ini index bd09641..42f02d5 100644 --- a/tox.ini +++ b/tox.ini @@ -29,6 +29,7 @@ basepython = python2.7 deps = flake8 hacking + pep8==1.5.7 flake8-docstrings<0.2.2 flake8-putty>=0.2.0 flake8-coding @@ -43,6 +44,7 @@ flake8 --ignore={[flake8]ignore} {posargs} basepython = python3 deps = flake8 + pep8==1.5.7 flake8-docstrings<0.2.2 flake8-putty>=0.2.0 -- To view, visit https://gerrit.wikimedia.org/r/263662 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If8a22d57f4b2b22695314810825b80c7b581a07b Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] date.py: fix Hungarian day-month title - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263244 Change subject: date.py: fix Hungarian day-month title .. date.py: fix Hungarian day-month title Change day-month title format for Hungarian from [[December 31]] to [[December 31.]] etc. Change-Id: Ib7229f0730c4de9d97459e2b8c4cf1fe97910f93 --- M pywikibot/date.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/44/263244/1 diff --git a/pywikibot/date.py b/pywikibot/date.py index d7a7dbf..7f8627a 100644 --- a/pywikibot/date.py +++ b/pywikibot/date.py @@ -2066,7 +2066,7 @@ u"%d. travnja", u"%d. svibnja", u"%d. lipnja", u"%d. srpnja", u"%d. kolovoza", u"%d. rujna", u"%d. listopada", u"%d. studenog", u"%d. prosinca"]) -addFmt2('hu', False, u"%s %%d", True) +addFmt2('hu', False, u"%s %%d.", True) addFmt2('ia', False, u"%%d de %s", False) addFmt2('id', False, u"%%d %s", True) addFmt2('ie', False, u"%%d %s", False) -- To view, visit https://gerrit.wikimedia.org/r/263244 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib7229f0730c4de9d97459e2b8c4cf1fe97910f93 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Tacsipacsi ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace old sf.net bug id with new sf.net bug id - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263224 Change subject: Replace old sf.net bug id with new sf.net bug id .. Replace old sf.net bug id with new sf.net bug id Change-Id: Ia08a67ccfa88d128c6734199b0ef21dc6d242552 --- M pywikibot/interwiki_graph.py 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/24/263224/1 diff --git a/pywikibot/interwiki_graph.py b/pywikibot/interwiki_graph.py index c0037b9..86fe257 100644 --- a/pywikibot/interwiki_graph.py +++ b/pywikibot/interwiki_graph.py @@ -191,8 +191,9 @@ # bugfix for pydot >= 1.0.3 oppositeEdge = oppositeEdge[0] oppositeEdge.set_dir('both') -# workaround for bug [ 1722739 ]: prevent duplicate edges +# workaround for sf.net bug 401: prevent duplicate edges # (it is unclear why duplicate edges occur) +# https://sourceforge.net/p/pywikipediabot/bugs/401/ elif self.graph.get_edge(sourceLabel, targetLabel): pywikibot.output( u'BUG: Tried to create duplicate edge from %s to %s' -- To view, visit https://gerrit.wikimedia.org/r/263224 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia08a67ccfa88d128c6734199b0ef21dc6d242552 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove Wikipedia special cases from interwiki.py - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263223 Change subject: Remove Wikipedia special cases from interwiki.py .. Remove Wikipedia special cases from interwiki.py Wikipedia now uses Wikidata for interwiki links, so any special cases in interwiki.py for Wikipedia are unused code. Change-Id: I41d2b254ce265c4f44e0ad7e72790f5dc52b0014 --- M scripts/interwiki.py 1 file changed, 2 insertions(+), 63 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/23/263223/1 diff --git a/scripts/interwiki.py b/scripts/interwiki.py index 8887c5b..4944211 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -145,8 +145,7 @@ * scand: All Scandinavian languages. Names of families that forward their interlanguage links - to the wiki family being worked upon can be used (with - -family=wikipedia only), they are: + to the wiki family being worked upon can be used, they are: * commons: Interlanguage links of Mediawiki Commons. * incubator: Links in pages on the Mediawiki Incubator. * meta: Interlanguage links of named pages on Meta. @@ -1723,65 +1722,9 @@ break else: for (site, page) in new.items(): -# edit restriction for some templates on zh-wiki where -# interlanguage keys are included by /doc subpage -smallWikiAllowed = not (page.site.sitename == 'wikipedia:zh' and -page.namespace() == 10 and -u'Country data' in page.title(withNamespace=False)) -# edit restriction on is-wiki -# https://is.wikipedia.org/wiki/Wikipediaspjall:V%C3%A9lmenni -# and zh-wiki for template namespace which prevents increasing the queue -# allow edits for the same conditions as -whenneeded -# or the last edit wasn't a bot -# or the last edit was 1 month ago -if (smallWikiAllowed and -globalvar.autonomous and -(page.site.sitename == 'wikipedia:is' or - page.site.sitename == 'wikipedia:zh' and - page.namespace() == 10 - )): -old = {} -try: -for mypage in new[page.site].interwiki(): -old[mypage.site] = mypage -except pywikibot.NoPage: -pywikibot.output(u"BUG>>> %s no longer exists?" - % new[site]) -continue -mods, mcomment, adding, removing, modifying \ -= compareLanguages(old, new, insite=site) -# cannot create pywikibot.User with IP -smallWikiAllowed = ( -page.isIpEdit() or -len(removing) > 0 or -len(old) == 0 or -len(adding) + len(modifying) > 2 or -( -len(removing) + len(modifying) == 0 and -adding == [page.site] -) -) -if not smallWikiAllowed: -user = pywikibot.User(page.site, page.userName()) -# erstmal auch keine namen mit bot -if 'bot' not in user.groups() \ - and 'bot' not in page.userName().lower(): -smallWikiAllowed = True -else: -_now = datetime.datetime.utcnow() -_editTime = page.editTime() -if abs((_now - _editTime).days) > 30: -smallWikiAllowed = True -else: -pywikibot.output( -u'NOTE: number of edits are restricted at %s' -% page.site.sitename -) - # if we have an account for this site if site.family.name in config.usernames and \ site.code in config.usernames[site.family.name] and \ - smallWikiAllowed and \ not site.has_transcluded_data: # Try to do the changes try: @@ -1915,11 +1858,7 @@ # put it to new means don't delete it if ( not globalvar.cleanup or -unicode(rmPage) no
[MediaWiki-commits] [Gerrit] Enable flake8 checking of templatecount docstrings - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263220 Change subject: Enable flake8 checking of templatecount docstrings .. Enable flake8 checking of templatecount docstrings 2b356aab fixed the docstring errors Change-Id: Idc2ae9240f66a9b92e4298f5db6a811c4e975401 --- M tox.ini 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/20/263220/1 diff --git a/tox.ini b/tox.ini index ed974da..bd09641 100644 --- a/tox.ini +++ b/tox.ini @@ -116,7 +116,7 @@ scripts/casechecker.py,scripts/imagetransfer.py : +T001 scripts/maintenance/make_i18n_dict.py : +T001 scripts/archivebot.py,scripts/casechecker.py,scripts/commons_link.py,scripts/cfd.py,scripts/featured.py,scripts/imagecopy.py,scripts/imagecopy_self.py,scripts/interwiki.py,scripts/replicate_wiki.py,scripts/solve_disambiguation.py,scripts/maintenance/compat2core.py : +D102, D103 - scripts/checkimages.py,scripts/freebasemappingupload.py,scripts/imagetransfer.py,scripts/lonelypages.py,scripts/movepages.py,scripts/nowcommons.py,scripts/redirect.py,scripts/isbn.py,scripts/reflinks.py,scripts/script_wui.py,scripts/templatecount.py,scripts/revertbot.py,scripts/weblinkchecker.py,scripts/welcome.py : +D102 + scripts/checkimages.py,scripts/freebasemappingupload.py,scripts/imagetransfer.py,scripts/lonelypages.py,scripts/movepages.py,scripts/nowcommons.py,scripts/redirect.py,scripts/isbn.py,scripts/reflinks.py,scripts/script_wui.py,scripts/revertbot.py,scripts/weblinkchecker.py,scripts/welcome.py : +D102 scripts/catall.py,scripts/imageharvest.py,scripts/makecat.py,scripts/maintenance/cache.py,scripts/maintenance/wikimedia_sites.py : +D103 scripts/interwiki.py,/""/ : +P102 pywikibot/__init__.py,/link_regex/ : +P103 -- To view, visit https://gerrit.wikimedia.org/r/263220 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idc2ae9240f66a9b92e4298f5db6a811c4e975401 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Prevent from being destroyed - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263211 Change subject: Prevent from being destroyed .. Prevent from being destroyed Use raw string tag to prevent \1 from being treated as chr(1) Bug: T123104 Change-Id: I89dbf5bbf5f5bcde67247bb44177671e3dde2f0c --- M scripts/noreferences.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/11/263211/1 diff --git a/scripts/noreferences.py b/scripts/noreferences.py index bd32bb1..10d49f4 100755 --- a/scripts/noreferences.py +++ b/scripts/noreferences.py @@ -541,7 +541,7 @@ r'< */?\s*references */? *>', re.DOTALL) if pattern.search(oldText): pywikibot.output('Repairing references tag') -return re.sub(pattern, '\1', oldText) +return re.sub(pattern, r'\1', oldText) # Repair single unclosed references tag pattern = re.compile(r'< *references *>') if pattern.search(oldText): -- To view, visit https://gerrit.wikimedia.org/r/263211 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I89dbf5bbf5f5bcde67247bb44177671e3dde2f0c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: MtDu ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add cc test for replaceDeprecatedTemplates - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263195 Change subject: Add cc test for replaceDeprecatedTemplates .. Add cc test for replaceDeprecatedTemplates Change-Id: I0a5bed50f4d6f972635baff2525769c44ff55a49 --- M tests/cosmetic_changes_tests.py 1 file changed, 14 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/95/263195/1 diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index c937f20..82895ac 100644 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -42,12 +42,6 @@ self.assertEqual('[[en:Foo bar]]', self.cct.fixSelfInterwiki('[[en:Foo bar]]')) -def test_standardizePageFooter(self): -"""Test standardizePageFooter method.""" -self.assertEqual('Foo\n{{link fa}}\n\n[[Category:Foo]]', - self.cct.standardizePageFooter( - 'Foo [[category:foo]] {{link fa}}')) - def test_resolveHtmlEntities(self): """Test resolveHtmlEntities method.""" self.assertEqual( @@ -99,6 +93,20 @@ self.assertEqual(':* Foo bar', self.cct.putSpacesInLists(':*Foo bar')) +def test_replaceDeprecatedTemplates(self): +"""Test replaceDeprecatedTemplates method.""" +self.assertEqual( +'{{Quellen fehlen }}' +'{{Belege fehlen| }}' +'{{Belege fehlen|foo}}' +'{{Quellen_fehlen|foo}}', +self.cct.replaceDeprecatedTemplates( +'{{Quellen fehlen }}' +'{{Quellen fehlen| }}' +'{{Quellen fehlen|foo}}' +'{{Quellen_fehlen|foo}}' +)) + def test_fixSyntaxSave(self): """Test fixSyntaxSave method.""" # necessary as the fixer needs the article path to fix it -- To view, visit https://gerrit.wikimedia.org/r/263195 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0a5bed50f4d6f972635baff2525769c44ff55a49 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use pywikibot.logging.error - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263192 Change subject: Use pywikibot.logging.error .. Use pywikibot.logging.error Replaces pywikibot.error with the same method in new logging layer. pywikibot.tools should not import from the top level of pywikibot so that the tools subpackage is only dependent on the logging layer. Change-Id: I088bc3dd001dc8555c90268edb4c2b056d40e30d --- M pywikibot/tools/djvu.py 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/92/263192/1 diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py index 6fb23cc..e659a43 100644 --- a/pywikibot/tools/djvu.py +++ b/pywikibot/tools/djvu.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """Wrapper around djvulibre to access djvu files properties and content.""" # -# (C) Pywikibot team, 2015 +# (C) Pywikibot team, 2015-2016 # # Distributed under the terms of the MIT license. # @@ -13,7 +13,7 @@ import os.path import subprocess -import pywikibot +from pywikibot.logging import error class DjVuFile(object): @@ -47,7 +47,7 @@ stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = dp.communicate() if dp.returncode != 0: -pywikibot.error('djvulibre library error!\n%s' % stderrdata) +error('djvulibre library error!\n%s' % stderrdata) self._image_count = int(stdoutdata) return self._image_count @@ -58,7 +58,7 @@ stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = dp.communicate() if dp.returncode != 0: -pywikibot.error('djvulibre library error!\n%s' % stderrdata) +error('djvulibre library error!\n%s' % stderrdata) txt = stdoutdata.decode('utf-8') self._has_text = 'TXTz' in txt return self._has_text @@ -91,5 +91,5 @@ stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = dp.communicate() if dp.returncode != 0: -pywikibot.error('djvulibre library error!\n%s' % stderrdata) +error('djvulibre library error!\n%s' % stderrdata) return self._remove_control_chars(stdoutdata) -- To view, visit https://gerrit.wikimedia.org/r/263192 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I088bc3dd001dc8555c90268edb4c2b056d40e30d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] starsList tests - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/263161 Change subject: starsList tests .. starsList tests Bug: T123150 Change-Id: I7cd2546caa2523971de554f40877501764ad5219 --- M tests/__init__.py A tests/add_text_tests.py M tests/cosmetic_changes_tests.py 3 files changed, 57 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/61/263161/1 diff --git a/tests/__init__.py b/tests/__init__.py index 8d768ba..4fb3698 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -128,6 +128,7 @@ 'pwb', 'script', 'l10n', +'add_text', 'archivebot', 'category_bot', 'checkimages', diff --git a/tests/add_text_tests.py b/tests/add_text_tests.py new file mode 100644 index 000..9c90ef6 --- /dev/null +++ b/tests/add_text_tests.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +"""Test add_text bot module.""" +# +# (C) Pywikibot team, 2016 +# +# Distributed under the terms of the MIT license. +# +from __future__ import absolute_import, unicode_literals + +__version__ = '$Id$' + +import pywikibot + +from scripts.add_text import add_text + +from tests.aspects import unittest, TestCase + + +class TestStarList(TestCase): + +"""Test starlist.""" + +family = 'wikipedia' +code = 'en' + +dry = True + +def test_basic(self): +"""Test adding text before {{linkfa}} without parameters.""" +page = pywikibot.Page(self.site, 'foo') +(text, newtext, always) = add_text( +page, 'bar', putText=False, +oldTextGiven='foo\n{{linkfa}}') +self.assertEqual( +'foo\n{{linkfa}}\nbar', +newtext) + +def test_with_params(self): +"""Test adding text before {{linkfa|...}}.""" +page = pywikibot.Page(self.site, 'foo') +(text, newtext, always) = add_text( +page, 'bar', putText=False, +oldTextGiven='foo\n{{linkfa|...}}') +self.assertEqual( +'foo\nbar\n\n{{linkfa|...}}\n', +newtext) + + +if __name__ == "__main__": +unittest.main() diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index 17e270d..4f01f22 100644 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -42,6 +42,12 @@ self.assertEqual('[[en:Foo bar]]', self.cct.fixSelfInterwiki('[[en:Foo bar]]')) +def test_standardizePageFooter(self): +"""Test standardizePageFooter method.""" +self.assertEqual('Foo\n{{link fa}}\n\n[[Category:Foo]]', + self.cct.standardizePageFooter( +'Foo [[category:foo]] {{link fa}}')) + def test_resolveHtmlEntities(self): """Test resolveHtmlEntities method.""" self.assertEqual( -- To view, visit https://gerrit.wikimedia.org/r/263161 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7cd2546caa2523971de554f40877501764ad5219 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Colourise flake8 output - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/262696 Change subject: Colourise flake8 output .. Colourise flake8 output Bug: T117570 Change-Id: I6ae0c6dd539ab667650de575f382276fbf342bc7 --- M tox.ini 1 file changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/96/262696/1 diff --git a/tox.ini b/tox.ini index a1bc548..e05c56b 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ [params] nose_skip = --ignore-files=(gui\.py|botirc\.py|rcstream\.py|api\.py) +pep8_color_format = "$(tput setaf 1)ERROR:$(tput setaf 7) %(path)s %(row)d %(col)d : %(code)s %(text)s" [testenv] setenv = @@ -25,7 +26,7 @@ [testenv:flake8] commands = flake8 --version -flake8 --ignore={[flake8]ignore} {posargs} +flake8 --ignore={[flake8]ignore} --format={[params]pep8_color_format} {posargs} basepython = python2.7 deps = flake8 hacking @@ -39,7 +40,7 @@ [testenv:flake8-py3] commands = flake8 --version -flake8 --ignore={[flake8]ignore} {posargs} +flake8 --ignore={[flake8]ignore} --format={[params]pep8_color_format} {posargs} basepython = python3 deps = flake8 flake8-docstrings<0.2.2 @@ -96,7 +97,7 @@ # E731: do not assign a lambda expression, use a def; see I7b3db838 # H201: Except: format # P102,P103: string does contain unindexed parameters; see I36355923 -ignore = E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101,P102,P103 +#ignore = E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101,P102,P103 exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/* max_line_length = 130 accept-encodings = utf-8 -- To view, visit https://gerrit.wikimedia.org/r/262696 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ae0c6dd539ab667650de575f382276fbf342bc7 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update main copyright year to 2016 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/262450 Change subject: Update main copyright year to 2016 .. Update main copyright year to 2016 Change-Id: I577c931e24c1a3de4c87ee59ef958a5f62f97ce9 --- M LICENSE M docs/conf.py 2 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/50/262450/1 diff --git a/LICENSE b/LICENSE index c8f0800..91a8230 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Pywikibot team +Copyright (c) 2004-2016 Pywikibot team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/docs/conf.py b/docs/conf.py index bfe7162..23f0f48 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,8 +47,8 @@ master_doc = 'index' # General information about the project. -project = u'Pywikibot' -copyright = u'2015, Pywikibot team' +project = 'Pywikibot' +copyright = '2016, Pywikibot team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the -- To view, visit https://gerrit.wikimedia.org/r/262450 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I577c931e24c1a3de4c87ee59ef958a5f62f97ce9 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot.WARNING -> pywikibot.logging.WARNING - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/262445 Change subject: pywikibot.WARNING -> pywikibot.logging.WARNING .. pywikibot.WARNING -> pywikibot.logging.WARNING compat imported WARNING directly into wikipedia.py, but core does not do that in pywikibot. Change-Id: Id11c1650cd869873c3de6a945b05e54236dfed7c --- M pywikibot/page.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/45/262445/1 diff --git a/pywikibot/page.py b/pywikibot/page.py index 313bd56..af178f0 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -2454,7 +2454,7 @@ if targetCat.exists(): pywikibot.output(u'Target page %s already exists!' % targetCat.title(), - level=pywikibot.WARNING) + level=pywikibot.logging.WARNING) return False else: pywikibot.output('Moving text from %s to %s.' -- To view, visit https://gerrit.wikimedia.org/r/262445 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id11c1650cd869873c3de6a945b05e54236dfed7c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Hazard-SJ ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update ez_setup.py to v19.1.1 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/260908 Change subject: Update ez_setup.py to v19.1.1 .. Update ez_setup.py to v19.1.1 Supports Python 2.6+. Does not use `cmp`, which is removed in Python 3 causing pyflakes on Python 3 to report it as an error. Change-Id: I08f02ba7f4c6d7ea6c32e3845024a5bd00f58b35 --- M ez_setup.py 1 file changed, 251 insertions(+), 206 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/08/260908/1 diff --git a/ez_setup.py b/ez_setup.py index b02f3f1..9715bdc 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -1,66 +1,55 @@ -#!python -"""Bootstrap setuptools installation +#!/usr/bin/env python -If you want to use setuptools in your package's setup.py, just include this -file in the same directory with it, and add this to the top of your setup.py:: - -from ez_setup import use_setuptools -use_setuptools() - -If you want to require a specific version of setuptools, set a download -mirror, or use an alternate download directory, you can do so by supplying -the appropriate options to ``use_setuptools()``. - -This file can also be run as a script to install or upgrade setuptools. """ +Setuptools bootstrapping installer. + +Run this script to install or upgrade setuptools. +""" + import os import shutil import sys import tempfile -import tarfile +import zipfile import optparse import subprocess import platform +import textwrap +import contextlib +import json +import codecs from distutils import log + +try: +from urllib.request import urlopen +except ImportError: +from urllib2 import urlopen try: from site import USER_SITE except ImportError: USER_SITE = None -DEFAULT_VERSION = "1.1.6" +LATEST = object() +DEFAULT_VERSION = LATEST DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"; +DEFAULT_SAVE_DIR = os.curdir + def _python_cmd(*args): +""" +Execute a command. + +Return True if the command succeeded. +""" args = (sys.executable,) + args return subprocess.call(args) == 0 -def _check_call_py24(cmd, *args, **kwargs): -res = subprocess.call(cmd, *args, **kwargs) -class CalledProcessError(Exception): -pass -if not res == 0: -msg = "Command '%s' return non-zero exit status %d" % (cmd, res) -raise CalledProcessError(msg) -vars(subprocess).setdefault('check_call', _check_call_py24) -def _install(tarball, install_args=()): -# extracting the tarball -tmpdir = tempfile.mkdtemp() -log.warn('Extracting in %s', tmpdir) -old_wd = os.getcwd() -try: -os.chdir(tmpdir) -tar = tarfile.open(tarball) -_extractall(tar) -tar.close() - -# going in the directory -subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) -os.chdir(subdir) -log.warn('Now working in %s', subdir) - +def _install(archive_filename, install_args=()): +"""Install Setuptools.""" +with archive_context(archive_filename): # installing log.warn('Installing Setuptools') if not _python_cmd('setup.py', 'install', *install_args): @@ -68,198 +57,266 @@ log.warn('See the error message above.') # exitcode will be 2 return 2 -finally: -os.chdir(old_wd) -shutil.rmtree(tmpdir) -def _build_egg(egg, tarball, to_dir): -# extracting the tarball -tmpdir = tempfile.mkdtemp() -log.warn('Extracting in %s', tmpdir) -old_wd = os.getcwd() -try: -os.chdir(tmpdir) -tar = tarfile.open(tarball) -_extractall(tar) -tar.close() - -# going in the directory -subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) -os.chdir(subdir) -log.warn('Now working in %s', subdir) - +def _build_egg(egg, archive_filename, to_dir): +"""Build Setuptools egg.""" +with archive_context(archive_filename): # building an egg log.warn('Building a Setuptools egg in %s', to_dir) _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir) - -finally: -os.chdir(old_wd) -shutil.rmtree(tmpdir) # returning the result log.warn(egg) if not os.path.exists(egg): raise IOError('Could not build the egg.') +class ContextualZipFile(zipfile.ZipFile): + +"""Supplement ZipFile class to support context manager for Python 2.6.""" + +def __enter__(self): +return self + +def __exit__(self, type, value, traceback): +self.close() + +def __new__(cls, *args, **kwargs): +"""Construct a ZipFile or ContextualZipFile as appropriate.""" +if hasattr(zipfile.ZipFile, '__exit__'): +return zipfile.ZipFile(*args, **kwargs) +return super(ContextualZipFile, cls).__new__(cls) + + +@contextlib.contextmanager +def archive_context(filename): +"""
[MediaWiki-commits] [Gerrit] Tox pyflakes task - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/260909 Change subject: Tox pyflakes task .. Tox pyflakes task Replace flake8 noqa with alternative workaround for pyflakes. For Jenkins, use pyflakes directly on all Python implementations/versions, and only use flake8 on Python 2.7. Change-Id: I076a5300ae6ff1c30365be106a8ceca2d48de7e4 --- M pwb.py M pywikibot/bot.py M pywikibot/page.py M pywikibot/tools/__init__.py M pywikibot/tools/ip.py M pywikibot/userinterfaces/gui.py M pywikibot/userinterfaces/terminal_interface_base.py M scripts/maintenance/cache.py M setup.py M tests/site_tests.py M tox.ini 11 files changed, 114 insertions(+), 35 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/09/260909/1 diff --git a/pwb.py b/pwb.py index 81ecb85..9ac520c 100755 --- a/pwb.py +++ b/pwb.py @@ -183,7 +183,8 @@ if sys.platform == 'win32' and sys.version_info[0] < 3: _pwb_dir = str(_pwb_dir) os.environ[str('PYWIKIBOT2_DIR_PWB')] = _pwb_dir -import pywikibot # noqa +import pywikibot +pwb = pywikibot except RuntimeError as err: # user-config.py to be created print("NOTE: 'user-config.py' was not found!") diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 80905bf..9e93153 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -89,7 +89,7 @@ ListOption, OutputProxyOption, HighlightContextOption, ChoiceException, QuitKeyboardInterrupt, ) -from pywikibot.logging import CRITICAL, ERROR, INFO, WARNING # noqa: unused +from pywikibot.logging import CRITICAL, ERROR, INFO, WARNING from pywikibot.logging import DEBUG, INPUT, STDOUT, VERBOSE from pywikibot.logging import ( add_init_routine, @@ -103,6 +103,27 @@ ) from pywikibot.tools.formatter import color_format +__all__ = ( +'CRITICAL', 'ERROR', 'INFO', 'WARNING', 'DEBUG', 'INPUT', 'STDOUT', +'VERBOSE', 'critical', 'debug', 'error', 'exception', 'log', 'warning', +'output', 'stdout', 'LoggingFormatter', 'RotatingFileHandler', +'init_handlers', 'writelogheader', +'input', 'input_choice', 'input_yn', 'inputChoice', 'input_list_choice', +'Option', 'StandardOption', 'NestedOption', 'IntegerOption', +'ContextOption', 'ListOption', 'OutputProxyOption', +'HighlightContextOption', 'ChoiceException', 'UnhandledAnswer', +'Choice', 'AlwaysChoice', +'QuitKeyboardInterrupt', +'InteractiveReplace', +'calledModuleName', 'handle_args', 'handleArgs', 'showHelp', 'suggest_help', +'writeToCommandLogFile', 'open_webbrowser', +'BaseBot', 'Bot', 'SingleSiteBot', 'MultipleSitesBot', +'CurrentPageBot', 'AutomaticTWSummaryBot', +'ExistingPageBot', 'FollowRedirectPageBot', 'CreatingPageBot', +'RedirectPageBot', 'NoRedirectPageBot', +'WikidataBot', +) + if not PY2: unicode = str diff --git a/pywikibot/page.py b/pywikibot/page.py index 34f30b6..ad126c9 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -34,13 +34,18 @@ from collections import defaultdict, namedtuple from warnings import warn -if sys.version_info[0] > 2: +from pywikibot.tools import PY2 + +if not PY2: unicode = basestring = str long = int from html import entities as htmlentitydefs from urllib.parse import quote_from_bytes, unquote_to_bytes else: -chr = unichr # noqa +if __debug__ and not PY2: +unichr = NotImplemented # pyflakes workaround + +chr = unichr import htmlentitydefs from urllib import quote as quote_from_bytes, unquote as unquote_to_bytes @@ -60,16 +65,36 @@ from pywikibot.family import Family from pywikibot.site import Namespace from pywikibot.tools import ( -PYTHON_VERSION, PY2, +PYTHON_VERSION, MediaWikiVersion, UnicodeMixin, ComparableMixin, DotReadableDict, deprecated, deprecate_arg, deprecated_args, issue_deprecation_warning, ModuleDeprecationWrapper as _ModuleDeprecationWrapper, first_upper, remove_last_args, _NotImplementedWarning, OrderedDict, Counter, ) -from pywikibot.tools.ip import ip_regexp # noqa & deprecated +from pywikibot.tools.ip import ip_regexp from pywikibot.tools.ip import is_IP +__all__ = ( +'BasePage', +'Page', +'FilePage', +'Category', +'User', +'WikibasePage', +'ItemPage', +'Property', +'PropertyPage', +'Claim', +'Revision', +'FileInfo', +'Link', +'html2unicode', +'UnicodeToAsciiHtml', +'unicode2html', +'url2unicode', +'ip_regexp', # unused & deprecated +) logger = logging.getLogger("pywiki.wiki.page") diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index 6aee965..a3fbed3 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -138,9 +138,16 @@ else: -from collections import Counter # noqa ; unused +from collections import Counter from collections import OrderedDic
[MediaWiki-commits] [Gerrit] Do not expand text by default in getCategoryLinks - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/260905 Change subject: Do not expand text by default in getCategoryLinks .. Do not expand text by default in getCategoryLinks 666364ca introduced wikitext expansion while getting category links, however this caused magic names like {{PAGENAME}} to be expanded when it should be kept in the wikitext. Make this new functionality disabled by default. Bug: T109213 Change-Id: I321ba1715fe7b1a9c24d7f8109db236339e5f4b5 (cherry picked from commit b28346ab33e0f2d844904bded538f137c7d04cd3) --- M pywikibot/textlib.py M tests/textlib_tests.py 2 files changed, 9 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/05/260905/1 diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 1f659c9..456940e 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -743,7 +743,7 @@ # Functions dealing with category links # - -def getCategoryLinks(text, site=None, include=[]): +def getCategoryLinks(text, site=None, include=[], expand_text=False): """Return a list of category links found in text. @param include: list of tags which should not be removed by @@ -763,7 +763,7 @@ R = re.compile(r'\[\[\s*(?P%s)\s*:\s*(?P.+?)\]\]' % catNamespace, re.I) for match in R.finditer(text): -if '{{' in match.group('rest'): +if expand_text and '{{' in match.group('rest'): rest = site.expand_text(match.group('rest')) else: rest = match.group('rest') diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 563f639..e928ade 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -237,24 +237,25 @@ def test_templates(self): self.site = self.get_site() self.assertEqual(textlib.getCategoryLinks( -'[[Category:{{P1|Foo}}]]', self.site), +'[[Category:{{P1|Foo}}]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:{{P1|Foo}}|bar]]', self.site), +'[[Category:{{P1|Foo}}|bar]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:{{P1|{{P2|L33t|Foo|bar]]', self.site), +'[[Category:{{P1|{{P2|L33t|Foo|bar]]', +self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:Foo{{!}}bar]]', self.site), +'[[Category:Foo{{!}}bar]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar')]) self.assertEqual(textlib.getCategoryLinks( '[[Category:Foo{{!}}bar]][[Category:Wiki{{P2||pedia}}]]', -self.site), +self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar'), pywikibot.page.Category(self.site, 'Wikipedia')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:Foo{{!}}and{{!}}bar]]', self.site), +'[[Category:Foo{{!}}and{{!}}bar]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='and|bar')]) self.assertRaises(pywikibot.InvalidTitle, textlib.getCategoryLinks, '[[Category:nasty{{{!}}]]', self.site) -- To view, visit https://gerrit.wikimedia.org/r/260905 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I321ba1715fe7b1a9c24d7f8109db236339e5f4b5 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Prevent AttributeError for when filename is None - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/260719 Change subject: Prevent AttributeError for when filename is None .. Prevent AttributeError for when filename is None From line 172, filename can be None. Such a case would raise an AttributeError when handling the RuntimeError. Bug: T121835 Change-Id: I02510d6e69269881dc1ae4b3ed0b9c65156cddbc --- M pwb.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/19/260719/1 diff --git a/pwb.py b/pwb.py index 601c2d4..fe2eeec 100755 --- a/pwb.py +++ b/pwb.py @@ -206,7 +206,7 @@ except RuntimeError as err: # user-config.py to be created print("NOTE: 'user-config.py' was not found!") -if not filename.startswith('generate_'): +if filename is not None and not filename.startswith('generate_'): print("Please follow the prompts to create it:") run_python_file('generate_user_files.py', ['generate_user_files.py'], -- To view, visit https://gerrit.wikimedia.org/r/260719 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I02510d6e69269881dc1ae4b3ed0b9c65156cddbc Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Hazard-SJ ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix invalid raise syntax in askForCaptcha - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/260557 Change subject: Fix invalid raise syntax in askForCaptcha .. Fix invalid raise syntax in askForCaptcha A base raise statement can only exist inside an `except:` clause. Change-Id: I308379e47a574dd62d1cddd73253fc3171f10dbf --- M pywikibot/userinterfaces/terminal_interface_base.py 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/57/260557/1 diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py index 4540e2c..66aad34 100755 --- a/pywikibot/userinterfaces/terminal_interface_base.py +++ b/pywikibot/userinterfaces/terminal_interface_base.py @@ -443,8 +443,9 @@ u'What is the solution of the CAPTCHA that is shown in ' u'your web browser?') else: -raise -except: +raise webbrowser.Error( +'webbrowser.open failed to open a web browser') +except Exception: pywikibot.output(u'Error in opening web browser: %s' % sys.exc_info()[0]) pywikibot.output( -- To view, visit https://gerrit.wikimedia.org/r/260557 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I308379e47a574dd62d1cddd73253fc3171f10dbf Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Enable hacking rule H202 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/260546 Change subject: Enable hacking rule H202 .. Enable hacking rule H202 Hacking rule H202 prevents tests using self.assertRaises with only 'Exception' being detected. It requires tests to switch to using assertRaisesRegexp or use a more specific Exception subclass. Change-Id: I667d7ed3aa447412d99b5a503d09394b7c09a02d --- M tests/isbn_tests.py M tests/weblinkchecker_tests.py M tox.ini 3 files changed, 27 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/46/260546/1 diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py index 506b65a..c437a03 100644 --- a/tests/isbn_tests.py +++ b/tests/isbn_tests.py @@ -11,6 +11,11 @@ __version__ = '$Id$' +try: +from stdnum.exceptions import ValidationError as StdNumValidationError +except ImportError: +StdNumValidationError = None + from pywikibot import Bot, Claim, ItemPage from pywikibot.cosmetic_changes import CosmeticChangesToolkit, CANCEL_MATCH @@ -25,6 +30,11 @@ WikibaseTestCase, ScriptMainTestCase, ) from tests.bot_tests import TWNBotTestCase + +if StdNumValidationError: +AnyIsbnValidationException = (StdNumValidationError, IsbnExc) +else: +AnyIsbnValidationException = IsbnExc class TestCosmeticChangesISBN(DefaultDrySiteTestCase): @@ -45,10 +55,18 @@ """Test that it'll fail when the ISBN is invalid.""" cc = CosmeticChangesToolkit(self.site, namespace=0) -self.assertRaises(Exception, cc.fix_ISBN, 'ISBN 0975229LOL') # Invalid characters -self.assertRaises(Exception, cc.fix_ISBN, 'ISBN 0975229801') # Invalid checksum -self.assertRaises(Exception, cc.fix_ISBN, 'ISBN 09752298') # Invalid length -self.assertRaises(Exception, cc.fix_ISBN, 'ISBN 09752X9801') # X in the middle +# Invalid characters +self.assertRaises(AnyIsbnValidationException, + cc.fix_ISBN, 'ISBN 0975229LOL') +# Invalid checksum +self.assertRaises(AnyIsbnValidationException, + cc.fix_ISBN, 'ISBN 0975229801') +# Invalid length +self.assertRaises(AnyIsbnValidationException, + cc.fix_ISBN, 'ISBN 09752298') +# X in the middle +self.assertRaises(AnyIsbnValidationException, + cc.fix_ISBN, 'ISBN 09752X9801') def test_ignore_invalid_isbn(self): """Test fixing ISBN numbers with an invalid ISBN.""" diff --git a/tests/weblinkchecker_tests.py b/tests/weblinkchecker_tests.py index e3682a7..2080d98 100644 --- a/tests/weblinkchecker_tests.py +++ b/tests/weblinkchecker_tests.py @@ -84,7 +84,10 @@ def test_invalid(self): """Test getting memento for invalid URL.""" -self.assertRaises(Exception, self._get_archive_url, 'invalid') +# memento_client raises 'Exception', not a subclass. +self.assertRaisesRegexp( +Exception, 'Only HTTP URIs are supported', +self._get_archive_url, 'invalid') if __name__ == '__main__': diff --git a/tox.ini b/tox.ini index ac5a94b..eb6dbc9 100644 --- a/tox.ini +++ b/tox.ini @@ -78,7 +78,7 @@ -rdocs/requirements-py3.txt [flake8] -ignore = E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H301,H404,H405,I100,I101,P102,P103 +ignore = E402,E731,D105,D211,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101,P102,P103 exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/* max_line_length = 130 accept-encodings = utf-8 -- To view, visit https://gerrit.wikimedia.org/r/260546 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I667d7ed3aa447412d99b5a503d09394b7c09a02d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Split TestUserContribs between user and non-user - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/259607 Change subject: Split TestUserContribs between user and non-user .. Split TestUserContribs between user and non-user Fixes errors on Travis. Bug: T78668 Change-Id: I7acdab9cab50e2edce1865b7aca6bba4470db639 (manually cherry-pick of ee054a56) --- M tests/site_tests.py 1 file changed, 94 insertions(+), 41 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/07/259607/1 diff --git a/tests/site_tests.py b/tests/site_tests.py index 20be28b..75ca1bc 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -1031,7 +1031,13 @@ raise unittest.SkipTest("gsrsearch returned timeout on site: %r" % e) raise -def testUsercontribs(self): +class TestUserContribsAsUser(DefaultSiteTestCase): + +"""Test site method site.usercontribs() with bot user.""" + +user = True + +def test_basic(self): """Test the site.usercontribs() method.""" mysite = self.get_site() uc = list(mysite.usercontribs(user=mysite.user(), total=10)) @@ -1040,39 +1046,98 @@ for contrib in uc)) self.assertTrue(all('user' in contrib and contrib['user'] == mysite.user() for contrib in uc)) + +def test_namespaces(self): +"""Test the site.usercontribs() method using namespaces.""" +mysite = self.get_site() +for contrib in mysite.usercontribs(user=mysite.user(), + namespaces=14, total=5): +self.assertIsInstance(contrib, dict) +self.assertIn("title", contrib) +self.assertTrue(contrib["title"].startswith(mysite.namespace(14))) + +for contrib in mysite.usercontribs(user=mysite.user(), + namespaces=[10, 11], total=5): +self.assertIsInstance(contrib, dict) +self.assertIn("title", contrib) +self.assertIn(contrib["ns"], (10, 11)) + +def test_show_minor(self): +"""Test the site.usercontribs() method using showMinor.""" +mysite = self.get_site() +for contrib in mysite.usercontribs(user=mysite.user(), + showMinor=True, total=5): +self.assertIsInstance(contrib, dict) +self.assertIn("minor", contrib) + +for contrib in mysite.usercontribs(user=mysite.user(), + showMinor=False, total=5): +self.assertIsInstance(contrib, dict) +self.assertNotIn("minor", contrib) + + +class TestUserContribsWithoutUser(DefaultSiteTestCase): + +"""Test site method site.usercontribs() without bot user.""" + +def test_user_prefix(self): +"""Test the site.usercontribs() method with userprefix.""" +mysite = self.get_site() for contrib in mysite.usercontribs(userprefix="John", total=5): self.assertIsInstance(contrib, dict) for key in ("user", "title", "ns", "pageid", "revid"): self.assertIn(key, contrib) self.assertTrue(contrib["user"].startswith("John")) -for contrib in mysite.usercontribs(userprefix="Jane", - start=pywikibot.Timestamp.fromISOformat("2008-10-06T01:02:03Z"), - total=5): + +def test_user_prefix_range(self): +"""Test the site.usercontribs() method.""" +mysite = self.get_site() +for contrib in mysite.usercontribs( +userprefix='Jane', + start=pywikibot.Timestamp.fromISOformat("2008-10-06T01:02:03Z"), +total=5): self.assertLessEqual(contrib['timestamp'], "2008-10-06T01:02:03Z") -for contrib in mysite.usercontribs(userprefix="Jane", - end=pywikibot.Timestamp.fromISOformat("2008-10-07T02:03:04Z"), - total=5): + +for contrib in mysite.usercontribs( +userprefix='Jane', +end=pywikibot.Timestamp.fromISOformat("2008-10-07T02:03:04Z"), +total=5): self.assertGreaterEqual(contrib['timestamp'], "2008-10-07T02:03:04Z") -for contrib in mysite.usercontribs(userprefix="Brion", - start=pywikibot.Timestamp.fromISOformat("2008-10-08T03:05:07Z"), - total=5, reverse=True): -self.assertGreaterEqual(contrib['timestamp'], "2008-10-08T03:05:07Z") -for contrib in mysite.usercontribs(userprefix="Brion", - end=pywikibot.Timestamp.fromISOformat("2008-10-09T04:06:08Z"), - total=5, reverse=True): -
[MediaWiki-commits] [Gerrit] Pywikibot 2.0rc4 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/259236 Change subject: Pywikibot 2.0rc4 .. Pywikibot 2.0rc4 Change-Id: I028472a8fe0c322981c1ef817a68218a7cf7305a --- M ChangeLog M docs/conf.py M pywikibot/__init__.py M setup.py 4 files changed, 47 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/36/259236/1 diff --git a/ChangeLog b/ChangeLog index c0deb8a..17a191d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,48 @@ +Release 2.0rc4 (15 December 2015) += + +Bugfixes (core) +--- +e42891d Remove dependency on pYsearch +ecc39ce Require google>=0.7 +fa431a4 Desupport Python 2.6 for Pywikibot 2.0 release branch +b1f6f39 config: Don't crash on later get_base_dir calls +0925c51 cosmetic_changes: merge similar regexes +4bf39f3 Update revId upon claim change +ea11626 Update WOW hostnames +2a5a4fa Mark site.patrol() as a user write action +4f568c5 Fix interwikiFormat support for Link +7cb6962 Changes are wrongly detected in the last langlink +5c5d658 getLanguageLinks: Skip own site +7ee8ec2 fix intersection of sets of namespaces +94b0c43 Import textlib.TimeStripper +584d7c1 Change "PyWikiBot" to "Pywikibot" +1f8d57e Stop crashing item loads due to support of units +c19dcfa __all__ items must be bytes on Python 2 +e6aa6ca Omit includeredirects parameter for allpages generator +687ec9e Performance fix for sites using interwiki_putfirst option +28db3d2 Fix Persian Wikipedia configuration +3944f5e rollback: Use Revision instance properly +860af34 Add must_be to DataSite write actions +f8af8e0 Remove unneeded site argument to AutoFamily +bf49a7d Fix ComparableMixin +1d36e45 Deprecate ParamInfo.query_modules_with_limits +e83c6a3 be-x-old is renamed to be-tarask +19bbe7e Correctly identify qualifier from JSON + +Bugfixes (scripts) +-- +4e78c27 checkimages: Expect NoPage exception +fbb6266 interwiki: Optimize/remove unneeded calls to Page.isEmpty() +428420a interwiki: Allow Subject.originPage to be updated +a305d7b interwiki: Allow titletranslate.translate page to be None +a786226 interwiki: '-ignore' parameter throws exception +ab7abf5 interwiki: check for category before emptiness +0db2e87 interwiki: do not automatically log in +47ed5d5 nowcommons: Query at most one users + Release 2.0rc3 (30 September 2015) - +== Bugfixes (core) --- diff --git a/docs/conf.py b/docs/conf.py index 2e59f19..f6b5f94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,7 +52,7 @@ # The short X.Y version. version = '2.0' # The full version, including alpha/beta/rc tags. -release = '2.0rc1' +release = '2.0rc4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 1191b6e..e26392a 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -7,7 +7,7 @@ # from __future__ import unicode_literals -__release__ = '2.0rc3' +__release__ = '2.0rc4' __version__ = '$Id$' import datetime diff --git a/setup.py b/setup.py index de7bb95..397dac1 100644 --- a/setup.py +++ b/setup.py @@ -160,7 +160,7 @@ from setuptools import setup, find_packages name = 'pywikibot' -version = '2.0rc3' +version = '2.0rc4' github_url = 'https://github.com/wikimedia/pywikibot-core' setup( -- To view, visit https://gerrit.wikimedia.org/r/259236 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I028472a8fe0c322981c1ef817a68218a7cf7305a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Pywikibot 2.0rc4 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/259215 Change subject: Pywikibot 2.0rc4 .. Pywikibot 2.0rc4 Change-Id: I028472a8fe0c322981c1ef817a68218a7cf7305a --- M ChangeLog M pywikibot/__init__.py M setup.py 3 files changed, 46 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/15/259215/1 diff --git a/ChangeLog b/ChangeLog index c0deb8a..903cdfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,48 @@ +Release 2.0rc4 (15 December 2015) += + +Bugfixes (core) +--- +e42891d Remove dependency on pYsearch +ecc39ce Require google>=0.7 +fa431a4 Desupport Python 2.6 for Pywikibot 2.0 release branch +b1f6f39 config: Don't crash on later get_base_dir calls +0925c51 cosmetic_changes: merge similar regexes +4bf39f3 Update revId upon claim change +ea11626 Update WOW hostnames +2a5a4fa Mark site.patrol() as a user write action +4f568c5 Fix interwikiFormat support for Link +7cb6962 Changes are wrongly detected in the last langlink +5c5d658 getLanguageLinks: Skip own site +7ee8ec2 fix intersection of sets of namespaces +94b0c43 Import textlib.TimeStripper +584d7c1 Change "PyWikiBot" to "Pywikibot" +1f8d57e Stop crashing item loads due to support of units +c19dcfa __all__ items must be bytes on Python 2 +e6aa6ca Omit includeredirects parameter for allpages generator +687ec9e Performance fix for sites using interwiki_putfirst option +28db3d2 Fix Persian Wikipedia configuration +860af34 Add must_be to DataSite write actions +f8af8e0 Remove unneeded site argument to AutoFamily +bf49a7d Fix ComparableMixin +1d36e45 Deprecate ParamInfo.query_modules_with_limits +e83c6a3 be-x-old is renamed to be-tarask +19bbe7e Correctly identify qualifier from JSON + +Bugfixes (scripts) +-- +47ed5d5 nowcommons: Query at most one users +fbb6266 interwiki: Optimize/remove unneeded calls to Page.isEmpty() +428420a interwiki: Allow Subject.originPage to be updated +4e78c27 checkimages: Expect NoPage exception +a305d7b interwiki: Allow titletranslate.translate page to be None +a786226 interwiki: '-ignore' parameter throws exception +3944f5e rollback: Use Revision instance properly +ab7abf5 interwiki: check for category before emptiness +0db2e87 interwiki: do not automatically log in + Release 2.0rc3 (30 September 2015) - +== Bugfixes (core) --- diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 1191b6e..e26392a 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -7,7 +7,7 @@ # from __future__ import unicode_literals -__release__ = '2.0rc3' +__release__ = '2.0rc4' __version__ = '$Id$' import datetime diff --git a/setup.py b/setup.py index de7bb95..397dac1 100644 --- a/setup.py +++ b/setup.py @@ -160,7 +160,7 @@ from setuptools import setup, find_packages name = 'pywikibot' -version = '2.0rc3' +version = '2.0rc4' github_url = 'https://github.com/wikimedia/pywikibot-core' setup( -- To view, visit https://gerrit.wikimedia.org/r/259215 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I028472a8fe0c322981c1ef817a68218a7cf7305a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Pywikibot 2.0rc4 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/259213 Change subject: Pywikibot 2.0rc4 .. Pywikibot 2.0rc4 Change-Id: I0e0c3b0370ecff639b02e474a6d6532b798d2177 --- M ChangeLog M pywikibot/__init__.py M setup.py 3 files changed, 46 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/13/259213/1 diff --git a/ChangeLog b/ChangeLog index c0deb8a..903cdfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,48 @@ +Release 2.0rc4 (15 December 2015) += + +Bugfixes (core) +--- +e42891d Remove dependency on pYsearch +ecc39ce Require google>=0.7 +fa431a4 Desupport Python 2.6 for Pywikibot 2.0 release branch +b1f6f39 config: Don't crash on later get_base_dir calls +0925c51 cosmetic_changes: merge similar regexes +4bf39f3 Update revId upon claim change +ea11626 Update WOW hostnames +2a5a4fa Mark site.patrol() as a user write action +4f568c5 Fix interwikiFormat support for Link +7cb6962 Changes are wrongly detected in the last langlink +5c5d658 getLanguageLinks: Skip own site +7ee8ec2 fix intersection of sets of namespaces +94b0c43 Import textlib.TimeStripper +584d7c1 Change "PyWikiBot" to "Pywikibot" +1f8d57e Stop crashing item loads due to support of units +c19dcfa __all__ items must be bytes on Python 2 +e6aa6ca Omit includeredirects parameter for allpages generator +687ec9e Performance fix for sites using interwiki_putfirst option +28db3d2 Fix Persian Wikipedia configuration +860af34 Add must_be to DataSite write actions +f8af8e0 Remove unneeded site argument to AutoFamily +bf49a7d Fix ComparableMixin +1d36e45 Deprecate ParamInfo.query_modules_with_limits +e83c6a3 be-x-old is renamed to be-tarask +19bbe7e Correctly identify qualifier from JSON + +Bugfixes (scripts) +-- +47ed5d5 nowcommons: Query at most one users +fbb6266 interwiki: Optimize/remove unneeded calls to Page.isEmpty() +428420a interwiki: Allow Subject.originPage to be updated +4e78c27 checkimages: Expect NoPage exception +a305d7b interwiki: Allow titletranslate.translate page to be None +a786226 interwiki: '-ignore' parameter throws exception +3944f5e rollback: Use Revision instance properly +ab7abf5 interwiki: check for category before emptiness +0db2e87 interwiki: do not automatically log in + Release 2.0rc3 (30 September 2015) - +== Bugfixes (core) --- diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 1191b6e..e26392a 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -7,7 +7,7 @@ # from __future__ import unicode_literals -__release__ = '2.0rc3' +__release__ = '2.0rc4' __version__ = '$Id$' import datetime diff --git a/setup.py b/setup.py index de7bb95..397dac1 100644 --- a/setup.py +++ b/setup.py @@ -160,7 +160,7 @@ from setuptools import setup, find_packages name = 'pywikibot' -version = '2.0rc3' +version = '2.0rc4' github_url = 'https://github.com/wikimedia/pywikibot-core' setup( -- To view, visit https://gerrit.wikimedia.org/r/259213 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e0c3b0370ecff639b02e474a6d6532b798d2177 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix docstring using quod-quote - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/258896 Change subject: Fix docstring using quod-quote .. Fix docstring using quod-quote c85ed271 introduced a docstring with """, resulting in a literal " in the docstring. Bug: T121365 Change-Id: I6e8f37f192ea66aed1d37856e515fb685e9a71d2 --- M pywikibot/family.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/96/258896/1 diff --git a/pywikibot/family.py b/pywikibot/family.py index 4fe4b47..a139447 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -1019,7 +1019,7 @@ return self._get_cr_templates(code, fallback) def disambig(self, code, fallback='_default'): -Return list of disambiguation templates.""" +"""Return list of disambiguation templates.""" if code in self.disambiguationTemplates: return self.disambiguationTemplates[code] elif fallback: -- To view, visit https://gerrit.wikimedia.org/r/258896 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6e8f37f192ea66aed1d37856e515fb685e9a71d2 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Do not expand text by default in getCategoryLinks - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/258782 Change subject: Do not expand text by default in getCategoryLinks .. Do not expand text by default in getCategoryLinks 666364ca introduced wikitext expansion while getting category links, however this caused magic names like {{PAGENAME}} to be expanded when it should be kept in the wikitext. Make this new functionality disabled by default. Bug: T109213 Change-Id: I321ba1715fe7b1a9c24d7f8109db236339e5f4b5 --- M pywikibot/textlib.py M tests/textlib_tests.py 2 files changed, 9 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/82/258782/1 diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 05e0b8b..0fe92e0 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -993,7 +993,7 @@ # Functions dealing with category links # - -def getCategoryLinks(text, site=None, include=[]): +def getCategoryLinks(text, site=None, include=[], expand_text=False): """Return a list of category links found in text. @param include: list of tags which should not be removed by @@ -1013,7 +1013,7 @@ R = re.compile(r'\[\[\s*(?P%s)\s*:\s*(?P.+?)\]\]' % catNamespace, re.I) for match in R.finditer(text): -if '{{' in match.group('rest'): +if expand_text and '{{' in match.group('rest'): rest = site.expand_text(match.group('rest')) else: rest = match.group('rest') diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 762f62d..6b674a8 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -265,24 +265,25 @@ """Test normal templates inside category links.""" self.site = self.get_site() self.assertEqual(textlib.getCategoryLinks( -'[[Category:{{P1|Foo}}]]', self.site), +'[[Category:{{P1|Foo}}]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:{{P1|Foo}}|bar]]', self.site), +'[[Category:{{P1|Foo}}|bar]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:{{P1|{{P2|L33t|Foo|bar]]', self.site), +'[[Category:{{P1|{{P2|L33t|Foo|bar]]', +self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:Foo{{!}}bar]]', self.site), +'[[Category:Foo{{!}}bar]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar')]) self.assertEqual(textlib.getCategoryLinks( '[[Category:Foo{{!}}bar]][[Category:Wiki{{P2||pedia}}]]', -self.site), +self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='bar'), pywikibot.page.Category(self.site, 'Wikipedia')]) self.assertEqual(textlib.getCategoryLinks( -'[[Category:Foo{{!}}and{{!}}bar]]', self.site), +'[[Category:Foo{{!}}and{{!}}bar]]', self.site, expand_text=True), [pywikibot.page.Category(self.site, 'Foo', sortKey='and|bar')]) self.assertRaises(pywikibot.InvalidTitle, textlib.getCategoryLinks, '[[Category:nasty{{{!}}]]', self.site) -- To view, visit https://gerrit.wikimedia.org/r/258782 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I321ba1715fe7b1a9c24d7f8109db236339e5f4b5 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove dependency on pYsearch - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/258728 Change subject: Remove dependency on pYsearch .. Remove dependency on pYsearch pYsearch does not work, and an alternative implementation is not yet available. Bug: T106062 Bug: T106085 Change-Id: I162cc2cc125dc894d8a05ca711577dc37af5dcb2 --- M pywikibot/config2.py M pywikibot/pagegenerators.py M requirements.txt M setup.py 4 files changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/28/258728/1 diff --git a/pywikibot/config2.py b/pywikibot/config2.py index f2d644f..16c01ba 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -612,9 +612,8 @@ # # SEARCH ENGINE SETTINGS ## -# Some scripts allow using the Yahoo! Search Web Services. To use this feature, -# you must install the pYsearch module from http://pysearch.sourceforge.net -# and get a Yahoo AppID from https://developer.yahoo.com/ +# Yahoo! Search Web Services are not operational. +# See https://phabricator.wikimedia.org/T106085 yahoo_appid = '' # To use Windows Live Search web service you must get an AppID from diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index dd96d21..e6420a4 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -2072,7 +2072,6 @@ To use this generator, install pYsearch """ -# values larger than 100 fail def __init__(self, query=None, count=100, site=None): """ Constructor. @@ -2080,6 +2079,10 @@ @param site: Site for generator results. @type site: L{pywikibot.site.BaseSite} """ +raise RuntimeError( +'pagegenerator YahooSearchPageGenerator is not functional.\n' +'See https://phabricator.wikimedia.org/T106085') + self.query = query or pywikibot.input(u'Please enter the search query:') self.count = count if site is None: diff --git a/requirements.txt b/requirements.txt index f3dd315..f28f9e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,7 +25,6 @@ pydot # core pagegenerators -pYsearch google >= 1.7 # scripts/script_wui.py: diff --git a/setup.py b/setup.py index 9a4ac85..de7bb95 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,6 @@ extra_deps.update({ 'csv': ['unicodecsv'], 'MySQL': ['oursql'], -'Yahoo': ['pYsearch'], }) script_deps = { -- To view, visit https://gerrit.wikimedia.org/r/258728 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I162cc2cc125dc894d8a05ca711577dc37af5dcb2 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Require google>=0.7 - change (pywikibot/core)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/258727 Change subject: Require google>=0.7 .. Require google>=0.7 https://github.com/MarioVilas/google/pull/12 has been merged and released on pypi Bug: T102314 Change-Id: Ie4b1749dc08ea6851911e237f0b7f3f3b20b3e62 --- M requirements.txt M setup.py 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/27/258727/1 diff --git a/requirements.txt b/requirements.txt index 47b8316..f3dd315 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ # core pagegenerators pYsearch -google +google >= 1.7 # scripts/script_wui.py: crontab diff --git a/setup.py b/setup.py index 723f1ff..9a4ac85 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ # Core library dependencies 'isbn': ['python-stdnum'], 'Graphviz': ['pydot>=1.0.28'], -'Google': ['google'], +'Google': ['google>=1.7'], 'IRC': [irc_dep], 'mwparserfromhell': ['mwparserfromhell>=0.3.3'], 'Tkinter': ['Pillow'], -- To view, visit https://gerrit.wikimedia.org/r/258727 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie4b1749dc08ea6851911e237f0b7f3f3b20b3e62 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: 2.0 Gerrit-Owner: John Vandenberg Gerrit-Reviewer: Merlijn van Deen ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Map 'less' to 'css' - change (mediawiki...SyntaxHighlight_GeSHi)
John Vandenberg has uploaded a new change for review. https://gerrit.wikimedia.org/r/258694 Change subject: Map 'less' to 'css' .. Map 'less' to 'css' Change-Id: I5258f157e721fc4667f553bb2762e3417978c8b9 --- M SyntaxHighlight_GeSHi.compat.php 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SyntaxHighlight_GeSHi refs/changes/94/258694/1 diff --git a/SyntaxHighlight_GeSHi.compat.php b/SyntaxHighlight_GeSHi.compat.php index 98a1498..aa2e142 100644 --- a/SyntaxHighlight_GeSHi.compat.php +++ b/SyntaxHighlight_GeSHi.compat.php @@ -70,6 +70,9 @@ 'jquery' => 'javascript', 'ecmascript' => 'javascript', + // CSS + 'less' => 'css', + // Microsoft 'vb' => 'vbnet', 'asp' => 'aspx-vb', -- To view, visit https://gerrit.wikimedia.org/r/258694 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5258f157e721fc4667f553bb2762e3417978c8b9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SyntaxHighlight_GeSHi Gerrit-Branch: master Gerrit-Owner: John Vandenberg ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits