summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2020-03-29 18:30:59 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-04-09 20:03:18 +0200
commit7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14 (patch)
treef6cc3a53b2e12760430a1c0839bee698cebcc540
parentAdd some base hooks to pre-commit checks. (diff)
downloadglucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.tar
glucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.tar.gz
glucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.tar.bz2
glucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.tar.lz
glucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.tar.xz
glucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.tar.zst
glucometerutils-7435b383fbbc44dc69e42ca7b1fb9ad0d9579d14.zip
-rw-r--r--glucometerutils/driver.py (renamed from glucometerutils/support/driver_base.py)0
-rw-r--r--glucometerutils/drivers/accuchek_reports.py5
-rw-r--r--glucometerutils/drivers/fsoptium.py6
-rw-r--r--glucometerutils/drivers/otultra2.py6
-rw-r--r--glucometerutils/drivers/otultraeasy.py5
-rw-r--r--glucometerutils/drivers/otverio2015.py6
-rw-r--r--glucometerutils/drivers/otverioiq.py11
-rw-r--r--glucometerutils/drivers/sdcodefree.py6
-rw-r--r--glucometerutils/drivers/td4277.py6
-rw-r--r--glucometerutils/support/contourusb.py5
-rw-r--r--glucometerutils/support/freestyle.py6
11 files changed, 28 insertions, 34 deletions
diff --git a/glucometerutils/support/driver_base.py b/glucometerutils/driver.py
index d630031..d630031 100644
--- a/glucometerutils/support/driver_base.py
+++ b/glucometerutils/driver.py
diff --git a/glucometerutils/drivers/accuchek_reports.py b/glucometerutils/drivers/accuchek_reports.py
index 7fd9df9..0f2c983 100644
--- a/glucometerutils/drivers/accuchek_reports.py
+++ b/glucometerutils/drivers/accuchek_reports.py
@@ -21,8 +21,7 @@ import glob
import os
from typing import Dict, Generator, NoReturn, Optional
-from glucometerutils import common, exceptions
-from glucometerutils.support import driver_base
+from glucometerutils import common, driver, exceptions
_UNIT_MAP = {
"mmol/l": common.Unit.MMOL_L,
@@ -47,7 +46,7 @@ _TIME_FORMAT = "%H:%M"
_DATETIME_FORMAT = " ".join((_DATE_FORMAT, _TIME_FORMAT))
-class Device(driver_base.GlucometerDriver):
+class Device(driver.GlucometerDriver):
def __init__(self, device: Optional[str]) -> None:
if not device or not os.path.isdir(device):
raise exceptions.CommandLineError(
diff --git a/glucometerutils/drivers/fsoptium.py b/glucometerutils/drivers/fsoptium.py
index 3eb921f..789cdfd 100644
--- a/glucometerutils/drivers/fsoptium.py
+++ b/glucometerutils/drivers/fsoptium.py
@@ -22,8 +22,8 @@ import logging
import re
from typing import Generator, NoReturn, Sequence
-from glucometerutils import common, exceptions
-from glucometerutils.support import driver_base, serial
+from glucometerutils import common, driver, exceptions
+from glucometerutils.support import serial
_CLOCK_RE = re.compile(
r"^Clock:\t(?P<month>[A-Z][a-z]{2}) (?P<day>[0-9]{2}) (?P<year>[0-9]{4})\t"
@@ -86,7 +86,7 @@ def _parse_clock(datestr: str) -> datetime.datetime:
return datetime.datetime(year, month, day, hour, minute, second)
-class Device(serial.SerialDevice, driver_base.GlucometerDriver):
+class Device(serial.SerialDevice, driver.GlucometerDriver):
BAUDRATE = 19200
DEFAULT_CABLE_ID = "1a61:3420"
diff --git a/glucometerutils/drivers/otultra2.py b/glucometerutils/drivers/otultra2.py
index 1e458e3..9b74da8 100644
--- a/glucometerutils/drivers/otultra2.py
+++ b/glucometerutils/drivers/otultra2.py
@@ -18,8 +18,8 @@ import datetime
import re
from typing import Generator
-from glucometerutils import common, exceptions
-from glucometerutils.support import driver_base, lifescan, serial
+from glucometerutils import common, driver, exceptions
+from glucometerutils.support import lifescan, serial
# The following two hashes are taken directly from LifeScan's documentation
_MEAL_CODES = {
@@ -130,7 +130,7 @@ def _parse_datetime(response: str) -> datetime.datetime:
return datetime.datetime(2000 + year, month, day, hour, minute, second)
-class Device(serial.SerialDevice, driver_base.GlucometerDriver):
+class Device(serial.SerialDevice, driver.GlucometerDriver):
BAUDRATE = 9600
DEFAULT_CABLE_ID = "067b:2303" # Generic PL2303 cable.
diff --git a/glucometerutils/drivers/otultraeasy.py b/glucometerutils/drivers/otultraeasy.py
index 4b7d278..00f00b6 100644
--- a/glucometerutils/drivers/otultraeasy.py
+++ b/glucometerutils/drivers/otultraeasy.py
@@ -23,10 +23,9 @@ from typing import Any, Dict, Generator, Optional
import construct
-from glucometerutils import common
+from glucometerutils import common, driver
from glucometerutils.support import (
construct_extras,
- driver_base,
lifescan,
lifescan_binary_protocol,
serial,
@@ -118,7 +117,7 @@ def _make_packet(
)
-class Device(serial.SerialDevice, driver_base.GlucometerDriver):
+class Device(serial.SerialDevice, driver.GlucometerDriver):
BAUDRATE = 9600
DEFAULT_CABLE_ID = "067b:2303" # Generic PL2303 cable.
TIMEOUT = 0.5
diff --git a/glucometerutils/drivers/otverio2015.py b/glucometerutils/drivers/otverio2015.py
index fb85b6a..44d03b1 100644
--- a/glucometerutils/drivers/otverio2015.py
+++ b/glucometerutils/drivers/otverio2015.py
@@ -32,8 +32,8 @@ import construct
from pyscsi.pyscsi.scsi import SCSI
from pyscsi.pyscsi.scsi_device import SCSIDevice
-from glucometerutils import common, exceptions
-from glucometerutils.support import driver_base, lifescan, lifescan_binary_protocol
+from glucometerutils import common, driver, exceptions
+from glucometerutils.support import lifescan, lifescan_binary_protocol
# This device uses SCSI blocks as registers.
_REGISTER_SIZE = 512
@@ -107,7 +107,7 @@ _READ_RECORD_RESPONSE = construct.Struct(
)
-class Device(driver_base.GlucometerDriver):
+class Device(driver.GlucometerDriver):
def __init__(self, device: Optional[str]) -> None:
if not device:
raise exceptions.CommandLineError(
diff --git a/glucometerutils/drivers/otverioiq.py b/glucometerutils/drivers/otverioiq.py
index 181c899..f7b87dc 100644
--- a/glucometerutils/drivers/otverioiq.py
+++ b/glucometerutils/drivers/otverioiq.py
@@ -23,13 +23,8 @@ from typing import Any, Dict, Generator, Optional
import construct
-from glucometerutils import common
-from glucometerutils.support import (
- driver_base,
- lifescan,
- lifescan_binary_protocol,
- serial,
-)
+from glucometerutils import common, driver
+from glucometerutils.support import lifescan, lifescan_binary_protocol, serial
_PACKET = lifescan_binary_protocol.LifeScanPacket(False)
@@ -99,7 +94,7 @@ _READING_RESPONSE = construct.Struct(
)
-class Device(serial.SerialDevice, driver_base.GlucometerDriver):
+class Device(serial.SerialDevice, driver.GlucometerDriver):
BAUDRATE = 38400
DEFAULT_CABLE_ID = "10c4:85a7" # Specific ID for embedded cp210x
TIMEOUT = 0.5
diff --git a/glucometerutils/drivers/sdcodefree.py b/glucometerutils/drivers/sdcodefree.py
index 93b7adb..35ff8c7 100644
--- a/glucometerutils/drivers/sdcodefree.py
+++ b/glucometerutils/drivers/sdcodefree.py
@@ -26,8 +26,8 @@ from typing import Generator, NoReturn
import construct
-from glucometerutils import common, exceptions
-from glucometerutils.support import driver_base, serial
+from glucometerutils import common, driver, exceptions
+from glucometerutils.support import serial
def xor_checksum(msg: bytes) -> int:
@@ -84,7 +84,7 @@ _READING = construct.Struct(
)
-class Device(serial.SerialDevice, driver_base.GlucometerDriver):
+class Device(serial.SerialDevice, driver.GlucometerDriver):
BAUDRATE = 38400
DEFAULT_CABLE_ID = "10c4:ea60" # Generic cable.
TIMEOUT = 300 # We need to wait for data from the device.
diff --git a/glucometerutils/drivers/td4277.py b/glucometerutils/drivers/td4277.py
index 443f69c..7ee177d 100644
--- a/glucometerutils/drivers/td4277.py
+++ b/glucometerutils/drivers/td4277.py
@@ -23,8 +23,8 @@ from typing import Generator, NoReturn, Optional, Tuple
import construct
-from glucometerutils import common, exceptions
-from glucometerutils.support import driver_base, serial
+from glucometerutils import common, driver, exceptions
+from glucometerutils.support import serial
class Direction(enum.Enum):
@@ -132,7 +132,7 @@ def _select_record(record_id: int) -> bytes:
return _READING_SELECTION_STRUCT.build({"record_id": record_id})
-class Device(serial.SerialDevice, driver_base.GlucometerDriver):
+class Device(serial.SerialDevice, driver.GlucometerDriver):
BAUDRATE = 19200
TIMEOUT = 0.5
diff --git a/glucometerutils/support/contourusb.py b/glucometerutils/support/contourusb.py
index 1b2f802..e27347e 100644
--- a/glucometerutils/support/contourusb.py
+++ b/glucometerutils/support/contourusb.py
@@ -17,7 +17,8 @@ import enum
import re
from typing import Dict, Generator, List, Optional, Tuple
-from glucometerutils.support import driver_base, hiddevice
+from glucometerutils import driver
+from glucometerutils.support import hiddevice
# regexr.com/4k6jb
_HEADER_RECORD_RE = re.compile(
@@ -70,7 +71,7 @@ class Mode(enum.Enum):
COMMAND = enum.auto()
-class ContourHidDevice(driver_base.GlucometerDriver):
+class ContourHidDevice(driver.GlucometerDriver):
"""Base class implementing the ContourUSB HID common protocol.
"""
diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py
index b70d993..9cdbff9 100644
--- a/glucometerutils/support/freestyle.py
+++ b/glucometerutils/support/freestyle.py
@@ -17,8 +17,8 @@ from typing import AnyStr, Callable, Iterator, List, Optional, Tuple
import construct
-from glucometerutils import exceptions
-from glucometerutils.support import driver_base, hiddevice
+from glucometerutils import driver, exceptions
+from glucometerutils.support import hiddevice
_INIT_COMMAND = 0x01
_INIT_RESPONSE = 0x71
@@ -286,7 +286,7 @@ class FreeStyleHidSession:
return csv.reader(records_str.split("\r\n"))
-class FreeStyleHidDevice(driver_base.GlucometerDriver):
+class FreeStyleHidDevice(driver.GlucometerDriver):
"""Base class implementing the FreeStyle HID common protocol.
This class implements opening, initializing the connection and sending