jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[flake8] Selecting Bugbear B901, B903 seems to ignore other tests

fix flake8 issues

Bug: T275879
Change-Id: I18a9cbb5173c8dbee5bceb4f5b7e7d7373b22fc1
---
M docs/conf.py
M pywikibot/logentries.py
M pywikibot/login.py
M pywikibot/page/__init__.py
M scripts/solve_disambiguation.py
M tests/cosmetic_changes_tests.py
M tests/proofreadpage_tests.py
M tests/tools_ip_tests.py
M tests/upload_tests.py
M tests/wikibase_tests.py
M tests/xmlreader_tests.py
M tox.ini
12 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 210d8d0..7d4363a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -168,7 +168,7 @@
# html_logo = None

# The name of an image file (relative to this directory) to use as a favicon of
-# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
@@ -344,6 +344,7 @@
#
# texinfo_no_detailmenu = False

+
def pywikibot_script_docstring_fixups(app, what, name, obj, options, lines):
"""Pywikibot specific conversions."""
from scripts.cosmetic_changes import warning
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 92a5d1c..09f922f 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -74,7 +74,7 @@
"""Combine site and logid as the hash."""
return self.logid() ^ hash(self.site)

- def __eq__(self, other)-> bool:
+ def __eq__(self, other) -> bool:
"""Compare if self is equal to other."""
if not isinstance(other, LogEntry):
pywikibot.debug("'{0}' cannot be compared with '{1}'"
diff --git a/pywikibot/login.py b/pywikibot/login.py
index cb94816..b09128b 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
"""Library to log the bot in to a wiki account."""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -19,7 +19,6 @@
from pywikibot.comms import http
from pywikibot.exceptions import NoUsername
from pywikibot.tools import (
- deprecated,
deprecated_args, file_mode_checker, normalize_username, remove_last_args,
)

diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 26fa4c2..142d248 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -54,7 +54,6 @@
deprecated_args,
DotReadableDict,
first_upper,
- issue_deprecation_warning,
redirect_func,
remove_last_args,
)
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 7091084..2c3c7b4 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -95,7 +95,7 @@
from pywikibot.backports import List
from pywikibot.bot import (HighlightContextOption, ListOption,
OutputProxyOption, SingleSiteBot, StandardOption)
-from pywikibot.tools import deprecated, first_lower, first_upper
+from pywikibot.tools import first_lower, first_upper
from pywikibot.tools.formatter import SequenceOutputter


diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 4432352..521f17b 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -9,6 +9,7 @@
from contextlib import suppress

from pywikibot import Page
+
from pywikibot.cosmetic_changes import CosmeticChangesToolkit

from tests.aspects import TestCase
diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py
index 5823e47..05ef42a 100644
--- a/tests/proofreadpage_tests.py
+++ b/tests/proofreadpage_tests.py
@@ -318,7 +318,7 @@
page = ProofreadPage(self.site, self.existing_unlinked['title'])
# test Exception in property.
with self.assertRaises(ValueError):
- getattr(page, 'url_image')
+ page.url_image


class TestPageQuality(TestCase):
@@ -471,7 +471,7 @@
self.assertFalse(hasattr(page, '_index'))
# Test setter with wrong type.
with self.assertRaises(TypeError):
- setattr(page, 'index', 'invalid index')
+ page.index = 'invalid index'
# Test setter with correct type.
page.index = index_page
self.assertEqual(page.index, index_page)
diff --git a/tests/tools_ip_tests.py b/tests/tools_ip_tests.py
index b3ba311..95742c0 100644
--- a/tests/tools_ip_tests.py
+++ b/tests/tools_ip_tests.py
@@ -11,6 +11,7 @@
from pywikibot.tools import is_IP, PYTHON_VERSION

from tests import unittest_print
+
from tests.aspects import TestCase
from tests.utils import expected_failure_if

diff --git a/tests/upload_tests.py b/tests/upload_tests.py
index eaca6d1..8eecbd9 100644
--- a/tests/upload_tests.py
+++ b/tests/upload_tests.py
@@ -15,6 +15,7 @@
import pywikibot

from tests import join_images_path
+
from tests.aspects import TestCase


diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index c363406..a0e7da8 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -21,12 +21,7 @@
from pywikibot.tools import MediaWikiVersion

from tests import join_pages_path, mock
-from tests.aspects import (
- DeprecationTestCase,
- TestCase,
- unittest,
- WikidataTestCase,
-)
+from tests.aspects import TestCase, unittest, WikidataTestCase

from tests.basepage import (
BasePageMethodsTestBase,
diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py
index fcd775b..ccd7eb7 100644
--- a/tests/xmlreader_tests.py
+++ b/tests/xmlreader_tests.py
@@ -11,6 +11,7 @@
from pywikibot import xmlreader

from tests import join_xml_data_path
+
from tests.aspects import TestCase


diff --git a/tox.ini b/tox.ini
index 9e242c7..93d8063 100644
--- a/tox.ini
+++ b/tox.ini
@@ -98,7 +98,6 @@
# D413: Missing blank line after last section

ignore = B007,C103,D105,D211,D401,D413,D412,FI1,H101,H238,H301,H404,H405,H903,P101,P102,P103,P205,W503
-select = B901,B903
enable-extensions = H203,H204,H205
exclude = .tox,.git,./*.egg,build,scripts/archive/*,./scripts/i18n/*,./tests/archive/*
classmethod-decorators = classmethod,classproperty

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I18a9cbb5173c8dbee5bceb4f5b7e7d7373b22fc1
Gerrit-Change-Number: 667167
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged