Clean up pylint/noqa comments.
This commit is contained in:
parent
3dc7a1b735
commit
ee1b136807
@ -90,9 +90,6 @@ class Application(QApplication):
|
|||||||
_crashlogfile: A file handler to the fatal crash logfile.
|
_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):
|
def __init__(self, args):
|
||||||
"""Constructor.
|
"""Constructor.
|
||||||
|
|
||||||
|
@ -134,7 +134,6 @@ class CommandDispatcher:
|
|||||||
raise CommandError("Last focused tab vanished!")
|
raise CommandError("Last focused tab vanished!")
|
||||||
self._tabs.setCurrentIndex(idx)
|
self._tabs.setCurrentIndex(idx)
|
||||||
|
|
||||||
|
|
||||||
def _editor_cleanup(self, oshandle, filename):
|
def _editor_cleanup(self, oshandle, filename):
|
||||||
"""Clean up temporary file when the editor was closed."""
|
"""Clean up temporary file when the editor was closed."""
|
||||||
os.close(oshandle)
|
os.close(oshandle)
|
||||||
|
@ -156,7 +156,6 @@ class register: # pylint: disable=invalid-name
|
|||||||
Return:
|
Return:
|
||||||
The original function (unmodified).
|
The original function (unmodified).
|
||||||
"""
|
"""
|
||||||
# pylint: disable=no-member
|
|
||||||
names = []
|
names = []
|
||||||
if self.name is None:
|
if self.name is None:
|
||||||
name = func.__name__.lower().replace('_', '-')
|
name = func.__name__.lower().replace('_', '-')
|
||||||
@ -206,14 +205,13 @@ class register: # pylint: disable=invalid-name
|
|||||||
+ (1, None)
|
+ (1, None)
|
||||||
* (0, None)
|
* (0, None)
|
||||||
"""
|
"""
|
||||||
# pylint: disable=unpacking-non-sequence
|
|
||||||
# pylint: disable=no-member
|
|
||||||
count = 'count' in spec.args
|
count = 'count' in spec.args
|
||||||
# we assume count always has a default (and it should!)
|
# we assume count always has a default (and it should!)
|
||||||
if self.nargs is not None:
|
if self.nargs is not None:
|
||||||
# If nargs is overriden, use that.
|
# If nargs is overriden, use that.
|
||||||
if isinstance(self.nargs, Iterable):
|
if isinstance(self.nargs, Iterable):
|
||||||
# Iterable (min, max)
|
# Iterable (min, max)
|
||||||
|
# pylint: disable=unpacking-non-sequence
|
||||||
minargs, maxargs = self.nargs
|
minargs, maxargs = self.nargs
|
||||||
else:
|
else:
|
||||||
# Single int
|
# Single int
|
||||||
|
@ -451,8 +451,6 @@ class SectionProxy(MutableMapping):
|
|||||||
_name: The section name.
|
_name: The section name.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pylint: disable=redefined-builtin
|
|
||||||
|
|
||||||
def __init__(self, conf, name):
|
def __init__(self, conf, name):
|
||||||
"""Create a view on a section.
|
"""Create a view on a section.
|
||||||
|
|
||||||
@ -492,7 +490,7 @@ class SectionProxy(MutableMapping):
|
|||||||
"""Get the option keys from this section."""
|
"""Get the option keys from this section."""
|
||||||
return self._conf.sections[self._name].keys()
|
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.
|
"""Get a value from this section.
|
||||||
|
|
||||||
We deliberately don't support the default argument here, but have a raw
|
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.
|
optname: The option name to get.
|
||||||
raw: Whether to get a raw value or not.
|
raw: Whether to get a raw value or not.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=arguments-differ
|
|
||||||
return self._conf.get(self._name, optname, raw=raw)
|
return self._conf.get(self._name, optname, raw=raw)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -81,7 +81,6 @@ class SettingValue:
|
|||||||
Args:
|
Args:
|
||||||
startlayer: The first layer to include.
|
startlayer: The first layer to include.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=useless-else-on-loop
|
|
||||||
if startlayer is None:
|
if startlayer is None:
|
||||||
d = self._values
|
d = self._values
|
||||||
else:
|
else:
|
||||||
@ -89,7 +88,7 @@ class SettingValue:
|
|||||||
for val in d.values():
|
for val in d.values():
|
||||||
if val is not None:
|
if val is not None:
|
||||||
return val
|
return val
|
||||||
else:
|
else: # pylint: disable=useless-else-on-loop
|
||||||
raise ValueError("No valid config value found!")
|
raise ValueError("No valid config value found!")
|
||||||
|
|
||||||
def transformed(self):
|
def transformed(self):
|
||||||
|
@ -38,7 +38,6 @@ MapType = enum('MapType', 'attribute', 'setter', 'static_setter')
|
|||||||
|
|
||||||
|
|
||||||
MAPPINGS = {
|
MAPPINGS = {
|
||||||
# noqa
|
|
||||||
'permissions': {
|
'permissions': {
|
||||||
'allow-images':
|
'allow-images':
|
||||||
(MapType.attribute, QWebSettings.AutoLoadImages),
|
(MapType.attribute, QWebSettings.AutoLoadImages),
|
||||||
|
@ -58,7 +58,7 @@ def maybe_enter(mode, reason=None):
|
|||||||
"""Convenience method to enter 'mode' without exceptions."""
|
"""Convenience method to enter 'mode' without exceptions."""
|
||||||
try:
|
try:
|
||||||
instance().enter(mode, reason)
|
instance().enter(mode, reason)
|
||||||
except ModeLockedError as e:
|
except ModeLockedError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class NetworkManager(QNetworkAccessManager):
|
|||||||
# Since the answer could be something else than (user, password)
|
# Since the answer could be something else than (user, password)
|
||||||
# pylint seems to think we're unpacking a non-sequence. However we
|
# pylint seems to think we're unpacking a non-sequence. However we
|
||||||
# *did* explicitely ask for a tuple, so it *will* always be one.
|
# *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.setUser(user)
|
||||||
authenticator.setPassword(password)
|
authenticator.setPassword(password)
|
||||||
|
|
||||||
|
@ -189,7 +189,6 @@ class FakeQApplication:
|
|||||||
"""Stub to insert as QApplication module."""
|
"""Stub to insert as QApplication module."""
|
||||||
|
|
||||||
def __init__(self, focus):
|
def __init__(self, focus):
|
||||||
# pylint: disable=invalid-name
|
|
||||||
self.focusWidget = Mock(return_value=focus)
|
self.focusWidget = Mock(return_value=focus)
|
||||||
self.instance = Mock(return_value=self)
|
self.instance = Mock(return_value=self)
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# pylint: disable=missing-docstring
|
|
||||||
|
|
||||||
"""Test test helpers."""
|
"""Test test helpers."""
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
|
||||||
"""Tests for qutebrowser.utils.log."""
|
"""Tests for qutebrowser.utils.log."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -36,7 +38,6 @@ class BaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Save the old logging configuration."""
|
"""Save the old logging configuration."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
logger_dict = logging.getLogger().manager.loggerDict
|
logger_dict = logging.getLogger().manager.loggerDict
|
||||||
logging._acquireLock()
|
logging._acquireLock()
|
||||||
try:
|
try:
|
||||||
@ -55,7 +56,6 @@ class BaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Restore the original logging configuration."""
|
"""Restore the original logging configuration."""
|
||||||
# pylint: disable=protected-access
|
|
||||||
while self.root_logger.handlers:
|
while self.root_logger.handlers:
|
||||||
h = self.root_logger.handlers[0]
|
h = self.root_logger.handlers[0]
|
||||||
self.root_logger.removeHandler(h)
|
self.root_logger.removeHandler(h)
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
|
||||||
"""Tests for qutebrowser.utils.url."""
|
"""Tests for qutebrowser.utils.url."""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
@ -77,8 +79,6 @@ class SearchUrlTests(unittest.TestCase):
|
|||||||
config: The urlutils.config instance.
|
config: The urlutils.config instance.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.config = urlutils.config
|
self.config = urlutils.config
|
||||||
urlutils.config = ConfigStub(CONFIG)
|
urlutils.config = ConfigStub(CONFIG)
|
||||||
@ -132,8 +132,6 @@ class IsUrlNaiveTests(unittest.TestCase):
|
|||||||
'foo',
|
'foo',
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
|
|
||||||
def test_urls(self):
|
def test_urls(self):
|
||||||
"""Test things which are URLs."""
|
"""Test things which are URLs."""
|
||||||
for url in self.URLS:
|
for url in self.URLS:
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
|
||||||
"""Tests for the NeighborList class."""
|
"""Tests for the NeighborList class."""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
@ -180,8 +182,6 @@ class OneTests(unittest.TestCase):
|
|||||||
nl: The NeighborList we're testing.
|
nl: The NeighborList we're testing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.nl = NeighborList([1], default=1)
|
self.nl = NeighborList([1], default=1)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import faulthandler
|
|||||||
import traceback
|
import traceback
|
||||||
import signal
|
import signal
|
||||||
try:
|
try:
|
||||||
from tkinter import Tk, messagebox
|
from tkinter import Tk, messagebox # pylint: disable=import-error
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Tk = None
|
Tk = None
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ def _module_versions():
|
|||||||
Return:
|
Return:
|
||||||
A list of lines with version info.
|
A list of lines with version info.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-error, unused-variable
|
# pylint: disable=import-error,unused-variable
|
||||||
lines = []
|
lines = []
|
||||||
try:
|
try:
|
||||||
import sipconfig
|
import sipconfig
|
||||||
|
@ -33,7 +33,7 @@ sys.path.insert(0, os.getcwd())
|
|||||||
|
|
||||||
import qutebrowser
|
import qutebrowser
|
||||||
# We import qutebrowser.app so all @cmdutils-register decorators are run.
|
# 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.commands.utils as cmdutils
|
||||||
import qutebrowser.config.configdata as configdata
|
import qutebrowser.config.configdata as configdata
|
||||||
import qutebrowser.qutebrowser as qutequtebrowser
|
import qutebrowser.qutebrowser as qutequtebrowser
|
||||||
@ -115,7 +115,6 @@ def _parse_docstring(func): # noqa
|
|||||||
|
|
||||||
def _get_cmd_syntax(name, cmd):
|
def _get_cmd_syntax(name, cmd):
|
||||||
"""Get the command syntax for a command."""
|
"""Get the command syntax for a command."""
|
||||||
# pylint: disable=no-member
|
|
||||||
words = []
|
words = []
|
||||||
argspec = inspect.getfullargspec(cmd.handler)
|
argspec = inspect.getfullargspec(cmd.handler)
|
||||||
if argspec.defaults is not None:
|
if argspec.defaults is not None:
|
||||||
@ -288,15 +287,16 @@ def generate_manpage_description(f):
|
|||||||
|
|
||||||
def generate_manpage_options(f):
|
def generate_manpage_options(f):
|
||||||
"""Generate the OPTIONS-section of the manpage from an argparse parser."""
|
"""Generate the OPTIONS-section of the manpage from an argparse parser."""
|
||||||
|
# pylint: disable=protected-access
|
||||||
parser = qutequtebrowser.get_argparser()
|
parser = qutequtebrowser.get_argparser()
|
||||||
f.write('== OPTIONS\n')
|
f.write('== OPTIONS\n')
|
||||||
|
|
||||||
# positionals, optionals and user-defined groups
|
# 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))
|
f.write('=== {}\n'.format(group.title))
|
||||||
if group.description is not None:
|
if group.description is not None:
|
||||||
f.write(group.description + '\n')
|
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(_format_action(action))
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
# epilog
|
# epilog
|
||||||
|
Loading…
Reference in New Issue
Block a user