diff --git a/mwclient/__init__.py b/mwclient/__init__.py index 665c3dce5acbd8e59e460de5c47652369cd7ec47..772e3d09b305655f11e05dfe71b88168b140c453 100644 --- a/mwclient/__init__.py +++ b/mwclient/__init__.py @@ -23,8 +23,8 @@ OTHER DEALINGS IN THE SOFTWARE. """ -from mwclient.errors import * # pylint: disable=unused-import -from mwclient.client import Site, __ver__ # pylint: disable=unused-import +from mwclient.errors import * # noqa: F401, F403 # pylint: disable=unused-import +from mwclient.client import Site, __ver__ # noqa: F401 # pylint: disable=unused-import import logging import warnings diff --git a/mwclient/client.py b/mwclient/client.py index a9301a0d4a9ee1291f3f73d3d27d3919b2919b4b..db673fc67790d1b44555b242a9cb560db6a16733 100644 --- a/mwclient/client.py +++ b/mwclient/client.py @@ -313,8 +313,10 @@ class Site(object): return False # cope with https://phabricator.wikimedia.org/T106066 - if (info['error'].get('code') == u'mwoauth-invalid-authorization' and - 'Nonce already used' in info['error'].get('info')): + if ( + info['error'].get('code') == u'mwoauth-invalid-authorization' + and 'Nonce already used' in info['error'].get('info') + ): log.warning('retrying due to nonce error https://phabricator.wikimedia.org/T106066') sleeper.sleep() return False diff --git a/mwclient/errors.py b/mwclient/errors.py index 763c3afce3bd55c4785de548909db211425cfc2e..845cf3157ebaced0fd3a608d4f368014087a234c 100644 --- a/mwclient/errors.py +++ b/mwclient/errors.py @@ -73,11 +73,11 @@ class OAuthAuthorizationError(LoginError): class AssertUserFailedError(MwClientError): def __init__(self): - super(AssertUserFailedError, self).__init__( - 'By default, mwclient protects you from accidentally editing ' + - 'without being logged in. If you actually want to edit without ' + + super(AssertUserFailedError, self).__init__(( + 'By default, mwclient protects you from accidentally editing ' + 'without being logged in. If you actually want to edit without ' 'logging in, you can set force_login on the Site object to False.' - ) + )) def __str__(self): return self.args[0] @@ -98,10 +98,10 @@ class NoWriteApi(MwClientError): class InvalidResponse(MwClientError): def __init__(self, response_text=None): - super(InvalidResponse, self).__init__( - 'Did not get a valid JSON response from the server. Check that ' + - 'you used the correct hostname. If you did, the server might ' + - 'be wrongly configured or experiencing temporary problems.', + super(InvalidResponse, self).__init__(( + 'Did not get a valid JSON response from the server. Check that ' + 'you used the correct hostname. If you did, the server might ' + 'be wrongly configured or experiencing temporary problems.'), response_text ) self.response_text = response_text