jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655868 )
Change subject: [cleanup] remove Page methods deprecated for 6 years
......................................................................
[cleanup] remove Page methods deprecated for 6 years
Remove deprecated methods and properties:
- latestRevision
- pageAPInfo
- previous_revision_id
- previousRevision
- isEmpty()
- isFlowPage
Change-Id: I264235b21a97748ed363436a25a061b2108318dd
---
M pywikibot/page/__init__.py
M tests/page_tests.py
2 files changed, 3 insertions(+), 60 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index b4d259f..3dc9015 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -11,7 +11,7 @@
"""
#
-# (C) Pywikibot team, 2008-2020
+# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
@@ -581,18 +581,6 @@
del self.latest_revision_id
self._revid = value
- @deprecated('latest_revision_id', since='20150727',
future_warning=True)
- def latestRevision(self): # pragma: no cover
- """Return the current revision id for this
page."""
- return self.latest_revision_id
-
- @deprecated('latest_revision_id', since='20150407',
future_warning=True)
- def pageAPInfo(self): # pragma: no cover
- """Return the current revision id for this
page."""
- if self.isRedirectPage():
- raise pywikibot.IsRedirectPage(self)
- return self.latest_revision_id
-
@property
def latest_revision(self):
"""Return the current revision for this page."""
@@ -740,27 +728,6 @@
"""
return self.latest_revision.timestamp
- @property
- @deprecated('latest_revision.parent_id (0 instead of -1 when no parent)',
- since='20150609', future_warning=True)
- def previous_revision_id(self) -> int: # pragma: no cover
- """
- Return the revision id for the previous revision of this Page.
-
- If the page has only one revision, it shall return -1.
- """
- return self.latest_revision.parent_id or -1
-
- @deprecated('latest_revision.parent_id (0 instead of -1 when no parent)',
- since='20150609', future_warning=True)
- def previousRevision(self) -> int: # pragma: no cover
- """
- Return the revision id for the previous revision.
-
- DEPRECATED: Use latest_revision.parent_id instead.
- """
- return self.latest_revision.parent_id or -1
-
def exists(self) -> bool:
"""Return True if page exists on the wiki, even if it's a
redirect.
@@ -837,19 +804,6 @@
return Category(Link(self._catredirect, self.site))
raise pywikibot.IsNotRedirectPage(self)
- @deprecated(since='20151207', future_warning=True)
- def isEmpty(self) -> bool: # pragma: no cover
- """
- Return True if the page text has less than 4 characters.
-
- Character count ignores language links and category links.
- Can raise the same exceptions as get().
- """
- txt = self.get()
- txt = textlib.removeLanguageLinks(txt, site=self.site)
- txt = textlib.removeCategoryLinks(txt, site=self.site)
- return len(txt) < 4
-
def isTalkPage(self):
"""Return True if this page is in any talk
namespace."""
ns = self.namespace()
@@ -2095,11 +2049,6 @@
'required.' % self.title(as_link=True))
return False
- @deprecated('Page.is_flow_page()', since='20150128',
future_warning=True)
- def isFlowPage(self): # pragma: no cover
- """DEPRECATED: use self.is_flow_page instead."""
- return self.is_flow_page()
-
def is_flow_page(self) -> bool:
"""Whether a page is a Flow page."""
return self.content_model == 'flow-board'
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 1bc7743..b98782b 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -1,7 +1,6 @@
-# -*- coding: utf-8 -*-
"""Tests for the page module."""
#
-# (C) Pywikibot team, 2008-2020
+# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
@@ -14,7 +13,6 @@
import pywikibot.page
from pywikibot import config, InvalidTitle
-from pywikibot.tools import suppress_warnings
from tests.aspects import (
DefaultDrySiteTestCase, DefaultSiteTestCase, SiteAttributeTestCase,
@@ -442,11 +440,7 @@
# since there is no way to predict what data the wiki will return,
# we only check that the returned objects are of correct type.
self.assertIsInstance(mainpage.get(), str)
- with suppress_warnings(
- r'pywikibot\.page\.BasePage\.latestRevision '
- r'is deprecated[\s\w]+; '
- r'use latest_revision_id instead\.'):
- self.assertIsInstance(mainpage.latestRevision(), int)
+ self.assertIsInstance(mainpage.latest_revision_id, int)
self.assertIsInstance(mainpage.userName(), str)
self.assertIsInstance(mainpage.isIpEdit(), bool)
self.assertIsInstance(mainpage.exists(), bool)
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655868
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I264235b21a97748ed363436a25a061b2108318dd
Gerrit-Change-Number: 655868
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged