jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/667629 )
Change subject: [tests] Update per-file-ignores ......................................................................
[tests] Update per-file-ignores
Change-Id: Ic7c5adf92ee23a8c643d36643904643ec1718738 --- M pywikibot/data/api.py M pywikibot/data/sparql.py M pywikibot/echo.py M pywikibot/flow.py M pywikibot/logentries.py M pywikibot/userinterfaces/transliteration.py M tests/utils.py M tox.ini 8 files changed, 37 insertions(+), 63 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 65caf27..ff90b25 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -28,7 +28,7 @@
from pywikibot import config, login
-from pywikibot.backports import Tuple +from pywikibot.backports import removeprefix, Tuple from pywikibot.comms import http from pywikibot.exceptions import ( CaptchaError, Server504Error, Server414Error, FatalServerError, NoUsername, @@ -1395,18 +1395,18 @@ def _is_wikibase_error_retryable(self, error): # dict of error message and current action. # Value is True if action type is to be ignored - ERR_MSG = { + err_msg = { 'edit-already-exists': 'wbeditentity', 'actionthrottledtext': True, # T192912, T268645 } messages = error.get('messages') message = None - # bug T68619; after Wikibase breaking change 1ca9cee change we have a + # bug T68619; after Wikibase breaking change 1ca9cee we have a # list of messages if isinstance(messages, list): for item in messages: message = item['name'] - action = ERR_MSG.get(message) + action = err_msg.get(message) if action is True or action == self.action: return True else: @@ -1417,7 +1417,7 @@ message = messages['0']['name'] except KeyError: # unsure the new output is always a list message = messages['name'] - action = ERR_MSG.get(message) + action = err_msg.get(message) return action is True or action == self.action
@staticmethod @@ -1662,12 +1662,12 @@
@raises APIMWException: internal_api_error or readonly """ - IAE = 'internal_api_error_' - if not (code.startswith(IAE) or code == 'readonly'): + iae = 'internal_api_error_' + if not (code.startswith(iae) or code == 'readonly'): return False
# T154011 - class_name = code if code == 'readonly' else code[len(IAE):] + class_name = code if code == 'readonly' else removeprefix(code, iae)
del error['code'] # is added via class_name e = APIMWException(class_name, **error) diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py index 2d8740d..434a3ba 100644 --- a/pywikibot/data/sparql.py +++ b/pywikibot/data/sparql.py @@ -204,7 +204,7 @@ super().__init__(data.get('value')) self.entity_url = entity_url
- def getID(self): + def getID(self): # noqa: N802 """ Get ID of Wikibase object identified by the URI.
diff --git a/pywikibot/echo.py b/pywikibot/echo.py index 7749f59..a50ba95 100644 --- a/pywikibot/echo.py +++ b/pywikibot/echo.py @@ -18,7 +18,7 @@ self.site = site
@classmethod - def fromJSON(cls, site, data): + def fromJSON(cls, site, data): # noqa: N802 """ Construct a Notification object from JSON data returned by the API.
diff --git a/pywikibot/flow.py b/pywikibot/flow.py index 0a0319d..68ee7af 100644 --- a/pywikibot/flow.py +++ b/pywikibot/flow.py @@ -325,7 +325,7 @@ self._content = {}
@classmethod - def fromJSON(cls, page, post_uuid: str, data: dict): + def fromJSON(cls, page, post_uuid: str, data: dict): # noqa: N802 """ Create a Post object using the data returned from the API call.
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py index 09f922f..db2bf37 100644 --- a/pywikibot/logentries.py +++ b/pywikibot/logentries.py @@ -390,7 +390,7 @@ """ self._site = site if logtype is None: - self._creator = self._createFromData + self._creator = self._create_from_data else: # Bind a Class object to self._creator: # When called, it will initialize a new object of that class @@ -444,7 +444,7 @@ classname, bases, {'_expected_type': logtype}) return cls._logtypes[logtype]
- def _createFromData(self, logdata: dict): + def _create_from_data(self, logdata: dict): """ Check for logtype from data, and creates the correct LogEntry.
diff --git a/pywikibot/userinterfaces/transliteration.py b/pywikibot/userinterfaces/transliteration.py index d540394..6db5b58 100644 --- a/pywikibot/userinterfaces/transliteration.py +++ b/pywikibot/userinterfaces/transliteration.py @@ -1086,7 +1086,7 @@ }
-class transliterator: +class transliterator: # noqa: N801
"""Class to transliterating text."""
diff --git a/tests/utils.py b/tests/utils.py index 9564eb2..71c6ccf 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -425,7 +425,7 @@ _disambig = False _isredir = False
- def isDisambig(self): + def isDisambig(self): # noqa: N802 """Return disambig status stored in _disambig.""" return self._disambig
diff --git a/tox.ini b/tox.ini index fb963f5..3a7a19c 100644 --- a/tox.ini +++ b/tox.ini @@ -118,28 +118,18 @@ per-file-ignores = generate_family_file.py : T001 pwb.py : FI53, T001 - # pydocstyle cannot handle multiple __all__ variables pywikibot/__init__.py : N802, N806, N815, N816 pywikibot/_wbtypes.py: N802 pywikibot/backports.py: F401 - pywikibot/bot.py: N802, N815, N816 + pywikibot/bot.py: N802, N816 pywikibot/config2.py: N816 pywikibot/cosmetic_changes.py : N802, N803, N806, N816 - pywikibot/data/api.py : N806, N802 - pywikibot/data/sparql.py: N802 + pywikibot/data/api.py : N802 pywikibot/date.py : N802, N803, N806, N816 - pywikibot/echo.py: N802 pywikibot/editor.py : N803, N806 - # __dict__ used in a discouraged manner - # regex matches the first physical line of logical line of the error - pywikibot/exceptions.py : H501, N802 - # classproperties; most docs should go to family.py pywikibot/families/* : D102 - pywikibot/family.py : E241, N802, N803, N806, N815 + pywikibot/family.py : N802, N803, N806, N815 pywikibot/fixes.py : E241 - pywikibot/flow.py: N802 - pywikibot/logentries.py: N802 - pywikibot/logging.py : N803 pywikibot/login.py: N802, N816 pywikibot/page/__init__.py: N802 pywikibot/page/_collections.py: N802 @@ -147,39 +137,34 @@ pywikibot/site/_apisite.py: N802 pywikibot/site/_datasite.py: N802 pywikibot/specialbots/__init__.py : F401 - pywikibot/textlib.py : N801, N802, N803, N806, N816 + pywikibot/textlib.py : N801, N802, N803, N806 pywikibot/throttle.py: N802 pywikibot/tools/_logging.py: N802 - pywikibot/tools/ip.py : N803, N802 - pywikibot/userinterfaces/gui.py : N812, N803, N806, N802 + pywikibot/userinterfaces/gui.py : N802, N803, N806, N812 pywikibot/userinterfaces/terminal_interface.py : N814 pywikibot/userinterfaces/terminal_interface_base.py : N802, N803, N806, N816 - pywikibot/userinterfaces/terminal_interface_unix.py : E241, N806, N816 + pywikibot/userinterfaces/terminal_interface_unix.py : E241, N816 pywikibot/userinterfaces/terminal_interface_win32.py : E241, N816 - pywikibot/userinterfaces/transliteration.py : N801 - pywikibot/userinterfaces/win32_unicode.py : N801, N812, T001, N803, N806 - pywikibot/xmlreader.py : N803, N806, N802 + pywikibot/userinterfaces/win32_unicode.py : N801, N803, N806, N812, T001 + pywikibot/xmlreader.py : N802, N803, N806 scripts/add_text.py : N803, N806 - scripts/category.py : N803, N806, N802 - scripts/category_redirect.py : N803, N806, N802 + scripts/category.py : N802, N803, N806 + scripts/category_redirect.py : N802, N803, N806 scripts/checkimages.py : N801, N802, N803, N806, N816 - scripts/clean_sandbox.py : N815, N816 + scripts/clean_sandbox.py : N816 scripts/cosmetic_changes.py : N816 scripts/fixing_redirects.py : N803, N806 - scripts/harvest_template.py : N802, N815, N816 + scripts/harvest_template.py : N802, N816 scripts/imagetransfer.py : N803, N806, N816 - scripts/maintenance/* : T001 - scripts/maintenance/download_dump.py : N815 + scripts/maintenance/make_i18n_dict.py : T001 scripts/misspelling.py : N802, N806 - scripts/movepages.py : N803, N806, N802 + scripts/movepages.py : N802, N803, N806 scripts/noreferences.py : N802, N803, N806, N816 - scripts/pagefromfile.py : N815 - scripts/redirect.py : N803, N806, N815 + scripts/redirect.py : N803, N806 scripts/replace.py : N802, N803, N806, N816 - scripts/revertbot.py: N815 scripts/solve_disambiguation.py : N802, N803, N806 scripts/templatecount.py: N802 - scripts/weblinkchecker.py : N803, N806, N802 + scripts/weblinkchecker.py : N802, N803, N806 scripts/welcome.py: N802, N815 setup.py : T001 tests/api_tests.py: N802 @@ -188,32 +173,22 @@ tests/bot_tests.py: N802 tests/collections_tests.py: N802 tests/cosmetic_changes_tests.py: N802 - tests/data_ingestion_tests.py: N802 tests/date_tests.py: N802 - tests/dry_site_tests.py: N802 tests/edit_failure_tests.py: N802 - tests/exceptions_tests.py: N802 - tests/family_tests.py: N802, N813 - tests/file_tests.py: N802, N813 - tests/flow_edit_tests.py: N813 - tests/flow_tests.py: N813 - tests/http_tests.py: N813 + tests/family_tests.py: N802 + tests/file_tests.py: N802 tests/i18n_tests.py: N802 - tests/imagecopy_tests.py: N802 tests/interwiki_link_tests.py: N802 - tests/isbn_tests.py: N802 tests/link_tests.py: N802 tests/login_tests.py: N802 - tests/namespace_tests.py: N802, N813 - tests/page_tests.py : E241, N802, N813 + tests/namespace_tests.py: N802 + tests/page_tests.py : E241, N802 tests/pagegenerators_tests.py: N802 tests/pwb/* : T001 - tests/reflinks_tests.py: N802 tests/script_tests.py: N802 tests/site_detect_tests.py: N802 - tests/site_tests.py: N802, N813 + tests/site_tests.py: N802 tests/sparql_tests.py: N802 - tests/tests_tests.py: N802 tests/textlib_tests.py: N802 tests/thread_tests.py: N802 tests/tk_tests.py: N802 @@ -221,8 +196,7 @@ tests/tools_ip_tests.py: N802 tests/tools_tests.py: N802 tests/ui_options_tests.py: N802 - tests/ui_tests.py : D102, D103, N801, N802, N813 - tests/utils.py: N802, N813 + tests/ui_tests.py : D102, D103, N801, N802 tests/wikibase_edit_tests.py: N802 tests/wikibase_tests.py: N802 tests/xmlreader_tests.py: N802
pywikibot-commits@lists.wikimedia.org