Code formatting

This commit is contained in:
Edward Betts 2024-05-04 11:13:05 +03:00
parent 7e6ea04f53
commit d7dd9ec17c

View file

@ -6,7 +6,7 @@ from collections import defaultdict
from typing import Any from typing import Any
import sqlalchemy import sqlalchemy
from flask_login import UserMixin from flask_login import UserMixin # type: ignore
from geoalchemy2 import Geometry from geoalchemy2 import Geometry
from sqlalchemy import func from sqlalchemy import func
from sqlalchemy.dialects import postgresql from sqlalchemy.dialects import postgresql
@ -138,9 +138,11 @@ class Item(Base):
"""List of claims for given Wikidata property ID.""" """List of claims for given Wikidata property ID."""
claims = typing.cast(wikidata.Claims, self.claims) claims = typing.cast(wikidata.Claims, self.claims)
return [ return [
i["mainsnak"]["datavalue"]["value"] (
if "datavalue" in i["mainsnak"] i["mainsnak"]["datavalue"]["value"]
else None if "datavalue" in i["mainsnak"]
else None
)
for i in claims.get(pid, []) for i in claims.get(pid, [])
] ]