Clean up pylint/noqa comments.

This commit is contained in:
Florian Bruhin 2014-08-04 03:47:09 +02:00
parent 3dc7a1b735
commit ee1b136807
16 changed files with 17 additions and 32 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -38,7 +38,6 @@ MapType = enum('MapType', 'attribute', 'setter', 'static_setter')
MAPPINGS = {
# noqa
'permissions': {
'allow-images':
(MapType.attribute, QWebSettings.AutoLoadImages),

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -17,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=missing-docstring
"""Test test helpers."""

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# 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)

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# 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:

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# 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)

View File

@ -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

View File

@ -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

View File

@ -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