Handle missing value for P571 property
This commit is contained in:
parent
ae0b2e5a51
commit
00773cd5f9
|
@ -112,8 +112,10 @@ class Item(Base):
|
||||||
@property
|
@property
|
||||||
def date(self) -> str | None:
|
def date(self) -> str | None:
|
||||||
v = wikibase.first_datavalue(typing.cast(Entity, self.entity), "P571")
|
v = wikibase.first_datavalue(typing.cast(Entity, self.entity), "P571")
|
||||||
|
if not v:
|
||||||
|
return None
|
||||||
assert isinstance(v, dict)
|
assert isinstance(v, dict)
|
||||||
return utils.format_time(v["time"], v["precision"]) if v else None
|
return utils.format_time(v["time"], v["precision"])
|
||||||
|
|
||||||
|
|
||||||
class Triple(Base):
|
class Triple(Base):
|
||||||
|
|
Loading…
Reference in a new issue