summaryrefslogtreecommitdiff
path: root/examples/removeLineBreaks.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-10-31 21:10:28 -0700
committerPaul McGuire <ptmcg@users.noreply.github.com>2019-10-31 23:10:28 -0500
commit53d1b4a6f48a53c4c4ec4ac7031362b691c0366d (patch)
tree088ad3cf3561b78a00af4fb2fd474f4a2b8ca70c /examples/removeLineBreaks.py
parent41752aa52cc97c710474bb2972cceab057b52ad4 (diff)
downloadpyparsing-git-53d1b4a6f48a53c4c4ec4ac7031362b691c0366d.tar.gz
Blacken the project (#141)
Diffstat (limited to 'examples/removeLineBreaks.py')
-rw-r--r--examples/removeLineBreaks.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/removeLineBreaks.py b/examples/removeLineBreaks.py
index 1a77231..03315be 100644
--- a/examples/removeLineBreaks.py
+++ b/examples/removeLineBreaks.py
@@ -18,11 +18,14 @@ line_end = pp.LineEnd()
# define an expression for the body of a line of text - use a predicate condition to
# accept only lines with some content.
def mustBeNonBlank(t):
- return t[0] != ''
+ return t[0] != ""
# could also be written as
# return bool(t[0])
-lineBody = pp.SkipTo(line_end).addCondition(mustBeNonBlank, message="line body can't be empty")
+
+lineBody = pp.SkipTo(line_end).addCondition(
+ mustBeNonBlank, message="line body can't be empty"
+)
# now define a line with a trailing lineEnd, to be replaced with a space character
textLine = lineBody + line_end().setParseAction(pp.replaceWith(" "))