diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-01-11 22:22:30 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-01-13 20:26:41 +0100 |
commit | c970c6335521fee359c1a68c0431c612631e73fb (patch) | |
tree | 1062d9ffd9fbfcafc0753308b8e7a15a5f5f6920 /qutebrowser/commands | |
parent | 4b7d52ae7cdf52ebef038b4a90b9fe95ab002105 (diff) | |
download | qutebrowser-c970c6335521fee359c1a68c0431c612631e73fb.tar.gz qutebrowser-c970c6335521fee359c1a68c0431c612631e73fb.zip |
dataclasses: Initial switch
See #6023
Diffstat (limited to 'qutebrowser/commands')
-rw-r--r-- | qutebrowser/commands/command.py | 19 | ||||
-rw-r--r-- | qutebrowser/commands/runners.py | 13 |
2 files changed, 16 insertions, 16 deletions
diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 61b44d555..d8d08e50b 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -23,9 +23,8 @@ import inspect import collections import traceback import typing -from typing import Any, MutableMapping, MutableSequence, Tuple, Union - -import attr +from typing import Any, MutableMapping, MutableSequence, Tuple, Union, List, Optional +import dataclasses from qutebrowser.api import cmdutils from qutebrowser.commands import cmdexc, argparser @@ -34,17 +33,17 @@ from qutebrowser.utils import debug as debug_utils from qutebrowser.misc import objects -@attr.s +@dataclasses.dataclass class ArgInfo: """Information about an argument.""" - value = attr.ib(None) - hide = attr.ib(False) - metavar = attr.ib(None) - flag = attr.ib(None) - completion = attr.ib(None) - choices = attr.ib(None) + value: Optional[usertypes.CommandValue] = None + hide: bool = False + metavar: Optional[str] = None + flag: Optional[str] = None + completion: Any = None # FIXME + choices: List[str] = None class Command: diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index c195a8be9..4913f9e3e 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -22,9 +22,10 @@ import traceback import re import contextlib -from typing import TYPE_CHECKING, Callable, Dict, Iterator, Mapping, MutableMapping +from typing import (TYPE_CHECKING, Callable, Dict, Iterator, Mapping, MutableMapping, + List, Optional) +import dataclasses -import attr from PyQt5.QtCore import pyqtSlot, QUrl, QObject from qutebrowser.api import cmdutils @@ -42,14 +43,14 @@ _ReplacementFunction = Callable[['tabbedbrowser.TabbedBrowser'], str] last_command = {} -@attr.s +@dataclasses.dataclass class ParseResult: """The result of parsing a commandline.""" - cmd = attr.ib() - args = attr.ib() - cmdline = attr.ib() + cmd: Optional[str] + args: Optional[List[str]] + cmdline: List[str] def _url(tabbed_browser): |