diff options
author | Jonathan de Jong <jonathan@automatia.nl> | 2021-02-05 21:39:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 15:39:19 -0500 |
commit | d882fbca388692f475673007df4f7ac394446b46 (patch) | |
tree | 7467f86c9df44cb95b1f32b5f169babd89c73c8f /synapse/storage/util/sequence.py | |
parent | Update installation instructions on Fedora (#9322) (diff) | |
download | synapse-d882fbca388692f475673007df4f7ac394446b46.tar.xz |
Update type hints for Cursor to match PEP 249. (#9299)
Diffstat (limited to 'synapse/storage/util/sequence.py')
-rw-r--r-- | synapse/storage/util/sequence.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/util/sequence.py b/synapse/storage/util/sequence.py index 0ec4dc2918..e2b316a218 100644 --- a/synapse/storage/util/sequence.py +++ b/synapse/storage/util/sequence.py @@ -106,7 +106,9 @@ class PostgresSequenceGenerator(SequenceGenerator): def get_next_id_txn(self, txn: Cursor) -> int: txn.execute("SELECT nextval(?)", (self._sequence_name,)) - return txn.fetchone()[0] + fetch_res = txn.fetchone() + assert fetch_res is not None + return fetch_res[0] def get_next_mult_txn(self, txn: Cursor, n: int) -> List[int]: txn.execute( @@ -147,7 +149,9 @@ class PostgresSequenceGenerator(SequenceGenerator): txn.execute( "SELECT last_value, is_called FROM %(seq)s" % {"seq": self._sequence_name} ) - last_value, is_called = txn.fetchone() + fetch_res = txn.fetchone() + assert fetch_res is not None + last_value, is_called = fetch_res # If we have an associated stream check the stream_positions table. max_in_stream_positions = None |