jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Remove _imageinfo usage
......................................................................
[FIX] Remove _imageinfo usage
With d298facc _imageinfo has been replaced by _file_revisions. This is
now remove all usage of it.
Change-Id: I01cadfc4f3c4bbd66f953c9527e85d0d0c2aa9a4
---
M pywikibot/data/api.py
M pywikibot/page.py
M pywikibot/site.py
M tests/site_tests.py
4 files changed, 11 insertions(+), 17 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 70e512b..b57a61d 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2374,10 +2374,7 @@
"""Like PageGenerator, but yields Category objects instead of Pages."""
- def result(self, pagedata):
- """Convert page dict entry from api to Page object."""
- p = PageGenerator.result(self, pagedata)
- return pywikibot.Category(p)
+ pass
@deprecated("PageGenerator")
@@ -2385,13 +2382,7 @@
"""Like PageGenerator, but yields FilePage objects instead of Pages."""
- def result(self, pagedata):
- """Convert page dict entry from api to Page object."""
- p = PageGenerator.result(self, pagedata)
- filepage = pywikibot.FilePage(p)
- if 'imageinfo' in pagedata:
- filepage._imageinfo = pagedata['imageinfo'][0]
- return filepage
+ pass
class PropertyGenerator(QueryGenerator):
@@ -2583,9 +2574,7 @@
if 'imageinfo' in pagedict:
assert(isinstance(page, pywikibot.FilePage))
- for file_rev in pagedict['imageinfo']:
- file_revision = pywikibot.page.FileInfo(file_rev)
- page._file_revisions[file_revision.timestamp] = file_revision
+ page._load_file_revisions(pagedict['imageinfo'])
if "categoryinfo" in pagedict:
page._catinfo = pagedict["categoryinfo"]
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 6da7532..0cdcbc8 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2012,6 +2012,11 @@
if self.namespace() != 6:
raise ValueError(u"'%s' is not in the file namespace!" % title)
+ def _load_file_revisions(self, imageinfo):
+ for file_rev in imageinfo:
+ file_revision = FileInfo(file_rev)
+ self._file_revisions[file_revision.timestamp] = file_revision
+
@property
def latest_file_info(self):
"""Retrieve and store information of latest Image rev. of FilePage.
diff --git a/pywikibot/site.py b/pywikibot/site.py
index fe0c4ac..fc4cd5f 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4982,7 +4982,7 @@
# If we receive a nochange, that would mean we're in simulation
# mode, don't attempt to access imageinfo
if "nochange" not in result:
- filepage._imageinfo = result["imageinfo"]
+ filepage._load_file_revisions(result["imageinfo"])
return
@deprecated_args(number="step",
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 322f1ef..6b03fde 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -595,11 +595,11 @@
for impage in mysite.allimages(minsize=100, total=5):
self.assertIsInstance(impage, pywikibot.FilePage)
self.assertTrue(mysite.page_exists(impage))
- self.assertGreaterEqual(impage._imageinfo["size"], 100)
+ self.assertGreaterEqual(impage.latest_file_info["size"], 100)
for impage in mysite.allimages(maxsize=2000, total=5):
self.assertIsInstance(impage, pywikibot.FilePage)
self.assertTrue(mysite.page_exists(impage))
- self.assertLessEqual(impage._imageinfo["size"], 2000)
+ self.assertLessEqual(impage.latest_file_info["size"], 2000)
def test_newfiles(self):
"""Test the site.newfiles() method."""
--
To view, visit https://gerrit.wikimedia.org/r/201157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I01cadfc4f3c4bbd66f953c9527e85d0d0c2aa9a4
Gerrit-PatchSet: 2
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: WikibasePage.editEntity() no longer requires python 2.7
......................................................................
WikibasePage.editEntity() no longer requires python 2.7
Or so T72707 says.
Bug: T72707
Change-Id: I936307ca3b26cee61d0fc40753fd8211a0752050
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index f8f2c47..79f90a7 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3080,10 +3080,8 @@
- ItemPage.setSitelinks
@param data: Data to be saved
- @type data: dict (must be not None for python 2.6; bug 70707)
+ @type data: dict, or None to save the current content of the entity.
"""
- assert(sys.version_info >= (2, 7) or data is not None)
-
if hasattr(self, 'lastrevid'):
baserevid = self.lastrevid
else:
--
To view, visit https://gerrit.wikimedia.org/r/200925
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I936307ca3b26cee61d0fc40753fd8211a0752050
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Nemo bis <federicoleva(a)tiscali.it>
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 <>