Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set snaktype on DataTypes #235

Closed
pgrond opened this issue Sep 24, 2021 · 3 comments
Closed

Can't set snaktype on DataTypes #235

pgrond opened this issue Sep 24, 2021 · 3 comments
Labels
question Further information is requested v0.12.x
Milestone

Comments

@pgrond
Copy link
Contributor

pgrond commented Sep 24, 2021

The BaseDataType inhertits from Claim. The documentation states that you can add a property snaktype to the BaseDataType. However, Claim does not have a property named snaktype and so it throws an error TypeError: __init__() got an unexpected keyword argument 'snak_type'

Am I missing something or is this a bug in the rewrite? What should the correct way of working be? If this is a bug, can maybe you can give a direction for your proposed solution, so I might be able to help with a fix.

@LeMyst LeMyst added the v0.12.x label Sep 24, 2021
@LeMyst
Copy link
Owner

LeMyst commented Sep 24, 2021

Hello @pgrond
It's more like an outdated docstring in BaseDatatype.
If you want to set the snaktype of a BaseDataType/Claim (I use ExternalID in my example) you can do:

from wikibaseintegrator.datatypes import ExternalID
from wikibaseintegrator.wbi_enums import WikibaseSnakType

externalid = ExternalID()
externalid.mainsnak.snaktype = WikibaseSnakType.NO_VALUE

@LeMyst LeMyst added the question Further information is requested label Sep 24, 2021
@LeMyst
Copy link
Owner

LeMyst commented Sep 24, 2021

I'm currently adding typing everywhere (#141) and after this phase I will update the documentation (#209).

@pgrond
Copy link
Contributor Author

pgrond commented Sep 27, 2021

Clear, thanks for the explanation.

@pgrond pgrond closed this as completed Sep 27, 2021
@LeMyst LeMyst added this to the 0.12 milestone Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v0.12.x
Projects
None yet
Development

No branches or pull requests

2 participants