small Wikibase-related code improvements
small Wikibase-related code improvements

- avoid repetition of "data['mainsnak']['datavalue']['value']"
- avoid repetition of "value = self.getTarget().toWikibase()"
- enforce type compliance for quantity datatype

split from Ibe77c51fc5cf3dae8ece533cc5787bf960f0ebed

Change-Id: I79941ae8711b3e9e6e8f0915dd6b911fc28ca440

icyflame/batman,happy5214/pywikibot-core,darthbhyrava/pywikibot-local,magul/pywikibot-core,Darkdadaah/pywikibot-core,npdoty/pywikibot,trishnaguha/pywikibot-core,Darkdadaah/pywikibot-core,magul/pywikibot-core,hasteur/g13bot_tools_new,hasteur/g13bot_tools_new,happy5214/pywikibot-core,VcamX/pywikibot-core,TridevGuha/pywikibot-core,wikimedia/pywikibot-core,smalyshev/pywikibot-core,h4ck3rm1k3/pywikibot-core,xZise/pywikibot-core,valhallasw/pywikibot-core,h4ck3rm1k3/pywikibot-core,wikimedia/pywikibot-core,jayvdb/pywikibot-core,hasteur/g13bot_tools_new,PersianWikipedia/pywikibot-core,npdoty/pywikibot,jayvdb/pywikibot-core,emijrp/pywikibot-core