Philipp Hörist pushed to branch master at gajim / gajim


Commits:
1abae4c4 by lovetox at 2022-05-01T15:30:50+02:00
chore: Add type annotations

- - - - -


2 changed files:

- gajim/common/storage/archive.py
- gajim/common/storage/cache.py


Changes:

=====================================
gajim/common/storage/archive.py
=====================================
@@ -178,6 +178,7 @@ def _namedtuple_factory(self,
                             cursor: sqlite.Cursor,
                             row: tuple[Any, ...]) -> NamedTuple:
 
+        assert cursor.description is not None
         fields = [col[0] for col in cursor.description]
         Row = namedtuple("Row", fields)  # type: ignore
         named_row = Row(*row)
@@ -333,6 +334,7 @@ def get_jid_id(self,
 
         sql = 'INSERT INTO jids (jid, type) VALUES (?, ?)'
         lastrowid = self._con.execute(sql, (jid, type_)).lastrowid
+        assert lastrowid is not None
         self._jid_ids[jid] = JidsTableRow(jid_id=lastrowid,
                                           jid=jid,
                                           type=type_)
@@ -1188,6 +1190,7 @@ def insert_into_logs(self,
 
         lastrowid = self._con.execute(
             sql, (account_id, jid_id, time_, kind) + 
tuple(kwargs.values())).lastrowid
+        assert lastrowid is not None
 
         log.info('Insert into DB: jid: %s, time: %s, kind: %s, stanza_id: %s',
                  jid, time_, kind, kwargs.get('stanza_id', None))


=====================================
gajim/common/storage/cache.py
=====================================
@@ -117,6 +117,8 @@ def init(self, **kwargs: Any) -> None:
     @staticmethod
     def _namedtuple_factory(cursor: sqlite3.Cursor,
                             row: tuple[Any, ...]) -> NamedTuple:
+
+        assert cursor.description is not None
         fields = [col[0] for col in cursor.description]
         Row = namedtuple('Row', fields)  # type: ignore
         return Row(*row)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/1abae4c46aa3c3f1044c3310652077f6be848ce9

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/1abae4c46aa3c3f1044c3310652077f6be848ce9
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to