summaryrefslogtreecommitdiff
path: root/examples/searchParserAppDemo.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/searchParserAppDemo.py
parent41752aa52cc97c710474bb2972cceab057b52ad4 (diff)
downloadpyparsing-git-53d1b4a6f48a53c4c4ec4ac7031362b691c0366d.tar.gz
Blacken the project (#141)
Diffstat (limited to 'examples/searchParserAppDemo.py')
-rw-r--r--examples/searchParserAppDemo.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/examples/searchParserAppDemo.py b/examples/searchParserAppDemo.py
index d1bf8ba..c608132 100644
--- a/examples/searchParserAppDemo.py
+++ b/examples/searchParserAppDemo.py
@@ -1,15 +1,24 @@
from searchparser import SearchQueryParser
-products = [ "grape juice", "grape jelly", "orange juice", "orange jujubees",
- "strawberry jam", "prune juice", "prune butter", "orange marmalade",
- "grapefruit juice" ]
+products = [
+ "grape juice",
+ "grape jelly",
+ "orange juice",
+ "orange jujubees",
+ "strawberry jam",
+ "prune juice",
+ "prune butter",
+ "orange marmalade",
+ "grapefruit juice",
+]
+
class FruitSearchParser(SearchQueryParser):
def GetWord(self, word):
- return { p for p in products if p.startswith(word + " ") }
+ return {p for p in products if p.startswith(word + " ")}
def GetWordWildcard(self, word):
- return { p for p in products if p.startswith(word[:-1]) }
+ return {p for p in products if p.startswith(word[:-1])}
def GetQuotes(self, search_string, tmp_result):
result = set()
@@ -17,7 +26,7 @@ class FruitSearchParser(SearchQueryParser):
return result
def GetNot(self, not_set):
- return set( products ) - not_set
+ return set(products) - not_set
parser = FruitSearchParser()
@@ -31,4 +40,4 @@ tests = """\
for t in tests:
print(t.strip())
print(parser.Parse(t))
- print('')
+ print("")