jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] nowcommons: Query at most one users
......................................................................
[IMPROV] nowcommons: Query at most one users
To verify if a page is used it's only necessary to query one using page instead
of all.
Change-Id: I9bbb206ede1723c33410c3b50e05dae71ecc265f
---
M scripts/nowcommons.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index cfd9d0b..433dd9c 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -374,9 +374,9 @@
bot.run()
# If the image is used with the urlname the
# previous function won't work
- if len(list(pywikibot.FilePage(self.site,
- page.title()).usingPages())) > 0 and \
- self.getOption('replaceloose'):
+ is_used = bool(list(pywikibot.FilePage(
+ self.site, page.title()).usingPages(total=1)))
+ if is_used and self.getOption('replaceloose'):
bot = ImageBot(
pg.FileLinksGenerator(
localImagePage),
--
To view, visit https://gerrit.wikimedia.org/r/240359
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9bbb206ede1723c33410c3b50e05dae71ecc265f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] Use newer version of unicodecsv again
......................................................................
[IMPROV] Use newer version of unicodecsv again
Version 0.14.0 of `unicodecsv` is not compatible with Python 2.6 so that with
f4ebbf92 it installed 0.13.0 (the version before that) on Python 2.6 systems.
But with 0.14.1 the compatibility was restored so that we only need to skip
0.14.0 installs.
Bug: T113222
Change-Id: I46ee49a95ea0491130f29d21bbc59e1610c72adf
---
M requirements.txt
M setup.py
2 files changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/requirements.txt b/requirements.txt
index c7db758..827c7e0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -45,7 +45,7 @@
git+https://github.com/nlhepler/pydot#egg=pydot-1.0.29
# wikistats.py and scripts
-unicodecsv<=0.13 ; python_version < '2.7'
+unicodecsv!=0.14.0 ; python_version < '2.7'
unicodecsv ; python_version < '3' and python_version >= '2.7'
# cosmetic_changes and scripts/isbn
diff --git a/setup.py b/setup.py
index 2a2d63f..65d1b13 100644
--- a/setup.py
+++ b/setup.py
@@ -40,7 +40,7 @@
# the irc module has no Python 2.6 support since 10.0
irc_dep = 'irc==8.9' if sys.version_info < (2, 7) else 'irc'
-csv_dep = 'unicodecsv<=0.13' if PYTHON_VERSION < (2, 7) else 'unicodecsv'
+csv_dep = 'unicodecsv!=0.14.0' if PYTHON_VERSION < (2, 7) else 'unicodecsv'
extra_deps = {
# Core library dependencies
--
To view, visit https://gerrit.wikimedia.org/r/240574
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I46ee49a95ea0491130f29d21bbc59e1610c72adf
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: proofreadpage.py: Fix an error in tests and errors in docstrings
......................................................................
proofreadpage.py: Fix an error in tests and errors in docstrings
Change-Id: Id9943d7c8a0432495bb6415fb792e0d54c6de452
---
M pywikibot/proofreadpage.py
M tests/proofreadpage_tests.py
2 files changed, 4 insertions(+), 4 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index a14e2f2..4da5401 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -478,7 +478,7 @@
There is a 1-to-many correspondence (a label can be the same for
several pages).
- @return: list containing page numbers corresponding to page label.
+ @return: set containing page numbers corresponding to page label.
"""
return self._get_from_label(self._page_numbers_from_label, label)
@@ -488,6 +488,6 @@
There is a 1-to-many correspondence (a label can be the same for
several pages).
- @return: list containing pages corresponding to page label.
+ @return: set containing pages corresponding to page label.
"""
return self._get_from_label(self._pages_from_label, label)
diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py
index b16ec0e..761e68a 100644
--- a/tests/proofreadpage_tests.py
+++ b/tests/proofreadpage_tests.py
@@ -345,7 +345,7 @@
# Error if page does not exists.
self.assertRaises(KeyError, index_page.get_label_from_page, None)
- def test_get_page_number(self, key):
+ def test_get_page_and_number(self, key):
"""Test IndexPage page get_page_number functions."""
data = self.sites[key]
index_page = IndexPage(self.site, self.sites[key]['index'])
@@ -380,7 +380,7 @@
n = index_page._numbers_from_page[p]
self.assertEqual(index_page._page_from_numbers[n], p)
for n in num_set:
- n = index_page._page_from_numbers[p]
+ p = index_page._page_from_numbers[n]
self.assertEqual(index_page._numbers_from_page[p], n)
def test_page_number_mapping(self, key):
--
To view, visit https://gerrit.wikimedia.org/r/242751
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id9943d7c8a0432495bb6415fb792e0d54c6de452
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Omit includeredirects parameter for allpages generator
......................................................................
Omit includeredirects parameter for allpages generator
- since includeredirects is listed in deprecated_args, it is never filed to
the allpages parameter list.
- rewrite the filterredir mapping for backward compatibility
- assign includeredirects to filterredir in prefixindex method
- update doc: parameter deprecation is trivially shown by the decorator.
Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
(cherry picked from commit 187f51bb7d9b4a5083e436d0c7027ea441da4eed)
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 10 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 5e3a53f..519a9a3 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3425,15 +3425,13 @@
'subcats': 0}
return category._catinfo
- @deprecated_args(throttle=None, limit="total", includeredirects="filterredir")
+ @deprecated_args(throttle=None, limit='total',
+ includeredirects='filterredir')
def allpages(self, start="!", prefix="", namespace=0, filterredir=None,
filterlanglinks=None, minsize=None, maxsize=None,
protect_type=None, protect_level=None, reverse=False,
- includeredirects=None, step=None, total=None, content=False):
+ step=None, total=None, content=False):
"""Iterate pages in a single namespace.
-
- Note: parameters includeRedirects and throttle are deprecated and
- included only for backwards compatibility.
@param start: Start at this title (page need not exist).
@param prefix: Only yield pages starting with this string.
@@ -3455,16 +3453,16 @@
level; can only be used if protect_type is specified
@param reverse: if True, iterate in reverse Unicode lexigraphic
order (default: iterate in forward order)
- @param includeredirects: DEPRECATED, use filterredir instead
@param content: if True, load the current content of each iterated page
(default False)
@raises KeyError: the namespace identifier was not resolved
@raises TypeError: the namespace identifier has an inappropriate
type such as bool, or an iterable with more than one namespace
"""
- if includeredirects is not None:
- if includeredirects:
- if includeredirects == "only":
+ # backward compatibility test
+ if filterredir not in (True, False, None):
+ if filterredir:
+ if filterredir == 'only':
filterredir = True
else:
filterredir = None
@@ -3504,7 +3502,7 @@
"""
return self.allpages(prefix=prefix, namespace=namespace,
- includeredirects=includeredirects)
+ filterredir=includeredirects)
def alllinks(self, start="!", prefix="", namespace=0, unique=False,
fromids=False, step=None, total=None):
--
To view, visit https://gerrit.wikimedia.org/r/243115
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: interwiki: do not automatically log in
......................................................................
interwiki: do not automatically log in
For interwiki.py, self.site is not necessarily the site we will write
to, and we might want to write to different sites. Interwiki.py uses
the configured usernames to determine which sites we want to write to,
rather than -family: and -code:.
Bug: T108802
Change-Id: Iaedd4ae371ed494c9e448cbe76eb321e7633128f
(cherry picked from commit 5ce72a6d1948aaa965c3e179d61cf6b17ff3cebd)
---
M scripts/interwiki.py
1 file changed, 0 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index fa26860..f85bd3d 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -2587,7 +2587,6 @@
hintlessPageGen = pagegenerators.CombinedPageGenerator(
[hintlessPageGen, gen2])
- site.login()
bot = InterwikiBot()
if not hintlessPageGen:
--
To view, visit https://gerrit.wikimedia.org/r/243040
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaedd4ae371ed494c9e448cbe76eb321e7633128f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: interwiki.py: check for category before emptiness
......................................................................
interwiki.py: check for category before emptiness
Currently, page.isEmpty() requires parsing the whole page and doing some
removals (langlinks and categories) which takes up significant CPU time.
There are 2 checks which use page.isEmpty() as the starting condition
while having a much simpler second condition of just checking the page
namespace.
In this patch, I reversed the checks order. For categories, the time
taken in batchLoaded() is reduced to about 30% of the original time.
Change-Id: I00375411ca15658c22ae6bdb49588ec9f03b8c69
(cherry picked from commit 330ebe54492c9cf7c787a3c272872d778ba34fab)
---
M scripts/interwiki.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Malafaya: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index fa26860..ca83ff4 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1364,7 +1364,7 @@
# must be behind the page.isRedirectPage() part
# otherwise a redirect error would be raised
- elif page.isEmpty() and not page.isCategory():
+ elif not page.isCategory() and page.isEmpty():
globalvar.remove.append(unicode(page))
if not globalvar.quiet:
pywikibot.output(u"NOTE: %s is empty. Skipping." % page)
@@ -1449,7 +1449,7 @@
pywikibot.output(u'File autonomous_problems.dat open or corrupted! Try again with -restore.')
sys.exit()
iw = ()
- elif page.isEmpty() and not page.isCategory():
+ elif not page.isCategory() and page.isEmpty():
globalvar.remove.append(unicode(page))
if not globalvar.quiet:
pywikibot.output(u"NOTE: %s is empty; ignoring it and its interwiki links"
--
To view, visit https://gerrit.wikimedia.org/r/243049
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I00375411ca15658c22ae6bdb49588ec9f03b8c69
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Malafaya <malafaya(a)clix.pt>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Performance fix for sites using interwiki_putfirst option
......................................................................
Performance fix for sites using interwiki_putfirst option
Bug: T109077
Change-Id: I97e8ecf44c3e8099113068c343f35af94bc02e84
(cherry picked from commit d3f9b7f0c2165b562d35b0da04fe9dd48a45b9fa)
---
M pywikibot/textlib.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
Malafaya: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index a1d2c55..b40aba4 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -714,8 +714,9 @@
if putfirst:
# In this case I might have to change the order
firstsites = []
+ validlanglinks = insite.validLanguageLinks()
for code in putfirst:
- if code in insite.validLanguageLinks():
+ if code in validlanglinks:
site = insite.getSite(code=code)
if site in sites:
del sites[sites.index(site)]
--
To view, visit https://gerrit.wikimedia.org/r/243114
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I97e8ecf44c3e8099113068c343f35af94bc02e84
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Malafaya <malafaya(a)clix.pt>
Gerrit-Reviewer: jenkins-bot <>