jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1324219?usp=email )
Change subject: logentries: Reuse block expiry
......................................................................
logentries: Reuse block expiry
Store the block expiry before calculating its duration.
Reuse that result instead of retrieving the expiry a second time.
Change-Id: Ide6b0cee0aa1113ae7aa6b6b6c3a6a736f13905c
---
M pywikibot/logentries.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index f487f3b..9a4c230 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -191,8 +191,8 @@
:return: datetime.timedelta, or None if block is indefinite.
"""
# Doing the difference is easier than parsing the string
- return (self.expiry() - self.timestamp()
- if self.expiry() is not None else None)
+ expiry = self.expiry()
+ return expiry - self.timestamp() if expiry is not None else None
@cached
def expiry(self) -> pywikibot.Timestamp | None:
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1324219?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ide6b0cee0aa1113ae7aa6b6b6c3a6a736f13905c
Gerrit-Change-Number: 1324219
Gerrit-PatchSet: 3
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]