Lokal_Profil added a comment. |
In T186200#4240251, @Dvorapa wrote:I'm not familiar with Wikidata, but at least this seems to make the code cleaner, improve its readability, and reduce code-complexity on Codeclimate.
Just make sure you will solve some of the issues in #pywikibot-wikidata belonging to this part as they would require to rewrite the code once more when being solved after the rewrite.
At a quick glance T170432: Function to add a claim with source in a single edit/T112577: Make it possible to add a qualifier together with a new claim using new_claim.addQualifier() are probably the most interesting ones to keep in mind. For those to be possible there would have to be some way of preparing references/qualifiers without the addSource/addQualifier calling the API. This refactoring doesnt solve that but I also don't believe it makes it harder. Possibly we want to add a function to BaseClaim which addSource/addQualifier/setTarget (etc.) extends so that the postponement mechanism can be added there.
T124139: Claim new method has_source/T76615: Claim equality operator would be fixed/easier to fix by the refactoring (possibly no longer needeed with the above same_as suggestion)
T107712: Use narrow API calls instead of wbeditentity in Pywikibot Would be helped by the refactor.
Per T108440: Pull out all Wikibase-related parts of pywikibot to pywikibot/wikibase and use it as a submodule it might be wort taking a look at https://github.com/wikimedia/pywikibot-wikibase to see how/if it tackled this. Or even revisit the question about moving all wikibase code into a submodule.
Cc: Dvorapa, Lokal_Profil, Aklapper, matej_suchanek, pywikibot-bugs-list, Sc4s2cg, Magul, Tbscho, MayS, Framawiki, Salgo60, Mdupont, JJMC89, Avicennasis, jayvdb, Ricordisamoa, Dalba, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list pywikibot-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs