Skip to content

Commit

Permalink
Merge "IMPR: use or operator instead of ternary operator for the if c…
Browse files Browse the repository at this point in the history
…ondition"
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Dec 10, 2024
2 parents 84c2ec7 + 7127ca0 commit 7b5a185
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pywikibot/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def format_diff(self) -> Iterable[str]:
# 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
Expand All @@ -150,7 +150,7 @@ def format_diff(self) -> Iterable[str]:
# 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:
Expand Down
2 changes: 1 addition & 1 deletion pywikibot/site/_datasite.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def loadcontent(self, identification, *props):
# 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:
Expand Down
2 changes: 1 addition & 1 deletion scripts/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ def __init__(self, oldcat,
# 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.
Expand Down

0 comments on commit 7b5a185

Please sign in to comment.