Fix pylint/flake8/vulture errors.

This commit is contained in:
Ryan Roden-Corrent 2017-08-19 17:37:57 -04:00
parent 90c49b3fe7
commit b5a6583559
6 changed files with 8 additions and 20 deletions

View File

@ -20,8 +20,7 @@
"""Functions that return config-related completion models.""" """Functions that return config-related completion models."""
from qutebrowser.config import configdata, configexc, config from qutebrowser.config import configdata, configexc, config
from qutebrowser.completion.models import completionmodel, listcategory from qutebrowser.completion.models import completionmodel, listcategory, util
from qutebrowser.utils import objreg
from qutebrowser.commands import cmdutils from qutebrowser.commands import cmdutils
@ -34,12 +33,12 @@ def option():
return model return model
def value(optname, *values): def value(optname, *_values):
"""A CompletionModel filled with setting values. """A CompletionModel filled with setting values.
Args: Args:
optname: The name of the config option this model shows. 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)) model = completionmodel.CompletionModel(column_widths=(30, 70, 0))

View File

@ -38,9 +38,9 @@ class HistoryCategory(QSqlQueryModel):
self.name = "History" self.name = "History"
# replace ' in timestamp-format to avoid breaking the query # replace ' in timestamp-format to avoid breaking the query
timestamp_format = config.val.completion.timestamp_format
timefmt = ("strftime('{}', last_atime, 'unixepoch', 'localtime')" timefmt = ("strftime('{}', last_atime, 'unixepoch', 'localtime')"
.format(config.val.completion.timestamp_format .format(timestamp_format.replace("'", "`")))
.replace("'", "`")))
self._query = sql.Query(' '.join([ self._query = sql.Query(' '.join([
"SELECT url, title, {}".format(timefmt), "SELECT url, title, {}".format(timefmt),

View File

@ -41,14 +41,12 @@ class ValidationError(Error):
"""Raised when a value for a config type was invalid. """Raised when a value for a config type was invalid.
Attributes: Attributes:
section: Section in which the error occurred (added when catching and value: Config value that triggered the error.
re-raising the exception). msg: Additional error message.
option: Option in which the error occurred.
""" """
def __init__(self, value, msg): def __init__(self, value, msg):
super().__init__("Invalid value '{}' - {}".format(value, msg)) super().__init__("Invalid value '{}' - {}".format(value, msg))
self.section = None
self.option = None self.option = None

View File

@ -78,8 +78,7 @@ def whitelist_generator():
yield 'qutebrowser.browser.qutescheme.qute_' + name yield 'qutebrowser.browser.qutescheme.qute_' + name
# Other false-positives # Other false-positives
yield ('qutebrowser.completion.models.sortfilter.CompletionFilterModel().' yield 'qutebrowser.completion.models.listcategory.ListCategory().lessThan'
'lessThan')
yield 'qutebrowser.utils.jinja.Loader.get_source' yield 'qutebrowser.utils.jinja.Loader.get_source'
yield 'qutebrowser.utils.log.QtWarningFilter.filter' yield 'qutebrowser.utils.log.QtWarningFilter.filter'
yield 'qutebrowser.browser.pdfjs.is_available' yield 'qutebrowser.browser.pdfjs.is_available'
@ -107,12 +106,6 @@ def whitelist_generator():
for name, member in inspect.getmembers(configtypes, inspect.isclass): for name, member in inspect.getmembers(configtypes, inspect.isclass):
yield 'qutebrowser.config.configtypes.' + name 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' yield 'include_aliases'
## FIXME:conf TODO ## FIXME:conf TODO
yield 'qutebrowser.config.configdata.DEFAULT_FONT_SIZE' yield 'qutebrowser.config.configdata.DEFAULT_FONT_SIZE'

View File

@ -18,7 +18,6 @@
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# FIXME:conf # FIXME:conf
# pylint: disable=undefined-variable
"""Tests for completion models.""" """Tests for completion models."""

View File

@ -24,7 +24,6 @@ from qutebrowser.utils import usertypes
def test_validation_error(): def test_validation_error():
e = configexc.ValidationError('val', 'msg') e = configexc.ValidationError('val', 'msg')
assert e.section is None
assert e.option is None assert e.option is None
assert str(e) == "Invalid value 'val' - msg" assert str(e) == "Invalid value 'val' - msg"