Skip to content

Commit

Permalink
[pep8] fix pep8 issues in pywikibot using autopep8
Browse files Browse the repository at this point in the history
Change-Id: I2f146e51b3dc18c9c1b20341d3ca2b2839c9ecf8
  • Loading branch information
xqt committed Jul 6, 2024
1 parent 29b8389 commit 36f0245
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pywikibot/data/wikistats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions pywikibot/proofreadpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions pywikibot/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__:
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 36f0245

Please sign in to comment.