diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-10-31 21:10:28 -0700 |
---|---|---|
committer | Paul McGuire <ptmcg@users.noreply.github.com> | 2019-10-31 23:10:28 -0500 |
commit | 53d1b4a6f48a53c4c4ec4ac7031362b691c0366d (patch) | |
tree | 088ad3cf3561b78a00af4fb2fd474f4a2b8ca70c /examples/dictExample.py | |
parent | 41752aa52cc97c710474bb2972cceab057b52ad4 (diff) | |
download | pyparsing-git-53d1b4a6f48a53c4c4ec4ac7031362b691c0366d.tar.gz |
Blacken the project (#141)
Diffstat (limited to 'examples/dictExample.py')
-rw-r--r-- | examples/dictExample.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/dictExample.py b/examples/dictExample.py index 7d3d45d..ebc437f 100644 --- a/examples/dictExample.py +++ b/examples/dictExample.py @@ -19,15 +19,19 @@ testData = """ """
# define grammar for datatable
-heading = (pp.Literal(
-"+-------+------+------+------+------+------+------+------+------+") +
-"| | A1 | B1 | C1 | D1 | A2 | B2 | C2 | D2 |" +
-"+=======+======+======+======+======+======+======+======+======+").suppress()
+heading = (
+ pp.Literal("+-------+------+------+------+------+------+------+------+------+")
+ + "| | A1 | B1 | C1 | D1 | A2 | B2 | C2 | D2 |"
+ + "+=======+======+======+======+======+======+======+======+======+"
+).suppress()
vert = pp.Literal("|").suppress()
number = pp.Word(pp.nums)
-rowData = pp.Group( vert + pp.Word(pp.alphas) + vert + pp.delimitedList(number,"|") + vert )
+rowData = pp.Group(
+ vert + pp.Word(pp.alphas) + vert + pp.delimitedList(number, "|") + vert
+)
trailing = pp.Literal(
-"+-------+------+------+------+------+------+------+------+------+").suppress()
+ "+-------+------+------+------+------+------+------+------+------+"
+).suppress()
datatable = heading + pp.Dict(pp.ZeroOrMore(rowData)) + trailing
@@ -42,7 +46,7 @@ data.pprint() print("data keys=", list(data.keys()))
# use dict-style access to values
-print("data['min']=", data['min'])
+print("data['min']=", data["min"])
# use attribute-style access to values (if key is a valid Python identifier)
print("data.max", data.max)
|