jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101844?usp=email )
Change subject: IMPR: use or operator instead of ternary operator for the if
condition
......................................................................
IMPR: use or operator instead of ternary operator for the if condition
Change-Id: I89a20d51effe04ee22e2349f3339ce25858a60d8
---
M pywikibot/diff.py
M pywikibot/site/_datasite.py
M scripts/category.py
3 files changed, 4 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 005da21..d1ec07c 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -139,7 +139,7 @@
# or color whole line to be added.
fmt = fmt if fmt.startswith('?') else ''
fmt = fmt[:min(len(fmt), len(line1))]
- fmt = fmt if fmt else None
+ fmt = fmt or None
yield self.color_line(line1, fmt)
# handle last line
@@ -155,7 +155,7 @@
# or color whole line to be added.
fmt = line1 if line1.startswith('?') else ''
fmt = fmt[:min(len(fmt), len(line2))]
- fmt = fmt if fmt else None
+ fmt = fmt or None
yield self.color_line(line2, fmt)
def color_line(self, line: str, line_ref: str | None = None) -> str:
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py
index fd27d56..e96d494 100644
--- a/pywikibot/site/_datasite.py
+++ b/pywikibot/site/_datasite.py
@@ -188,7 +188,7 @@
# TODO: When props is empty it results in
# an empty string ('&props=') but it should
# result in a missing entry.
- props=props if props else False)
+ props=props or False)
req = self.simple_request(**params)
data = req.submit()
if 'success' not in data:
diff --git a/scripts/category.py b/scripts/category.py
index 12ac25e..15200be 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -710,7 +710,7 @@
# Category is deleted.
self.deletion_comment = i18n.twtranslate(
self.site, 'category-was-disbanded')
- self.move_comment = move_comment if move_comment else self.comment
+ self.move_comment = move_comment or self.comment
def run(self) -> None:
"""The main bot function that does all the work.
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101844?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: I89a20d51effe04ee22e2349f3339ce25858a60d8
Gerrit-Change-Number: 1101844
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[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]