Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9314094
D8346.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D8346.diff
View Options
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
Details
Attached
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
Attached To
D8346: Fix a couple of mypy issues
Event Timeline
Log In to Comment