LeMyst / WikibaseIntegrator

A Python module to manipulate data on a Wikibase instance (like Wikidata) through the MediaWiki Wikibase API and the Wikibase SPARQL endpoint.
MIT License
67 stars 14 forks source link

Improve get method in claims.py to avoid KeyError #625

Closed eloiferrer closed 11 months ago

eloiferrer commented 11 months ago

Hi @LeMyst

I've noticed that when calling 'get' in Claims, if there is no claim for the given property, a KeyError will be raised.

I think it would be better to have the same behavior as in qualifiers.py, in which an empty list is returned if there is no qualifier for the given property. Feel free to disregard this though, if there is a reason for the current behavior that I am missing.

LeMyst commented 11 months ago

Hello @eloiferrer Thank you for your contribution! I've updated your commit to fix typing and improved the snak part too with the same idea.