jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/876354 )

Change subject: [bugfix] Fix Claim.__repr__ for stub instances
......................................................................

[bugfix] Fix Claim.__repr__ for stub instances

Bug: T326453
Change-Id: Ib48870a8c4f9f24416f9843fd59d35230a9fdf64
---
M pywikibot/page/_wikibase.py
1 file changed, 15 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index a8640d6..405af2b 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -1458,8 +1458,11 @@

     def __repr__(self) -> str:
         """Return the representation string."""
-        return '{cls_name}.fromJSON({}, {})'.format(
-            repr(self.repo), self.toJSON(), cls_name=type(self).__name__)
+        cls_name = type(self).__name__
+        if self.target:
+            return f'{cls_name}.fromJSON({self.repo!r}, {self.toJSON()})'
+        else:
+            return f'{cls_name}({self.repo!r}, {self.id!r})'

     def __eq__(self, other):
         if not isinstance(other, self.__class__):

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/876354
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib48870a8c4f9f24416f9843fd59d35230a9fdf64
Gerrit-Change-Number: 876354
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: RPI2026F1 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to