summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-11 22:22:30 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-13 20:26:41 +0100
commitc970c6335521fee359c1a68c0431c612631e73fb (patch)
tree1062d9ffd9fbfcafc0753308b8e7a15a5f5f6920 /scripts
parent4b7d52ae7cdf52ebef038b4a90b9fe95ab002105 (diff)
downloadqutebrowser-c970c6335521fee359c1a68c0431c612631e73fb.tar.gz
qutebrowser-c970c6335521fee359c1a68c0431c612631e73fb.zip
dataclasses: Initial switch
See #6023
Diffstat (limited to 'scripts')
-rw-r--r--scripts/dev/check_coverage.py10
-rw-r--r--scripts/dev/get_coredumpctl_traces.py18
-rw-r--r--scripts/dev/recompile_requirements.py1
-rwxr-xr-xscripts/dictcli.py16
4 files changed, 23 insertions, 22 deletions
diff --git a/scripts/dev/check_coverage.py b/scripts/dev/check_coverage.py
index dae90d636..0074bfd56 100644
--- a/scripts/dev/check_coverage.py
+++ b/scripts/dev/check_coverage.py
@@ -27,7 +27,7 @@ import enum
import subprocess
from xml.etree import ElementTree
-import attr
+import dataclasses
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir))
@@ -36,14 +36,14 @@ from scripts import utils as scriptutils
from qutebrowser.utils import utils
-@attr.s
+@dataclasses.dataclass
class Message:
"""A message shown by coverage.py."""
- typ = attr.ib()
- filename = attr.ib()
- text = attr.ib()
+ typ: str
+ filename: str
+ text: str
def show(self):
"""Print this message."""
diff --git a/scripts/dev/get_coredumpctl_traces.py b/scripts/dev/get_coredumpctl_traces.py
index 31d70dd74..0b53e367a 100644
--- a/scripts/dev/get_coredumpctl_traces.py
+++ b/scripts/dev/get_coredumpctl_traces.py
@@ -27,7 +27,7 @@ import argparse
import subprocess
import tempfile
-import attr
+import dataclasses
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir))
@@ -35,18 +35,18 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
from scripts import utils
-@attr.s
+@dataclasses.dataclass
class Line:
"""A line in "coredumpctl list"."""
- time = attr.ib()
- pid = attr.ib()
- uid = attr.ib()
- gid = attr.ib()
- sig = attr.ib()
- present = attr.ib()
- exe = attr.ib()
+ time: str
+ pid: int
+ uid: int
+ gid: int
+ sig: int
+ present: bool
+ exe: str
def _convert_present(data):
diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py
index e43a3111d..52ecf61f2 100644
--- a/scripts/dev/recompile_requirements.py
+++ b/scripts/dev/recompile_requirements.py
@@ -176,6 +176,7 @@ CHANGELOG_URLS = {
'adblock': 'https://github.com/ArniDagur/python-adblock/blob/master/CHANGELOG.md',
'pyPEG2': None,
'importlib-resources': 'https://importlib-resources.readthedocs.io/en/latest/history.html',
+ 'dataclasses': 'https://github.com/ericvsmith/dataclasses#release-history',
}
diff --git a/scripts/dictcli.py b/scripts/dictcli.py
index 4e38727dd..7c575a641 100755
--- a/scripts/dictcli.py
+++ b/scripts/dictcli.py
@@ -31,8 +31,8 @@ import os
import sys
import re
import urllib.request
-
-import attr
+import dataclasses
+from typing import Optional
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
from qutebrowser.browser.webengine import spell
@@ -52,17 +52,17 @@ class InvalidLanguageError(Exception):
super().__init__(msg)
-@attr.s
+@dataclasses.dataclass
class Language:
"""Dictionary language specs."""
- code = attr.ib()
- name = attr.ib()
- remote_filename = attr.ib()
- local_filename = attr.ib(default=None)
+ code: str
+ name: str
+ remote_filename: str
+ local_filename: Optional[str] = None
- def __attrs_post_init__(self):
+ def __post_init__(self):
if self.local_filename is None:
self.local_filename = spell.local_filename(self.code)