jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/425832 )
Change subject: [IMPR] Simplify expression for old_position in Link.parse()
......................................................................
[IMPR] Simplify expression for old_position in Link.parse()
str.find(':') is not 0 if it not starts with that token. In that case
old_position should become 0 and 1 if it starts with ':'. This can be
simplified with int(str.startswith(':')) because int(True) is 1.
Change-Id: I97c474391c427287b2aaa68ee8ee392238e770d1
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 46a43e1..3fcdf15 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5543,7 +5543,7 @@
self._is_interwiki = False
ns_prefix = False
- old_position = 0 if self._text.find(':') != 0 else 1
+ old_position = int(self._text.startswith(':'))
colon_position = self._text.find(':', old_position)
first_other_site = None
while colon_position >= 0:
--
To view, visit
https://gerrit.wikimedia.org/r/425832
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I97c474391c427287b2aaa68ee8ee392238e770d1
Gerrit-Change-Number: 425832
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>