From 36f024563ff4196204b9c05e3f55ec460e327f4f Mon Sep 17 00:00:00 2001 From: xqt Date: Sat, 6 Jul 2024 13:23:50 +0200 Subject: [PATCH] [pep8] fix pep8 issues in pywikibot using autopep8 Change-Id: I2f146e51b3dc18c9c1b20341d3ca2b2839c9ecf8 --- pywikibot/data/wikistats.py | 4 ++-- pywikibot/proofreadpage.py | 2 ++ pywikibot/version.py | 4 ++-- tox.ini | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py index bfb6892baa..23b2547869 100644 --- a/pywikibot/data/wikistats.py +++ b/pywikibot/data/wikistats.py @@ -129,10 +129,10 @@ def sorted(self, table: str, key: str, # take the first entry to determine the sorting key first_entry = table[0] if first_entry[key].isdigit(): - sort_key = lambda d: int(d[key]) # noqa: E731 + def sort_key(d): return int(d[key]) reverse = reverse if reverse is not None else True else: - sort_key = lambda d: d[key] # noqa: E731 + def sort_key(d): return d[key] reverse = reverse if reverse is not None else False return sorted(table, key=sort_key, reverse=reverse) diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py index 90e2a03a28..5a14de2d74 100644 --- a/pywikibot/proofreadpage.py +++ b/pywikibot/proofreadpage.py @@ -324,6 +324,7 @@ def decompose(fn: Callable) -> Callable: # type: ignore Decompose text if needed and recompose text. """ + def wrapper(self: ProofreadPage, *args: Any, **kwargs: Any) -> Any: if not hasattr(self, '_full_header'): self._decompose_page() @@ -336,6 +337,7 @@ def wrapper(self: ProofreadPage, *args: Any, **kwargs: Any) -> Any: def check_if_cached(fn: Callable) -> Callable: # type: ignore """Decorator for IndexPage to ensure data is cached.""" + def wrapper(self: IndexPage, *args: Any, **kwargs: Any) -> Any: if self._cached is False: self._get_page_mappings() diff --git a/pywikibot/version.py b/pywikibot/version.py index 722a377712..3d33a29438 100644 --- a/pywikibot/version.py +++ b/pywikibot/version.py @@ -412,8 +412,8 @@ def package_versions( info['path'] = path assert path not in paths, \ - 'Path {} of the package {} is in defined paths as {}' \ - .format(path, name, paths[path]) + 'Path {} of the package {} is in defined paths as {}' \ + .format(path, name, paths[path]) paths[path] = name if '__version__' in package.__dict__: diff --git a/tox.ini b/tox.ini index 4646d5e5cd..9e4f8d8386 100644 --- a/tox.ini +++ b/tox.ini @@ -118,6 +118,7 @@ deps = # The following are intentionally ignored, possibly pending consensus # D105: Missing docstring in magic method # D211: No blank lines allowed before class docstring +# E704: multiple statements on one line (def) # FI1: __future__ import "x" missing # H101: TODO format # H23: Python 3 compatibility tests @@ -137,13 +138,13 @@ deps = # DARXXX: Darglint docstring issues to be solved # DAR000: T368849 -ignore = B007,D105,D211,D401,D413,D412,DAR000,DAR003,DAR101,DAR102,DAR201,DAR202,DAR301,DAR401,DAR402,DAR501,H101,H231,H232,H233,H234,H235,H236,H237,H238,H301,H306,H404,H405,H903,R100,W503 +ignore = B007,D105,D211,D401,D413,D412,DAR000,DAR003,DAR101,DAR102,DAR201,DAR202,DAR301,DAR401,DAR402,DAR501,E704,H101,H231,H232,H233,H234,H235,H236,H237,H238,H301,H306,H404,H405,H903,R100,W503 enable-extensions = H203,H204,H205,N818 count = True exclude = .tox,.git,./*.egg,build,./scripts/i18n/* format = %(blue)s%(path)s%(reset)s: %(bold)sline %(row)d:%(reset)s%(col)d: %(bold)s%(red)s%(code)s%(reset)s %(text)s -max-complexity = 50 +max-complexity = 49 # The following are to be fixed # N802: function name should be lowercase