diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2020-03-27 16:13:50 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-03-27 16:33:17 +0100 |
commit | 7d153624c3a3543f0b8f906144e35105a5d48801 (patch) | |
tree | 7e194063ba97250403bc6380afabc83e4fa9b8e0 /glucometerutils/common.py | |
parent | Bring up command line error as we only support Python 3.7+ now. (diff) | |
download | glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.tar glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.tar.gz glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.tar.bz2 glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.tar.lz glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.tar.xz glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.tar.zst glucometerutils-7d153624c3a3543f0b8f906144e35105a5d48801.zip |
Diffstat (limited to 'glucometerutils/common.py')
-rw-r--r-- | glucometerutils/common.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/glucometerutils/common.py b/glucometerutils/common.py index ddb2607..bf944c8 100644 --- a/glucometerutils/common.py +++ b/glucometerutils/common.py @@ -6,7 +6,7 @@ import datetime import enum import textwrap -from typing import Any, Dict, Optional, Sequence +from typing import Any, Dict, Optional, Sequence, Union import attr @@ -91,6 +91,10 @@ class KetoneReading: timestamp: datetime.datetime value: float comment: str = "" + measure_method: MeasurementMethod = attr.ib( + default=MeasurementMethod.BLOOD_SAMPLE, + validator=attr.validators.in_({MeasurementMethod.BLOOD_SAMPLE}), + ) extra_data: Dict[str, Any] = attr.Factory(dict) def as_csv(self, unit: Unit) -> str: @@ -100,7 +104,7 @@ class KetoneReading: return '"%s","%.2f","%s","%s"' % ( self.timestamp, self.value, - MeasurementMethod.BLOOD_SAMPLE.value, + self.measure_method.value, self.comment, ) @@ -123,6 +127,9 @@ class TimeAdjustment: ) +AnyReading = Union[GlucoseReading, KetoneReading, TimeAdjustment] + + @attr.s(auto_attribs=True) class MeterInfo: """General information about the meter. |