jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/616342 )
Change subject: [IMPR] Simplify Revision.sha1 ......................................................................
[IMPR] Simplify Revision.sha1
detached from 05da8018ecd9053e0be73594825deefcb6cca239
Change-Id: I9029cb802d27d34afd7d46b4b7ed894abd4f8f76 --- M pywikibot/page/__init__.py 1 file changed, 1 insertion(+), 5 deletions(-)
Approvals: Matěj Suchánek: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py index ecf0281..78d559c 100644 --- a/pywikibot/page/__init__.py +++ b/pywikibot/page/__init__.py @@ -5871,12 +5871,8 @@ None and does not cache anything. @rtype: str or None """ - if self._sha1 is None: - if self.text is None: - # No text? No sha1 then. - return None + if self._sha1 is None and self.text is not None: self._sha1 = hashlib.sha1(self.text.encode('utf8')).hexdigest() - return self._sha1
@deprecated(since='20200329', future_warning=True)
pywikibot-commits@lists.wikimedia.org