Fix pylint/flake8/vulture errors.
This commit is contained in:
parent
90c49b3fe7
commit
b5a6583559
@ -20,8 +20,7 @@
|
||||
"""Functions that return config-related completion models."""
|
||||
|
||||
from qutebrowser.config import configdata, configexc, config
|
||||
from qutebrowser.completion.models import completionmodel, listcategory
|
||||
from qutebrowser.utils import objreg
|
||||
from qutebrowser.completion.models import completionmodel, listcategory, util
|
||||
from qutebrowser.commands import cmdutils
|
||||
|
||||
|
||||
@ -34,12 +33,12 @@ def option():
|
||||
return model
|
||||
|
||||
|
||||
def value(optname, *values):
|
||||
def value(optname, *_values):
|
||||
"""A CompletionModel filled with setting values.
|
||||
|
||||
Args:
|
||||
optname: The name of the config option this model shows.
|
||||
values: The values already provided on the command line.
|
||||
_values: The values already provided on the command line.
|
||||
"""
|
||||
model = completionmodel.CompletionModel(column_widths=(30, 70, 0))
|
||||
|
||||
|
@ -38,9 +38,9 @@ class HistoryCategory(QSqlQueryModel):
|
||||
self.name = "History"
|
||||
|
||||
# replace ' in timestamp-format to avoid breaking the query
|
||||
timestamp_format = config.val.completion.timestamp_format
|
||||
timefmt = ("strftime('{}', last_atime, 'unixepoch', 'localtime')"
|
||||
.format(config.val.completion.timestamp_format
|
||||
.replace("'", "`")))
|
||||
.format(timestamp_format.replace("'", "`")))
|
||||
|
||||
self._query = sql.Query(' '.join([
|
||||
"SELECT url, title, {}".format(timefmt),
|
||||
|
@ -41,14 +41,12 @@ class ValidationError(Error):
|
||||
"""Raised when a value for a config type was invalid.
|
||||
|
||||
Attributes:
|
||||
section: Section in which the error occurred (added when catching and
|
||||
re-raising the exception).
|
||||
option: Option in which the error occurred.
|
||||
value: Config value that triggered the error.
|
||||
msg: Additional error message.
|
||||
"""
|
||||
|
||||
def __init__(self, value, msg):
|
||||
super().__init__("Invalid value '{}' - {}".format(value, msg))
|
||||
self.section = None
|
||||
self.option = None
|
||||
|
||||
|
||||
|
@ -78,8 +78,7 @@ def whitelist_generator():
|
||||
yield 'qutebrowser.browser.qutescheme.qute_' + name
|
||||
|
||||
# Other false-positives
|
||||
yield ('qutebrowser.completion.models.sortfilter.CompletionFilterModel().'
|
||||
'lessThan')
|
||||
yield 'qutebrowser.completion.models.listcategory.ListCategory().lessThan'
|
||||
yield 'qutebrowser.utils.jinja.Loader.get_source'
|
||||
yield 'qutebrowser.utils.log.QtWarningFilter.filter'
|
||||
yield 'qutebrowser.browser.pdfjs.is_available'
|
||||
@ -107,12 +106,6 @@ def whitelist_generator():
|
||||
for name, member in inspect.getmembers(configtypes, inspect.isclass):
|
||||
yield 'qutebrowser.config.configtypes.' + name
|
||||
|
||||
### FIXME:conf
|
||||
## completion
|
||||
for name in ['Section', 'Option', 'Value']:
|
||||
klass = 'Setting{}CompletionModel'.format(name)
|
||||
yield 'qutebrowser.completion.models.configmodel.' + klass
|
||||
# in qutebrowser.completion.models.miscmodels._get_cmd_completions
|
||||
yield 'include_aliases'
|
||||
## FIXME:conf TODO
|
||||
yield 'qutebrowser.config.configdata.DEFAULT_FONT_SIZE'
|
||||
|
@ -18,7 +18,6 @@
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# FIXME:conf
|
||||
# pylint: disable=undefined-variable
|
||||
|
||||
"""Tests for completion models."""
|
||||
|
||||
|
@ -24,7 +24,6 @@ from qutebrowser.utils import usertypes
|
||||
|
||||
def test_validation_error():
|
||||
e = configexc.ValidationError('val', 'msg')
|
||||
assert e.section is None
|
||||
assert e.option is None
|
||||
assert str(e) == "Invalid value 'val' - msg"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user