jenkins-bot submitted this change.

View Change

Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
[cleanup] Remove NoSuchSite an PageNotSaved exceptions

- NoSuchSite an PageNotSaved exceptions aren't used by the framework.
They were introduced for backward compatibility. Unfortunately
exceptions cannot be deprecated with Python 3. Remove them after
this long time.
- update imports
- update doc

Change-Id: I113ce7884dff64525fa0e0663f69403c5a2db157
---
M pywikibot/__init__.py
M pywikibot/exceptions.py
2 files changed, 23 insertions(+), 47 deletions(-)

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 4948bf2..d3c194a 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -38,13 +38,12 @@
CaptchaError, CascadeLockedPage, CircularRedirect,
CoordinateGlobeUnknownException, EditConflict, Error, FatalServerError,
InterwikiRedirectPage, InvalidTitle, IsNotRedirectPage, IsRedirectPage,
- LockedNoPage, LockedPage, NoCreateError, NoMoveTarget, NoPage, NoSuchSite,
+ LockedNoPage, LockedPage, NoCreateError, NoMoveTarget, NoPage,
NoUsername, NoWikibaseEntity, OtherPageSaveError, PageCreatedConflict,
- PageDeletedConflict, PageNotSaved, PageRelatedError, PageSaveRelatedError,
- SectionError, Server414Error, Server504Error, ServerError,
- SiteDefinitionError, SpamblacklistError, TitleblacklistError,
- UnknownExtension, UnknownFamily, UnknownSite, UnsupportedPage,
- WikiBaseError,
+ PageDeletedConflict, PageRelatedError, PageSaveRelatedError, SectionError,
+ Server414Error, Server504Error, ServerError, SiteDefinitionError,
+ SpamblacklistError, TitleblacklistError, UnknownExtension, UnknownFamily,
+ UnknownSite, UnsupportedPage, WikiBaseError,
)
from pywikibot.family import AutoFamily, Family
from pywikibot.i18n import translate
@@ -70,21 +69,20 @@
'Category', 'CircularRedirect', 'Claim', 'config', 'Coordinate',
'CoordinateGlobeUnknownException', 'critical', 'CurrentPageBot', 'debug',
'EditConflict', 'error', 'Error', 'exception', 'FatalServerError',
- 'FilePage', 'handle_args', 'html2unicode', 'input',
- 'input_choice', 'input_yn', 'InterwikiRedirectPage', 'InvalidTitle',
- 'IsNotRedirectPage', 'IsRedirectPage', 'ItemPage', 'Link', 'LockedNoPage',
- 'LockedPage', 'log', 'NoCreateError', 'NoMoveTarget', 'NoPage',
- 'NoSuchSite', 'NoUsername', 'NoWikibaseEntity', 'OtherPageSaveError',
- 'output', 'Page', 'PageCreatedConflict', 'PageDeletedConflict',
- 'PageNotSaved', 'PageRelatedError', 'PageSaveRelatedError', 'PropertyPage',
- '_QuitKeyboardInterrupt', 'SectionError', 'Server414Error',
- 'Server504Error', 'ServerError', 'showDiff', 'show_help',
- 'Site', 'SiteDefinitionError', 'SiteLink', 'SpamblacklistError', 'stdout',
- 'Timestamp', 'TitleblacklistError', 'translate', 'ui', 'unicode2html',
- 'UnknownExtension', 'UnknownFamily', 'UnknownSite', 'UnsupportedPage',
- 'UploadWarning', 'url2unicode', 'User', 'warning', 'WbGeoShape',
- 'WbMonolingualText', 'WbQuantity', 'WbTabularData', 'WbTime', 'WbUnknown',
- 'WikiBaseError', 'WikidataBot',
+ 'FilePage', 'handle_args', 'html2unicode', 'input', 'input_choice',
+ 'input_yn', 'InterwikiRedirectPage', 'InvalidTitle', 'IsNotRedirectPage',
+ 'IsRedirectPage', 'ItemPage', 'Link', 'LockedNoPage', 'LockedPage', 'log',
+ 'NoCreateError', 'NoMoveTarget', 'NoPage', 'NoUsername',
+ 'NoWikibaseEntity', 'OtherPageSaveError', 'output', 'Page',
+ 'PageCreatedConflict', 'PageDeletedConflict', 'PageRelatedError',
+ 'PageSaveRelatedError', 'PropertyPage', '_QuitKeyboardInterrupt',
+ 'SectionError', 'Server414Error', 'Server504Error', 'ServerError',
+ 'showDiff', 'show_help', 'Site', 'SiteDefinitionError', 'SiteLink',
+ 'SpamblacklistError', 'stdout', 'Timestamp', 'TitleblacklistError',
+ 'translate', 'ui', 'unicode2html', 'UnknownExtension', 'UnknownFamily',
+ 'UnknownSite', 'UnsupportedPage', 'UploadWarning', 'url2unicode', 'User',
+ 'warning', 'WbGeoShape', 'WbMonolingualText', 'WbQuantity',
+ 'WbTabularData', 'WbTime', 'WbUnknown', 'WikiBaseError', 'WikidataBot',
)


diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 2a57ecc..4eeca42 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -8,9 +8,9 @@
- UserRightsError: insufficient rights for requested action
- InvalidTitle: Invalid page title
- CaptchaError: Captcha is asked and config.solve_captcha == False
- - Server504Error: Server timed out with HTTP 504 code
- i18n.TranslationError: i18n/l10n message not available
- UnknownExtension: Extension is not defined for this site
+ - SectionError: The section specified by # does not exist

SiteDefinitionError: Site loading problem

@@ -25,7 +25,6 @@
- IsNotRedirectPage: Page is not a redirect page
- CircularRedirect: Page is a circular redirect
- InterwikiRedirectPage: Page is a redirect to another site
- - SectionError: The section specified by # does not exist
- NotEmailableError: The target user has disabled email
- NoMoveTarget: An expected move target page does not exist

@@ -33,7 +32,6 @@
- InconsistentTitleReceived: Page receives a title inconsistent with query

PageSaveRelatedError: page exceptions within the save operation on a Page
-(alias: PageNotSaved).

- SpamblacklistError: MediaWiki spam filter detected a blacklisted URL
- TitleblacklistError: MediaWiki detected a blacklisted page title
@@ -50,6 +48,8 @@
ServerError: a problem with the server.

- FatalServerError: A fatal/non-recoverable server error
+ - Server414Error: Server timed out with HTTP 414 code
+ - Server504Error: Server timed out with HTTP 504 code

WikiBaseError: any issue specific to Wikibase.

@@ -80,7 +80,7 @@
- FamilyMaintenanceWarning: missing information in family definition
"""
#
-# (C) Pywikibot team, 2008-2020
+# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
@@ -168,15 +168,6 @@

message = 'Page %s was not saved.'

- # This property maintains backwards compatibility with
- # the old PageNotSaved which inherited from Error
- # (not PageRelatedError) and exposed the normal 'args'
- # which could be printed
- @property
- def args(self):
- """Expose args."""
- return str(self)
-

class OtherPageSaveError(PageSaveRelatedError):

@@ -211,8 +202,6 @@

message = "Page %s doesn't exist."

- pass
-

class UnsupportedPage(PageRelatedError):

@@ -259,12 +248,6 @@
pass


-# The name 'NoSuchSite' was used for all site related issues,
-# and it used message "Site does not exist".
-# These are retain for backwards compatibility with scripts.
-NoSuchSite = SiteDefinitionError
-
-
class UnknownSite(SiteDefinitionError):

"""Site does not exist in Family."""
@@ -372,9 +355,6 @@
pass


-PageNotSaved = PageSaveRelatedError
-
-
class NoCreateError(PageSaveRelatedError):

"""Parameter nocreate doesn't allow page creation."""
@@ -498,8 +478,6 @@

message = '%s is not emailable.'

- pass
-

class WikiBaseError(Error):


To view, visit change 676658. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I113ce7884dff64525fa0e0663f69403c5a2db157
Gerrit-Change-Number: 676658
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged