jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/435646 )
Change subject: [doc] Update Site.loadrevisions doc string
......................................................................
[doc] Update Site.loadrevisions doc string
Bug: T195650
Change-Id: I86ed54fbf5f45a926b92af42ba9c5bba27e18aee
---
M pywikibot/site.py
1 file changed, 6 insertions(+), 4 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 6e847c4..fe86d69 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3981,7 +3981,7 @@
endtime=None, rvdir=None, user=None, excludeuser=None,
section=None, sysop=False, step=None, total=None,
rollback=False):
- """Retrieve and store revision information.
+ """Retrieve revision information and store it in page object.
By default, retrieves the last (current) revision of the page,
unless any of the optional parameters revids, startid, endid,
@@ -3993,8 +3993,8 @@
endid if both are specified; likewise, starttime must be greater
than endtime. If rvdir is True, these relationships are reversed.
- @param page: retrieve revisions of this Page (required unless ids
- is specified)
+ @param page: retrieve revisions of this Page and hold the data.
+ @type page: pywikibot.Page
@param content: if True, retrieve the wiki-text of each revision;
otherwise, only retrieve the revision metadata (default)
@type content: bool
@@ -4003,7 +4003,7 @@
the article is section 0), not name
@type section: int
@param revids: retrieve only the specified revision ids (raise
- Exception if any of revids does not correspond to page
+ Exception if any of revids does not correspond to page)
@type revids: an int, a str or a list of ints or strings
@param startid: retrieve revisions starting with this revid
@param endid: stop upon retrieving this revid
@@ -4015,6 +4015,8 @@
@param excludeuser: retrieve all revisions not authored by this user
@param sysop: if True, switch to sysop account (if available) to
retrieve this page
+ @raises ValueError: invalid startid/endid or starttime/endtime values
+ @raises pywikibot.Error: revids belonging to a different page
"""
latest = (revids is None and
startid is None and
--
To view, visit https://gerrit.wikimedia.org/r/435646
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I86ed54fbf5f45a926b92af42ba9c5bba27e18aee
Gerrit-Change-Number: 435646
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Urbanecm <martin.urbanec(a)wikimedia.cz>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/435627 )
Change subject: generate_family_file.py: Add __future__ import line to generated family file
......................................................................
generate_family_file.py: Add __future__ import line to generated family file
Also fix other minor stylistic issues detected by flake8.
Change-Id: I804422ab7aa7e5732d72fb49b6aa4a419ca79f45
---
M generate_family_file.py
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_family_file.py b/generate_family_file.py
index a93ff05..b57d1da 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -141,19 +141,22 @@
f.write("""
# -*- coding: utf-8 -*-
\"\"\"
-This family file was auto-generated by $Id$
+This family file was auto-generated by generate_family_file.py script.
+
Configuration parameters:
url = %(url)s
name = %(name)s
Please do not commit this to the Git repository!
\"\"\"
+from __future__ import absolute_import, unicode_literals
from pywikibot import family
from pywikibot.tools import deprecated
-class Family(family.Family):
+class Family(family.Family): # noqa: D101
+
name = '%(name)s'
langs = {
""".lstrip() % {'url': self.base_url, 'name': self.name})
--
To view, visit https://gerrit.wikimedia.org/r/435627
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I804422ab7aa7e5732d72fb49b6aa4a419ca79f45
Gerrit-Change-Number: 435627
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/434866 )
Change subject: Fix N806 errors within for loops
......................................................................
Fix N806 errors within for loops
These errors will be detected with the next release of pep-naming. Better
to fix them now, before they break the tests.
Change-Id: I35b64f4782a6c9d0d2309ad981bba709a958efeb
---
M scripts/followlive.py
M scripts/login.py
M scripts/makecat.py
M tests/date_tests.py
4 files changed, 12 insertions(+), 12 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/followlive.py b/scripts/followlive.py
index 488c6ec..5f7e3a2 100644
--- a/scripts/followlive.py
+++ b/scripts/followlive.py
@@ -527,9 +527,9 @@
def run(self):
"""Process all pages in generator."""
- for (page, date, length, loggedIn, username,
+ for (page, date, length, logged_in, username,
comment) in self.site.newpages():
- self.handle_page(page, date, length, loggedIn, username)
+ self.handle_page(page, date, length, logged_in, username)
def main(*args):
diff --git a/scripts/login.py b/scripts/login.py
index 0868cce..ece0701 100755
--- a/scripts/login.py
+++ b/scripts/login.py
@@ -166,10 +166,10 @@
else:
site = pywikibot.Site()
namedict = {site.family.name: {site.code: None}}
- for familyName in namedict:
- for lang in namedict[familyName]:
+ for family_name in namedict:
+ for lang in namedict[family_name]:
try:
- site = pywikibot.Site(code=lang, fam=familyName)
+ site = pywikibot.Site(code=lang, fam=family_name)
if oauth:
_oauth_login(site)
continue
@@ -189,7 +189,7 @@
'Not logged in on {0}.'.format(site))
except SiteDefinitionError:
pywikibot.output(u'%s.%s is not a valid site, please remove it'
- u' from your config' % (lang, familyName))
+ ' from your config' % (lang, family_name))
if __name__ == "__main__":
diff --git a/scripts/makecat.py b/scripts/makecat.py
index 4f2e867..14f7997 100755
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -100,10 +100,10 @@
tocheck.append(page2)
checked[page2] = page2
if checkbackward:
- for refPage in pl.getReferences():
- if needcheck(refPage):
- tocheck.append(refPage)
- checked[refPage] = refPage
+ for ref_page in pl.getReferences():
+ if needcheck(ref_page):
+ tocheck.append(ref_page)
+ checked[ref_page] = ref_page
def asktoadd(pl, summary):
diff --git a/tests/date_tests.py b/tests/date_tests.py
index 7b01951..672649b 100644
--- a/tests/date_tests.py
+++ b/tests/date_tests.py
@@ -33,14 +33,14 @@
except KeyError:
return
- for code, convFunc in date.formats[formatname].items():
+ for code, convert in date.formats[formatname].items():
for value in range(start, stop, step):
self.assertTrue(
predicate(value),
"date.formats['%s']['%s']:\ninvalid value %d"
% (formatname, code, value))
- new_value = convFunc(convFunc(value))
+ new_value = convert(convert(value))
self.assertEqual(
new_value, value,
"date.formats['%s']['%s']:\n"
--
To view, visit https://gerrit.wikimedia.org/r/434866
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I35b64f4782a6c9d0d2309ad981bba709a958efeb
Gerrit-Change-Number: 434866
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/434822 )
Change subject: djvu.py: Fix parsing and page deletion checks
......................................................................
djvu.py: Fix parsing and page deletion checks
If only one page is present, _get_page_info() was swapping the key, id
pair:
- key, id = '', 1 needs to be swapped.
Checks after page deletion need to be fixed when file is left with one
page only:
- assertion needs to consider that key = ''
- number of pages before deletion n_tot is > 2 if files have more than
one page after deletion.
Bug: T195426
Change-Id: I319ad685a878b4e241a324ea7226a4ad44d119ad
---
M pywikibot/tools/djvu.py
1 file changed, 11 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index 8ad7fba..7f4e66e 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -202,7 +202,9 @@
if m:
key, id = int(m.group('n')), m.group('id')
else:
- key, id = '', 1
+ # If djvu doc has only one page,
+ # FORM:DJVU line in djvudump has no id
+ key, id = 1, ''
if 'INFO' in line:
m = self._pat_info.search(line)
@@ -332,9 +334,14 @@
# Check if page processing is as expected.
# ref page info.
- assert self.page_info(new_ref_page, force=True) == info_ref_page
- if n_tot > 1:
- assert self.number_of_images() == n_tot - 1
+ if n_tot > 2:
+ assert self.number_of_images(force=True) == n_tot - 1
+ # cahce cleared above
+ assert self.page_info(new_ref_page) == info_ref_page
+ else:
+ # If djvu has only one page, FORM:DJVU line in djvudump has no id
+ _id, (sz, dpi) = info_ref_page
+ assert self.page_info(new_ref_page, force=True) == ('', (sz, dpi))
return True
--
To view, visit https://gerrit.wikimedia.org/r/434822
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I319ad685a878b4e241a324ea7226a4ad44d119ad
Gerrit-Change-Number: 434822
Gerrit-PatchSet: 3
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>