jenkins-bot has submitted this change and it was merged.
Change subject: Code style improvement
......................................................................
Code style improvement
Using "if not total:", although technically correct, is confusing
when an integer is expected, and makes code maintenance more difficult.
Replace with "if total == 0:" which is easier to understand.
Change-Id: I5571600cf180bca7c700f2ada148dbd580b25250
---
M pywikibot/page.py
1 file changed, 8 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 43111d0..fe54ef6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1812,7 +1812,7 @@
yield subcat
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
for item in subcat.subcategories(
@@ -1820,14 +1820,14 @@
yield item
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
else:
for subcat in self._subcats:
yield subcat
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
for item in subcat.subcategories(
@@ -1835,7 +1835,7 @@
yield item
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
@deprecate_arg("startFrom", "startsort")
@@ -1895,7 +1895,7 @@
yield member
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
if not isinstance(recurse, bool) and recurse:
@@ -1913,7 +1913,7 @@
yield article
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
def members(self, recurse=False, namespaces=None, step=None, total=None,
@@ -1925,7 +1925,7 @@
yield member
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
if not isinstance(recurse, bool) and recurse:
@@ -1937,7 +1937,7 @@
yield article
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
def isEmptyCategory(self):
--
To view, visit
https://gerrit.wikimedia.org/r/132593
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5571600cf180bca7c700f2ada148dbd580b25250
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>