jenkins-bot submitted this change.

View Change

Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
[cleanup] Suffix exceptions with 'Error'

Exceptions should have an 'Error' suffix according to PEP8 [1]. Such a
bulk rename necessitates touching most files so I took this opportunity
to do some standardization as I went...

* All pywikibot.exception classes are now referenced through its module
rather than a 'pywikibot.MyError' alias. Our codebase used both, so
this deprecates the aliases per PEP20's 'there should be one way to do
it'.

* All exceptions should subclass 'pywikibot.exception.Error'. This fixes the
three instances where we didn't...

pywikibot.interwiki_graph.GraphImpossibleError
pywikibot.version.ParseError
pywikibot.bot.UnhandledAnswerError

* Most module exceptions are located in pywikibot.exceptions. Moved
exceptions include...

pywikibot.bot.UnhandledAnswer
pywikibot.data.api.APIError
pywikibot.data.api.APIMWException
pywikibot.data.api.UploadWarning
pywikibot.i18n.TranslationError
pywikibot.interwiki_graph.GraphImpossible
pywikibot.site.PageInUse (aliased from _basesite)
pywikibot.version.ParseError

I could not move the following because it subclasses StandardOption, which
produced a circular dependency...

pywikibot.bot_choice.ChoiceException
pywikibot.bot_choice.QuitKeyboardInterrupt

* Deprecating OAuthImpossible and GraphImpossible in favor of simply raising
an ImportError.

[1] https://www.python.org/dev/peps/pep-0008/#exception-names

Bug: T280227
Change-Id: If9c57924395f205f54e7adafed027c2e300f916b
---
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/comms/http.py
M pywikibot/cosmetic_changes.py
M pywikibot/data/api.py
M pywikibot/diff.py
M pywikibot/exceptions.py
M pywikibot/family.py
M pywikibot/flow.py
M pywikibot/i18n.py
M pywikibot/interwiki_graph.py
M pywikibot/login.py
M pywikibot/page/__init__.py
M pywikibot/page/_decorators.py
M pywikibot/pagegenerators.py
M pywikibot/proofreadpage.py
M pywikibot/site/__init__.py
M pywikibot/site/_apisite.py
M pywikibot/site/_basesite.py
M pywikibot/site/_datasite.py
M pywikibot/site/_decorators.py
M pywikibot/site/_extensions.py
M pywikibot/site/_generators.py
M pywikibot/site/_obsoletesites.py
M pywikibot/site/_siteinfo.py
M pywikibot/site_detect.py
M pywikibot/specialbots/__init__.py
M pywikibot/specialbots/_unlink.py
M pywikibot/specialbots/_upload.py
M pywikibot/textlib.py
M pywikibot/throttle.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/version.py
M scripts/add_text.py
M scripts/archive/blockpageschecker.py
M scripts/archive/capitalize_redirects.py
M scripts/archive/casechecker.py
M scripts/archive/catall.py
M scripts/archive/commons_link.py
M scripts/archive/create_categories.py
M scripts/archive/data_ingestion.py
M scripts/archive/disambredir.py
M scripts/archive/editarticle.py
M scripts/archive/flickrripper.py
M scripts/archive/followlive.py
M scripts/archive/imagecopy.py
M scripts/archive/imagecopy_self.py
M scripts/archive/imageharvest.py
M scripts/archive/imageuncat.py
M scripts/archive/isbn.py
M scripts/archive/lonelypages.py
M scripts/archive/makecat.py
M scripts/archive/ndashredir.py
M scripts/archive/piper.py
M scripts/archive/spamremove.py
M scripts/archive/standardize_interwiki.py
M scripts/archive/states_redirect.py
M scripts/archive/surnames_redirects.py
M scripts/archive/table2wiki.py
M scripts/archive/unlink.py
M scripts/archive/wikisourcetext.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/category.py
M scripts/category_redirect.py
M scripts/checkimages.py
M scripts/clean_sandbox.py
M scripts/commons_information.py
M scripts/coordinate_import.py
M scripts/cosmetic_changes.py
M scripts/djvutext.py
M scripts/fixing_redirects.py
M scripts/harvest_template.py
M scripts/imagetransfer.py
M scripts/interwiki.py
M scripts/interwikidata.py
M scripts/listpages.py
M scripts/login.py
M scripts/maintenance/colors.py
M scripts/maintenance/preload_sites.py
M scripts/maintenance/sorting_order.py
M scripts/maintenance/update_linktrails.py
M scripts/movepages.py
M scripts/newitem.py
M scripts/noreferences.py
M scripts/nowcommons.py
M scripts/protect.py
M scripts/redirect.py
M scripts/reflinks.py
M scripts/replace.py
M scripts/replicate_wiki.py
M scripts/revertbot.py
M scripts/solve_disambiguation.py
M scripts/speedy_delete.py
M scripts/touch.py
M scripts/transferbot.py
M scripts/unusedfiles.py
M scripts/upload.py
M scripts/watchlist.py
M scripts/weblinkchecker.py
M scripts/welcome.py
M tests/api_tests.py
M tests/archivebot_tests.py
M tests/aspects.py
M tests/basesite_tests.py
M tests/bot_tests.py
M tests/category_bot_tests.py
M tests/category_tests.py
M tests/collections_tests.py
M tests/deprecation_tests.py
M tests/dry_api_tests.py
M tests/edit_failure_tests.py
M tests/edit_tests.py
M tests/eventstreams_tests.py
M tests/family_tests.py
M tests/file_tests.py
M tests/flow_edit_tests.py
M tests/flow_tests.py
M tests/http_tests.py
M tests/i18n_tests.py
M tests/interwiki_link_tests.py
M tests/l10n_tests.py
M tests/link_tests.py
M tests/logentries_tests.py
M tests/login_tests.py
M tests/oauth_tests.py
M tests/page_tests.py
M tests/pagegenerators_tests.py
M tests/paraminfo_tests.py
M tests/proofreadpage_tests.py
M tests/replacebot_tests.py
M tests/script_tests.py
M tests/site_decorators_tests.py
M tests/site_tests.py
M tests/tests_tests.py
M tests/textlib_tests.py
M tests/timestripper_tests.py
M tests/token_tests.py
M tests/ui_options_tests.py
M tests/ui_tests.py
M tests/user_tests.py
M tests/utils.py
M tests/wikibase_tests.py
143 files changed, 1,714 insertions(+), 1,079 deletions(-)


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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If9c57924395f205f54e7adafed027c2e300f916b
Gerrit-Change-Number: 682277
Gerrit-PatchSet: 7
Gerrit-Owner: Damian <atagar1@gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Isaacandy <isaac@iznd.xyz>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia@gmail.com>
Gerrit-Reviewer: Siebrand <siebrand@kitano.nl>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Xqt <info@gno.de>
Gerrit-MessageType: merged