summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2023-10-15 17:16:55 +1300
committertoofar <toofar@spalge.com>2023-10-15 17:16:55 +1300
commit2a32e1b1aeee4affa3407782f47fe9cc97bef4a4 (patch)
treeb49a4961300b9a68b1c667d99320ca680cb83b21
parenta927a93d2833de61cdf85defb88b94ef8e17d51b (diff)
downloadqutebrowser-2a32e1b1aeee4affa3407782f47fe9cc97bef4a4.tar.gz
qutebrowser-2a32e1b1aeee4affa3407782f47fe9cc97bef4a4.zip
lint: the exec in namedtuple is useful here
https://pylint.readthedocs.io/en/stable/user_guide/messages/refactor/prefer-typing-namedtuple.html Says to using the class based typing.NamedTuple instead of collections.namedtuple, which just constructs a class based off of strings. Here we are creating a dynamic class based on the fields in the SQL result. It's only called once for a query, so I don't think speed is an issue. Also it's not used by the completion, looks like just :history
-rw-r--r--qutebrowser/misc/sql.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/qutebrowser/misc/sql.py b/qutebrowser/misc/sql.py
index 1481ba219..b23b862a3 100644
--- a/qutebrowser/misc/sql.py
+++ b/qutebrowser/misc/sql.py
@@ -320,6 +320,7 @@ class Query:
raise BugError("Cannot iterate inactive query")
rec = self.query.record()
fields = [rec.fieldName(i) for i in range(rec.count())]
+ # pylint: disable=prefer-typing-namedtuple
rowtype = collections.namedtuple( # type: ignore[misc]
'ResultRow', fields)