jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/435695 )
Change subject: [IMPR] Resolve noqa without rules specified ......................................................................
[IMPR] Resolve noqa without rules specified
- fix D400 and fill noqa id where missing
+ also remove unnecessary noqa (either specified in tox.ini or checks were removed completely from framework)
Change-Id: Ie0e56170e5a48c7ad83035273bc35c8ceab0f717 --- M pwb.py M pywikibot/exceptions.py M pywikibot/logging.py M pywikibot/page.py M pywikibot/tools/djvu.py M scripts/interwiki.py M tests/utils.py M tests/weblinkchecker_tests.py 8 files changed, 47 insertions(+), 47 deletions(-)
Approvals: Zhuyifei1999: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index 4299842..325ba4b 100755 --- a/pwb.py +++ b/pwb.py @@ -72,7 +72,7 @@ except RuntimeError: remove_modules() os.environ['PYWIKIBOT2_NO_USER_CONFIG'] = '2' - import pywikibot # noqa: E402 + import pywikibot pwb = pywikibot
@@ -199,7 +199,7 @@ 'scripts.maintenance', 'scripts.archive', 'scripts.userscripts'] - from pywikibot import config # noqa: E402 + from pywikibot import config if config.user_script_paths: if isinstance(config.user_script_paths, (tuple, list)): script_paths = config.user_script_paths + script_paths diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py index 9d93dbd..f8cb2fd 100644 --- a/pywikibot/exceptions.py +++ b/pywikibot/exceptions.py @@ -118,9 +118,9 @@ pass
-class Error(UnicodeMixin, Exception): # noqa +class Error(UnicodeMixin, Exception):
- """Pywikibot error""" + """Pywikibot error."""
# NOTE: UnicodeMixin must be the first object Error class is derived from. def __init__(self, arg): @@ -174,9 +174,9 @@ return self.page
-class PageSaveRelatedError(PageRelatedError): # noqa +class PageSaveRelatedError(PageRelatedError):
- """Saving the page has failed""" + """Saving the page has failed."""
message = u"Page %s was not saved."
@@ -218,9 +218,9 @@ pass
-class NoPage(PageRelatedError): # noqa +class NoPage(PageRelatedError):
- """Page does not exist""" + """Page does not exist."""
message = u"Page %s doesn't exist."
@@ -270,9 +270,9 @@ super(InconsistentTitleReceived, self).__init__(page)
-class SiteDefinitionError(Error): # noqa +class SiteDefinitionError(Error):
- """Site does not exist""" + """Site does not exist."""
pass
@@ -283,16 +283,16 @@ NoSuchSite = SiteDefinitionError
-class UnknownSite(SiteDefinitionError): # noqa +class UnknownSite(SiteDefinitionError):
- """Site does not exist in Family""" + """Site does not exist in Family."""
pass
-class UnknownFamily(SiteDefinitionError): # noqa +class UnknownFamily(SiteDefinitionError):
- """Family is not registered""" + """Family is not registered."""
pass
@@ -304,18 +304,18 @@ pass
-class IsRedirectPage(PageRelatedError): # noqa +class IsRedirectPage(PageRelatedError):
- """Page is a redirect page""" + """Page is a redirect page."""
message = u"Page %s is a redirect page."
pass
-class IsNotRedirectPage(PageRelatedError): # noqa +class IsNotRedirectPage(PageRelatedError):
- """Page is not a redirect page""" + """Page is not a redirect page."""
message = u"Page %s is not a redirect page."
@@ -359,43 +359,43 @@ super(InterwikiRedirectPage, self).__init__(page)
-class InvalidTitle(Error): # noqa +class InvalidTitle(Error):
- """Invalid page title""" + """Invalid page title."""
pass
-class LockedPage(PageSaveRelatedError): # noqa +class LockedPage(PageSaveRelatedError):
- """Page is locked""" + """Page is locked."""
message = u"Page %s is locked."
pass
-class LockedNoPage(LockedPage): # noqa +class LockedNoPage(LockedPage):
- """Title is locked against creation""" + """Title is locked against creation."""
message = u"Page %s does not exist and is locked preventing creation."
pass
-class CascadeLockedPage(LockedPage): # noqa +class CascadeLockedPage(LockedPage):
- """Page is locked due to cascading protection""" + """Page is locked due to cascading protection."""
message = u"Page %s is locked due to cascading protection."
pass
-class SectionError(Error): # noqa +class SectionError(Error):
- """The section specified by # does not exist""" + """The section specified by # does not exist."""
pass
@@ -412,27 +412,27 @@ pass
-class EditConflict(PageSaveRelatedError): # noqa +class EditConflict(PageSaveRelatedError):
- """There has been an edit conflict while uploading the page""" + """There has been an edit conflict while uploading the page."""
message = u"Page %s could not be saved due to an edit conflict"
pass
-class PageDeletedConflict(EditConflict): # noqa +class PageDeletedConflict(EditConflict):
- """Page was deleted since being retrieved""" + """Page was deleted since being retrieved."""
message = u"Page %s has been deleted since last retrieved."
pass
-class PageCreatedConflict(EditConflict): # noqa +class PageCreatedConflict(EditConflict):
- """Page was created by another user""" + """Page was created by another user."""
message = u"Page %s has been created since last retrieved."
@@ -471,9 +471,9 @@ pass
-class ServerError(Error): # noqa +class ServerError(Error):
- """Got unexpected server response""" + """Got unexpected server response."""
pass
@@ -485,9 +485,9 @@ pass
-class Server504Error(ServerError): # noqa +class Server504Error(ServerError):
- """Server timed out with HTTP 504 code""" + """Server timed out with HTTP 504 code."""
pass
@@ -509,9 +509,9 @@ # UserBlocked exceptions should in general not be caught. If the bot has # been blocked, the bot operator should address the reason for the block # before continuing. -class UserBlocked(Error): # noqa +class UserBlocked(Error):
- """Your username or IP has been blocked""" + """Your username or IP has been blocked."""
pass
diff --git a/pywikibot/logging.py b/pywikibot/logging.py index fe66905..776bb4e 100644 --- a/pywikibot/logging.py +++ b/pywikibot/logging.py @@ -135,7 +135,7 @@ log message to include an exception traceback. """ if toStdout: # maintained for backwards-compatibity only - from pywikibot.tools import issue_deprecation_warning # noqa + from pywikibot.tools import issue_deprecation_warning issue_deprecation_warning('"toStdout" parameter', 'pywikibot.stdout()', 2) logoutput(text, decoder, newline, STDOUT, **kwargs) diff --git a/pywikibot/page.py b/pywikibot/page.py index a132194..f379381 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1317,7 +1317,7 @@ % (family, self.site.lang)) # cc depends on page directly and via several other imports from pywikibot.cosmetic_changes import ( - CANCEL_MATCH, CosmeticChangesToolkit) # noqa + CANCEL_MATCH, CosmeticChangesToolkit) ccToolkit = CosmeticChangesToolkit(self.site, namespace=self.namespace(), pageTitle=self.title(), diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py index 7f88894..b75a83e 100644 --- a/pywikibot/tools/djvu.py +++ b/pywikibot/tools/djvu.py @@ -122,7 +122,7 @@ """Deprecated file_djvu instance variable.""" return self.file
- def check_cache(fn): # noqa: N805 + def check_cache(fn): """Decorator to check if cache shall be cleared.""" cache = ['_page_count', '_has_text', '_page_info']
@@ -135,7 +135,7 @@ return _res return wrapper
- def check_page_number(fn): # noqa: N805 + def check_page_number(fn): """Decorator to check if page number is valid.
@raises ValueError diff --git a/scripts/interwiki.py b/scripts/interwiki.py index 36d08fa..75a4a77 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -380,7 +380,7 @@ """An attempt to save a page with changed interwiki has failed."""
-class LinkMustBeRemoved(SaveError): # noqa +class LinkMustBeRemoved(SaveError): # noqa: D205,D400
""" An interwiki link has to be removed, but this can't be done because of user diff --git a/tests/utils.py b/tests/utils.py index 0fa75ee..00133dd 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -36,7 +36,7 @@ if not PY2: import six else: - ResourceWarning = None # flake8: F821 + ResourceWarning = None
OSWIN32 = (sys.platform == 'win32') diff --git a/tests/weblinkchecker_tests.py b/tests/weblinkchecker_tests.py index d04bd6c..94c5cf6 100644 --- a/tests/weblinkchecker_tests.py +++ b/tests/weblinkchecker_tests.py @@ -29,7 +29,7 @@
def _get_archive_url(self, url, date_string=None): from memento_client.memento_client import \ - MementoClientException # noqa: E402 + MementoClientException
if date_string is None: when = datetime.datetime.now()
pywikibot-commits@lists.wikimedia.org