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/numerics.py | |
parent | 41752aa52cc97c710474bb2972cceab057b52ad4 (diff) | |
download | pyparsing-git-53d1b4a6f48a53c4c4ec4ac7031362b691c0366d.tar.gz |
Blacken the project (#141)
Diffstat (limited to 'examples/numerics.py')
-rw-r--r-- | examples/numerics.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/examples/numerics.py b/examples/numerics.py index 0af3cae..3a1f9e9 100644 --- a/examples/numerics.py +++ b/examples/numerics.py @@ -48,15 +48,19 @@ tests = """\ from pyparsing import Regex
-comma_decimal = Regex(r'\d{1,2}(([ .])\d\d\d(\2\d\d\d)*)?,\d*')
-comma_decimal.setParseAction(lambda t: float(t[0].replace(' ','').replace('.','').replace(',','.')))
+comma_decimal = Regex(r"\d{1,2}(([ .])\d\d\d(\2\d\d\d)*)?,\d*")
+comma_decimal.setParseAction(
+ 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 = Regex(r"\d{1,2}(([ ,])\d\d\d(\2\d\d\d)*)?\.\d*")
+dot_decimal.setParseAction(lambda t: float(t[0].replace(" ", "").replace(",", "")))
decimal = comma_decimal ^ dot_decimal
decimal.runTests(tests, parseAll=True)
-grouped_integer = Regex(r'\d{1,2}(([ .,])\d\d\d(\2\d\d\d)*)?')
-grouped_integer.setParseAction(lambda t: int(t[0].replace(' ','').replace(',','').replace('.','')))
+grouped_integer = Regex(r"\d{1,2}(([ .,])\d\d\d(\2\d\d\d)*)?")
+grouped_integer.setParseAction(
+ lambda t: int(t[0].replace(" ", "").replace(",", "").replace(".", ""))
+)
grouped_integer.runTests(tests, parseAll=False)
|