From ee1b136807f4efeec0e00689f0f4cb005ff0654c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 4 Aug 2014 03:47:09 +0200 Subject: [PATCH] Clean up pylint/noqa comments. --- qutebrowser/app.py | 3 --- qutebrowser/browser/commands.py | 1 - qutebrowser/commands/utils.py | 4 +--- qutebrowser/config/config.py | 5 +---- qutebrowser/config/value.py | 3 +-- qutebrowser/config/websettings.py | 1 - qutebrowser/keyinput/modeman.py | 2 +- qutebrowser/network/networkmanager.py | 2 +- qutebrowser/test/stubs.py | 1 - qutebrowser/test/test_helpers.py | 1 - qutebrowser/test/utils/test_log.py | 4 ++-- qutebrowser/test/utils/test_url.py | 6 ++---- qutebrowser/test/utils/usertypes/test_neighborlist.py | 4 ++-- qutebrowser/utils/earlyinit.py | 2 +- qutebrowser/utils/version.py | 2 +- scripts/generate_doc.py | 8 ++++---- 16 files changed, 17 insertions(+), 32 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 6666583b9..1396b4942 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -90,9 +90,6 @@ class Application(QApplication): _crashlogfile: A file handler to the fatal crash logfile. """ - # This also holds all our globals, so we're a bit over the top here. - # pylint: disable=too-many-instance-attributes - def __init__(self, args): """Constructor. diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 03ced33e2..26fa3e11e 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -134,7 +134,6 @@ class CommandDispatcher: raise CommandError("Last focused tab vanished!") self._tabs.setCurrentIndex(idx) - def _editor_cleanup(self, oshandle, filename): """Clean up temporary file when the editor was closed.""" os.close(oshandle) diff --git a/qutebrowser/commands/utils.py b/qutebrowser/commands/utils.py index 7dfa3f0a0..ac59f2bad 100644 --- a/qutebrowser/commands/utils.py +++ b/qutebrowser/commands/utils.py @@ -156,7 +156,6 @@ class register: # pylint: disable=invalid-name Return: The original function (unmodified). """ - # pylint: disable=no-member names = [] if self.name is None: name = func.__name__.lower().replace('_', '-') @@ -206,14 +205,13 @@ class register: # pylint: disable=invalid-name + (1, None) * (0, None) """ - # pylint: disable=unpacking-non-sequence - # pylint: disable=no-member count = 'count' in spec.args # we assume count always has a default (and it should!) if self.nargs is not None: # If nargs is overriden, use that. if isinstance(self.nargs, Iterable): # Iterable (min, max) + # pylint: disable=unpacking-non-sequence minargs, maxargs = self.nargs else: # Single int diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 9738c9092..8ef3f1b56 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -451,8 +451,6 @@ class SectionProxy(MutableMapping): _name: The section name. """ - # pylint: disable=redefined-builtin - def __init__(self, conf, name): """Create a view on a section. @@ -492,7 +490,7 @@ class SectionProxy(MutableMapping): """Get the option keys from this section.""" return self._conf.sections[self._name].keys() - def get(self, optname, *, raw=False): + def get(self, optname, *, raw=False): # pylint: disable=arguments-differ """Get a value from this section. We deliberately don't support the default argument here, but have a raw @@ -502,7 +500,6 @@ class SectionProxy(MutableMapping): optname: The option name to get. raw: Whether to get a raw value or not. """ - # pylint: disable=arguments-differ return self._conf.get(self._name, optname, raw=raw) @property diff --git a/qutebrowser/config/value.py b/qutebrowser/config/value.py index c0e8ad294..0ff0ace68 100644 --- a/qutebrowser/config/value.py +++ b/qutebrowser/config/value.py @@ -81,7 +81,6 @@ class SettingValue: Args: startlayer: The first layer to include. """ - # pylint: disable=useless-else-on-loop if startlayer is None: d = self._values else: @@ -89,7 +88,7 @@ class SettingValue: for val in d.values(): if val is not None: return val - else: + else: # pylint: disable=useless-else-on-loop raise ValueError("No valid config value found!") def transformed(self): diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 4a71339fa..f25102824 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -38,7 +38,6 @@ MapType = enum('MapType', 'attribute', 'setter', 'static_setter') MAPPINGS = { - # noqa 'permissions': { 'allow-images': (MapType.attribute, QWebSettings.AutoLoadImages), diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index 5feafa8b3..135fce987 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -58,7 +58,7 @@ def maybe_enter(mode, reason=None): """Convenience method to enter 'mode' without exceptions.""" try: instance().enter(mode, reason) - except ModeLockedError as e: + except ModeLockedError: pass diff --git a/qutebrowser/network/networkmanager.py b/qutebrowser/network/networkmanager.py index 0374cfa01..8b19e8866 100644 --- a/qutebrowser/network/networkmanager.py +++ b/qutebrowser/network/networkmanager.py @@ -73,7 +73,7 @@ class NetworkManager(QNetworkAccessManager): # Since the answer could be something else than (user, password) # pylint seems to think we're unpacking a non-sequence. However we # *did* explicitely ask for a tuple, so it *will* always be one. - user, password = answer # pylint: disable=unpacking-non-sequence + user, password = answer authenticator.setUser(user) authenticator.setPassword(password) diff --git a/qutebrowser/test/stubs.py b/qutebrowser/test/stubs.py index 668b7aa27..5386a4d07 100644 --- a/qutebrowser/test/stubs.py +++ b/qutebrowser/test/stubs.py @@ -189,7 +189,6 @@ class FakeQApplication: """Stub to insert as QApplication module.""" def __init__(self, focus): - # pylint: disable=invalid-name self.focusWidget = Mock(return_value=focus) self.instance = Mock(return_value=self) diff --git a/qutebrowser/test/test_helpers.py b/qutebrowser/test/test_helpers.py index 250c99fde..4e95946ed 100644 --- a/qutebrowser/test/test_helpers.py +++ b/qutebrowser/test/test_helpers.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -# pylint: disable=missing-docstring """Test test helpers.""" diff --git a/qutebrowser/test/utils/test_log.py b/qutebrowser/test/utils/test_log.py index da8a3b887..0bcbcd868 100644 --- a/qutebrowser/test/utils/test_log.py +++ b/qutebrowser/test/utils/test_log.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . +# pylint: disable=protected-access + """Tests for qutebrowser.utils.log.""" import logging @@ -36,7 +38,6 @@ class BaseTest(unittest.TestCase): def setUp(self): """Save the old logging configuration.""" - # pylint: disable=protected-access logger_dict = logging.getLogger().manager.loggerDict logging._acquireLock() try: @@ -55,7 +56,6 @@ class BaseTest(unittest.TestCase): def tearDown(self): """Restore the original logging configuration.""" - # pylint: disable=protected-access while self.root_logger.handlers: h = self.root_logger.handlers[0] self.root_logger.removeHandler(h) diff --git a/qutebrowser/test/utils/test_url.py b/qutebrowser/test/utils/test_url.py index 73c6371d9..7e2ff6c54 100644 --- a/qutebrowser/test/utils/test_url.py +++ b/qutebrowser/test/utils/test_url.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . +# pylint: disable=protected-access + """Tests for qutebrowser.utils.url.""" import unittest @@ -77,8 +79,6 @@ class SearchUrlTests(unittest.TestCase): config: The urlutils.config instance. """ - # pylint: disable=protected-access - def setUp(self): self.config = urlutils.config urlutils.config = ConfigStub(CONFIG) @@ -132,8 +132,6 @@ class IsUrlNaiveTests(unittest.TestCase): 'foo', ) - # pylint: disable=protected-access - def test_urls(self): """Test things which are URLs.""" for url in self.URLS: diff --git a/qutebrowser/test/utils/usertypes/test_neighborlist.py b/qutebrowser/test/utils/usertypes/test_neighborlist.py index c1af3a0e3..7dac494de 100644 --- a/qutebrowser/test/utils/usertypes/test_neighborlist.py +++ b/qutebrowser/test/utils/usertypes/test_neighborlist.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . +# pylint: disable=protected-access + """Tests for the NeighborList class.""" import unittest @@ -180,8 +182,6 @@ class OneTests(unittest.TestCase): nl: The NeighborList we're testing. """ - # pylint: disable=protected-access - def setUp(self): self.nl = NeighborList([1], default=1) diff --git a/qutebrowser/utils/earlyinit.py b/qutebrowser/utils/earlyinit.py index ba71888b0..2a91f06b1 100644 --- a/qutebrowser/utils/earlyinit.py +++ b/qutebrowser/utils/earlyinit.py @@ -26,7 +26,7 @@ import faulthandler import traceback import signal try: - from tkinter import Tk, messagebox + from tkinter import Tk, messagebox # pylint: disable=import-error except ImportError: Tk = None diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index 3daa70b75..ca49d8131 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -142,7 +142,7 @@ def _module_versions(): Return: A list of lines with version info. """ - # pylint: disable=import-error, unused-variable + # pylint: disable=import-error,unused-variable lines = [] try: import sipconfig diff --git a/scripts/generate_doc.py b/scripts/generate_doc.py index 67146c1af..ab90dbfbd 100755 --- a/scripts/generate_doc.py +++ b/scripts/generate_doc.py @@ -33,7 +33,7 @@ sys.path.insert(0, os.getcwd()) import qutebrowser # We import qutebrowser.app so all @cmdutils-register decorators are run. -import qutebrowser.app # pylint: disable=unused-import +import qutebrowser.app import qutebrowser.commands.utils as cmdutils import qutebrowser.config.configdata as configdata import qutebrowser.qutebrowser as qutequtebrowser @@ -115,7 +115,6 @@ def _parse_docstring(func): # noqa def _get_cmd_syntax(name, cmd): """Get the command syntax for a command.""" - # pylint: disable=no-member words = [] argspec = inspect.getfullargspec(cmd.handler) if argspec.defaults is not None: @@ -288,15 +287,16 @@ def generate_manpage_description(f): def generate_manpage_options(f): """Generate the OPTIONS-section of the manpage from an argparse parser.""" + # pylint: disable=protected-access parser = qutequtebrowser.get_argparser() f.write('== OPTIONS\n') # positionals, optionals and user-defined groups - for group in parser._action_groups: # pylint: disable=protected-access + for group in parser._action_groups: f.write('=== {}\n'.format(group.title)) if group.description is not None: f.write(group.description + '\n') - for action in group._group_actions: # pylint: disable=protected-access + for action in group._group_actions: f.write(_format_action(action)) f.write('\n') # epilog