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

Change subject: [IMPR] ignore original exception in BaseSite.__getattr__()
......................................................................

[IMPR] ignore original exception in BaseSite.__getattr__()

- ignore original exception usually from Family class
  when raising AttributeError in BaseSite.__getattr__()
- also refactor exception message to use f-strings

Change-Id: I119fca320debdaa437c5acb5b61260b5223042c1
---
M pywikibot/site/_basesite.py
1 file changed, 15 insertions(+), 2 deletions(-)

Approvals:
  RoySmith: Looks good to me, but someone else must approve
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py
index 80dacc7..7142d99 100644
--- a/pywikibot/site/_basesite.py
+++ b/pywikibot/site/_basesite.py
@@ -197,8 +197,8 @@
                 f.__doc__ = method.__doc__
             return f
         except AttributeError:
-            raise AttributeError("{} instance has no attribute '{}'"
-                                 .format(self.__class__.__name__, attr))
+            raise AttributeError(f'{type(self).__name__} instance has no '
+                                 f'attribute {attr!r}') from None

     def __str__(self) -> str:
         """Return string representing this Site's name and code."""

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/868132
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: I119fca320debdaa437c5acb5b61260b5223042c1
Gerrit-Change-Number: 868132
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: RoySmith <[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