Lint fixes
This commit is contained in:
parent
678b4d54af
commit
1132f7bb6c
@ -45,13 +45,14 @@ class register:
|
|||||||
|
|
||||||
def __init__(self, instance=None, name=None, nargs=None, split_args=True,
|
def __init__(self, instance=None, name=None, nargs=None, split_args=True,
|
||||||
hide=False, completion=None):
|
hide=False, completion=None):
|
||||||
"""Gets called on parse-time with the decorator arguments.
|
"""Save decorator arguments.
|
||||||
|
|
||||||
|
Gets called on parse-time with the decorator arguments.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
See class attributes.
|
See class attributes.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.split_args = split_args
|
self.split_args = split_args
|
||||||
self.hide = hide
|
self.hide = hide
|
||||||
@ -60,7 +61,9 @@ class register:
|
|||||||
self.completion = completion
|
self.completion = completion
|
||||||
|
|
||||||
def __call__(self, func):
|
def __call__(self, func):
|
||||||
"""Gets called when a function should be decorated.
|
"""Register the command before running the function.
|
||||||
|
|
||||||
|
Gets called when a function should be decorated.
|
||||||
|
|
||||||
Doesn't actually decorate anything, but creates a Command object and
|
Doesn't actually decorate anything, but creates a Command object and
|
||||||
registers it in the cmd_dict.
|
registers it in the cmd_dict.
|
||||||
@ -72,6 +75,7 @@ class register:
|
|||||||
The original function (unmodified).
|
The original function (unmodified).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# FIXME: only register commands once
|
||||||
names = []
|
names = []
|
||||||
name = func.__name__.lower() if self.name is None else self.name
|
name = func.__name__.lower() if self.name is None else self.name
|
||||||
if isinstance(name, str):
|
if isinstance(name, str):
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
|
|
||||||
class ValidationError(ValueError):
|
class ValidationError(ValueError):
|
||||||
|
|
||||||
"""Exception raised when a value for a config type was invalid."""
|
"""Exception raised when a value for a config type was invalid."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,6 +180,7 @@ class ValueList:
|
|||||||
valtype.validate(v)
|
valtype.validate(v)
|
||||||
self.values[keytype.transform(k)] = valtype.transform(v)
|
self.values[keytype.transform(k)] = valtype.transform(v)
|
||||||
|
|
||||||
|
|
||||||
class SearchEngines(ValueList):
|
class SearchEngines(ValueList):
|
||||||
|
|
||||||
"""Search engine config section."""
|
"""Search engine config section."""
|
||||||
|
@ -101,6 +101,7 @@ class CompletionView(QTreeView):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._enabled = config.config.get('general', 'show_completion')
|
self._enabled = config.config.get('general', 'show_completion')
|
||||||
|
self._model = None
|
||||||
self._completion_models = {
|
self._completion_models = {
|
||||||
'command': CompletionFilterModel(CommandCompletionModel(self)),
|
'command': CompletionFilterModel(CommandCompletionModel(self)),
|
||||||
'setting': CompletionFilterModel(SettingCompletionModel(self)),
|
'setting': CompletionFilterModel(SettingCompletionModel(self)),
|
||||||
@ -155,6 +156,7 @@ class CompletionView(QTreeView):
|
|||||||
"""Get a new completion model.
|
"""Get a new completion model.
|
||||||
|
|
||||||
parts: The command chunks to get a completion for.
|
parts: The command chunks to get a completion for.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if len(parts) == 1:
|
if len(parts) == 1:
|
||||||
return 'command'
|
return 'command'
|
||||||
|
@ -60,6 +60,7 @@ options = {
|
|||||||
'no-init',
|
'no-init',
|
||||||
'too-many-arguments',
|
'too-many-arguments',
|
||||||
'too-few-public-methods',
|
'too-few-public-methods',
|
||||||
|
'too-many-ancestors',
|
||||||
# visual noise
|
# visual noise
|
||||||
'locally-disabled',
|
'locally-disabled',
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user