Skip to content

Commit

Permalink
implement suggestion: use one-liner in _replace_whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
adbar authored and miso-belica committed Oct 18, 2021
1 parent 35fff59 commit a9a1155
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions justext/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ def normalize_whitespace(text):


def _replace_whitespace(match):
"""Normalize all spacing characters that aren't a newline to a space."""
text = match.group()

if "\n" in text or "\r" in text:
return "\n"
return " "
return "\n" if "\n" in text or "\r" in text else " "


def is_blank(string):
Expand Down

0 comments on commit a9a1155

Please sign in to comment.