From 2a32e1b1aeee4affa3407782f47fe9cc97bef4a4 Mon Sep 17 00:00:00 2001 From: toofar Date: Sun, 15 Oct 2023 17:16:55 +1300 Subject: 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 --- qutebrowser/misc/sql.py | 1 + 1 file changed, 1 insertion(+) 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) -- cgit v1.2.3-54-g00ecf