diff options
author | ptmcg <ptmcg@austin.rr.com> | 2023-04-01 01:49:02 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2023-04-01 01:49:02 -0500 |
commit | c4cf4a5c1e6c2d2a2dcffe1abae400702efd6426 (patch) | |
tree | 3339c7852d3113359fd66bfb5dd2bc92539ce6f1 /examples/numerics.py | |
parent | 718e858a5d1f1ad371898989da341e3322010edd (diff) | |
download | pyparsing-git-c4cf4a5c1e6c2d2a2dcffe1abae400702efd6426.tar.gz |
Update some examples to latest pyparsing style, PEP8 names
Diffstat (limited to 'examples/numerics.py')
-rw-r--r-- | examples/numerics.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/numerics.py b/examples/numerics.py index 3a1f9e9..f29c508 100644 --- a/examples/numerics.py +++ b/examples/numerics.py @@ -49,18 +49,18 @@ tests = """\ from pyparsing import Regex
comma_decimal = Regex(r"\d{1,2}(([ .])\d\d\d(\2\d\d\d)*)?,\d*")
-comma_decimal.setParseAction(
+comma_decimal.add_parse_action(
lambda t: float(t[0].replace(" ", "").replace(".", "").replace(",", "."))
)
dot_decimal = Regex(r"\d{1,2}(([ ,])\d\d\d(\2\d\d\d)*)?\.\d*")
-dot_decimal.setParseAction(lambda t: float(t[0].replace(" ", "").replace(",", "")))
+dot_decimal.add_parse_action(lambda t: float(t[0].replace(" ", "").replace(",", "")))
decimal = comma_decimal ^ dot_decimal
-decimal.runTests(tests, parseAll=True)
+decimal.run_tests(tests, parse_all=True)
grouped_integer = Regex(r"\d{1,2}(([ .,])\d\d\d(\2\d\d\d)*)?")
-grouped_integer.setParseAction(
+grouped_integer.add_parse_action(
lambda t: int(t[0].replace(" ", "").replace(",", "").replace(".", ""))
)
-grouped_integer.runTests(tests, parseAll=False)
+grouped_integer.run_tests(tests, parse_all=False)
|