jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/616050 )
Change subject: [IMPR] derive abstract WbRepresentation from abstract base class abc.ABC ......................................................................
[IMPR] derive abstract WbRepresentation from abstract base class abc.ABC
Change-Id: I78144e78b4059fe4adc8d873bbf255d138f72a2b --- M pywikibot/_wbtypes.py 1 file changed, 5 insertions(+), 1 deletion(-)
Approvals: D3r1ck01: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py index e074829..46d57a7 100644 --- a/pywikibot/_wbtypes.py +++ b/pywikibot/_wbtypes.py @@ -5,22 +5,26 @@ # # Distributed under the terms of the MIT license. # +import abc import json
-class WbRepresentation: +class WbRepresentation(abc.ABC):
"""Abstract class for Wikibase representations."""
+ @abc.abstractmethod def __init__(self): """Constructor.""" raise NotImplementedError
+ @abc.abstractmethod def toWikibase(self): """Convert representation to JSON for the Wikibase API.""" raise NotImplementedError
@classmethod + @abc.abstractmethod def fromWikibase(cls, json): """Create a representation object based on JSON from Wikibase API.""" raise NotImplementedError
pywikibot-commits@lists.wikimedia.org