diff options
author | Hugo <hugovk@users.noreply.github.com> | 2018-08-21 15:40:38 +0300 |
---|---|---|
committer | Hugo <hugovk@users.noreply.github.com> | 2018-08-21 15:40:38 +0300 |
commit | c3dba1ed5f9be226044c7ffaf1cd47adcc7482f4 (patch) | |
tree | 2c0c45c153434d0c6b78c0d5e51448933f959fb8 /examples/parseListString.py | |
parent | 444859662f1829f2d8068fb33cdc375427bf9b6c (diff) | |
download | pyparsing-git-c3dba1ed5f9be226044c7ffaf1cd47adcc7482f4.tar.gz |
Upgrade Python syntax with pyupgrade
Diffstat (limited to 'examples/parseListString.py')
-rw-r--r-- | examples/parseListString.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/parseListString.py b/examples/parseListString.py index d74f3af..d5723b0 100644 --- a/examples/parseListString.py +++ b/examples/parseListString.py @@ -76,7 +76,7 @@ tupleStr.setParseAction( lambda t:tuple(t.asList()) ) listStr <<= (lbrack + Optional(delimitedList(listItem)) + Optional(Suppress(",")) + rbrack)
dictKeyStr = real | integer | quotedString.setParseAction(removeQuotes)
dictStr <<= lbrace + Optional(delimitedList( Group( dictKeyStr + colon + listItem ))) + Optional(Suppress(",")) + rbrace
-dictStr.setParseAction(lambda t: dict((k_v[0],(k_v[1].asList() if isinstance(k_v[1],ParseResults) else k_v[1])) for k_v in t))
+dictStr.setParseAction(lambda t: {k_v[0]:(k_v[1].asList() if isinstance(k_v[1],ParseResults) else k_v[1]) for k_v in t})
test = '[{0: [2], 1: []}, {0: [], 1: [], 2: [,]}, {0: [1, 2,],}]'
print(listStr.parseString(test))
|