jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/750720 )
Change subject: [style] fix code style issues ......................................................................
[style] fix code style issues
Deepsource C0325, W0107, C0412, R170
Change-Id: Ieaeef99bb274cb905127f2a02a25fac7bbf4d22c --- M pywikibot/data/api.py M pywikibot/exceptions.py M pywikibot/proofreadpage.py M pywikibot/site/_generators.py M pywikibot/site/_obsoletesites.py M pywikibot/tools/djvu.py M tests/archive/isbn_tests.py M tests/utils.py M tests/weblinkchecker_tests.py M tests/wikibase_tests.py 10 files changed, 9 insertions(+), 11 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index acde07e..eaad672 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -222,7 +222,7 @@ """Emulate the pageset module, which existed until MW 1.24.""" # pageset isn't a module in the new system, so it is emulated, with # the paraminfo from the query module. - assert('query' in self._paraminfo) + assert 'query' in self._paraminfo
self._paraminfo['pageset'] = { 'name': 'pageset', diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py index 3655020..ce08846 100644 --- a/pywikibot/exceptions.py +++ b/pywikibot/exceptions.py @@ -506,8 +506,6 @@
"""The section specified by # does not exist."""
- pass -
class NoCreateError(PageSaveRelatedError):
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py index 6357816..7c1eed4 100644 --- a/pywikibot/proofreadpage.py +++ b/pywikibot/proofreadpage.py @@ -1021,7 +1021,7 @@ if end is None: end = self.num_pages
- if not (1 <= start <= end <= self.num_pages): + if not 1 <= start <= end <= self.num_pages: raise ValueError('start={}, end={} are not in valid range (1, {})' .format(start, end, self.num_pages))
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py index 66d03c9..36872ea 100644 --- a/pywikibot/site/_generators.py +++ b/pywikibot/site/_generators.py @@ -1506,7 +1506,7 @@ self._check_view_deleted('deletedrevs', prop)
revids = kwargs.pop('revids', None) - if not (bool(titles) ^ (revids is not None)): + if not bool(titles) ^ (revids is not None): raise Error('deletedrevs: either "titles" or "revids" parameter ' 'must be given.') if revids and self.mw_version < '1.25': diff --git a/pywikibot/site/_obsoletesites.py b/pywikibot/site/_obsoletesites.py index f66c9d4..dc11677 100644 --- a/pywikibot/site/_obsoletesites.py +++ b/pywikibot/site/_obsoletesites.py @@ -14,8 +14,6 @@
"""Site removed from a family."""
- pass -
class ClosedSite(APISite): """Site closed to read-only mode.""" diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py index 3474f5f..657ec11 100644 --- a/pywikibot/tools/djvu.py +++ b/pywikibot/tools/djvu.py @@ -108,7 +108,7 @@ def wrapper(obj, *args, **kwargs): n = args[0] force = kwargs.get('force', False) - if not (1 <= n <= obj.number_of_images(force=force)): + if not 1 <= n <= obj.number_of_images(force=force): raise ValueError('Page {} not in file {} [{}-{}]' .format(int(n), obj.file, int(n), int(obj.number_of_images()))) diff --git a/tests/archive/isbn_tests.py b/tests/archive/isbn_tests.py index ae9fc0e..b159370 100644 --- a/tests/archive/isbn_tests.py +++ b/tests/archive/isbn_tests.py @@ -249,7 +249,6 @@
def editEntity_dummy(self, data=None, **kwargs): """Avoid that editEntity writes.""" - pass
def setUpModule(): # noqa: N802 diff --git a/tests/utils.py b/tests/utils.py index 5b4741d..84defaf 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -167,7 +167,7 @@ if issubclass(warn_msg.category, ResourceWarning) \ and str(warn_msg.message).startswith( ('unclosed <ssl.SSLSocket', 'unclosed <socket.socket')): - return None + return
log.append(warn_msg)
@@ -395,6 +395,7 @@ if bool(code or fam): return pywikibot.Site(code, fam, self.username(), interface=DryDataSite) + return None
class DryDataSite(DrySite, pywikibot.site.DataSite): diff --git a/tests/weblinkchecker_tests.py b/tests/weblinkchecker_tests.py index 6345d3b..9ae1e67 100644 --- a/tests/weblinkchecker_tests.py +++ b/tests/weblinkchecker_tests.py @@ -28,10 +28,11 @@ else: when = datetime.datetime.strptime(date_string, '%Y%m%d') try: - return weblinkchecker._get_closest_memento_url( + result = weblinkchecker._get_closest_memento_url( url, when, self.timegate_uri) except (RequestsConnectionError, MementoClientException) as e: self.skipTest(e) + return result
class TestMementoWebCite(MementoTestCase): diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index c45544f..1231120 100644 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -40,6 +40,7 @@ for page in gen: if not page.properties().get('wikibase_item'): return page + return None
class WbRepresentationTestCase(WikidataTestCase):
pywikibot-commits@lists.wikimedia.org