Page MenuHomeSoftware Heritage

D8346.diff
No OneTemporary

D8346.diff

diff --git a/swh/provenance/postgresql/archive.py b/swh/provenance/postgresql/archive.py
--- a/swh/provenance/postgresql/archive.py
+++ b/swh/provenance/postgresql/archive.py
@@ -3,7 +3,7 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
-from typing import Any, Dict, Iterable, List, Tuple
+from typing import Any, Dict, Iterable, List, Tuple, cast
import psycopg2.extensions
@@ -112,7 +112,7 @@
""",
(revision_id,),
)
- return cursor.fetchall()
+ return cast(List[Tuple[Sha1Git, Sha1Git]], cursor.fetchall())
@statsd.timed(metric=ARCHIVE_DURATION_METRIC, tags={"method": "snapshot_get_heads"})
def snapshot_get_heads(self, id: Sha1Git) -> Iterable[Sha1Git]:
diff --git a/swh/provenance/postgresql/provenance.py b/swh/provenance/postgresql/provenance.py
--- a/swh/provenance/postgresql/provenance.py
+++ b/swh/provenance/postgresql/provenance.py
@@ -90,7 +90,9 @@
if self._flavor is None:
with self.transaction(readonly=True) as cursor:
cursor.execute("SELECT swh_get_dbflavor() AS flavor")
- self._flavor = cursor.fetchone()["flavor"]
+ flavor = cursor.fetchone()
+ assert flavor # please mypy
+ self._flavor = flavor["flavor"]
assert self._flavor is not None
return self._flavor

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 2, 12:10 PM (2 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3215931

Event Timeline