jenkins-bot submitted this change.

View Change

Approvals: D3r1ck01: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] derive abstract WbRepresentation from abstract base class abc.ABC

Change-Id: I78144e78b4059fe4adc8d873bbf255d138f72a2b
---
M pywikibot/_wbtypes.py
1 file changed, 5 insertions(+), 1 deletion(-)

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

To view, visit change 616050. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I78144e78b4059fe4adc8d873bbf255d138f72a2b
Gerrit-Change-Number: 616050
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged