From f85da4c81d576b772e594718ad57a316cf544ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 28 Dec 2017 12:06:02 +0000 Subject: Use Python3 Enum class for glucose units. This makes the code more idiomatic and less brittle. --- glucometer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'glucometer.py') diff --git a/glucometer.py b/glucometer.py index 9ec781c..abed647 100755 --- a/glucometer.py +++ b/glucometer.py @@ -48,7 +48,8 @@ def main(): parser_dump = subparsers.add_parser( 'dump', help='Dump the readings stored in the device.') parser_dump.add_argument( - '--unit', action='store', choices=common.VALID_UNITS, + '--unit', action='store', + choices=[unit.value for unit in common.Unit], help='Select the unit to use for the dumped data.') parser_dump.add_argument( '--sort-by', action='store', default='timestamp', -- cgit v1.2.3