diff options
-rw-r--r-- | .pre-commit-config.yaml | 12 | ||||
-rw-r--r-- | glucometerutils/drivers/fslibre.py | 5 | ||||
-rw-r--r-- | glucometerutils/drivers/otultraeasy.py | 9 | ||||
-rw-r--r-- | glucometerutils/drivers/otverio2015.py | 9 | ||||
-rw-r--r-- | glucometerutils/drivers/otverioiq.py | 9 | ||||
-rw-r--r-- | glucometerutils/drivers/td4277.py | 10 | ||||
-rw-r--r-- | glucometerutils/drivers/tests/test_contourusb.py | 1 | ||||
-rw-r--r-- | glucometerutils/drivers/tests/test_fsoptium.py | 1 | ||||
-rw-r--r-- | glucometerutils/drivers/tests/test_otultra2.py | 1 | ||||
-rw-r--r-- | glucometerutils/drivers/tests/test_otultraeasy.py | 1 | ||||
-rw-r--r-- | glucometerutils/drivers/tests/test_td4277.py | 1 | ||||
-rw-r--r-- | glucometerutils/support/contourusb.py | 3 | ||||
-rw-r--r-- | glucometerutils/support/tests/test_construct_extras.py | 2 | ||||
-rw-r--r-- | glucometerutils/support/tests/test_freestyle.py | 1 | ||||
-rwxr-xr-x | glucometerutils/support/tests/test_lifescan.py | 1 | ||||
-rw-r--r-- | glucometerutils/tests/test_common.py | 1 | ||||
-rwxr-xr-x | reversing_tools/abbott/extract_freestyle.py | 5 | ||||
-rw-r--r-- | setup.py | 3 |
18 files changed, 50 insertions, 25 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be139a6..1ed80f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,23 +4,23 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v3.2.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/timothycrosley/isort - rev: 4.3.21 +- repo: https://github.com/PyCQA/isort + rev: 5.5.1 hooks: - id: isort additional_dependencies: - toml -- repo: https://github.com/python/black - rev: 19.10b0 +- repo: https://github.com/psf/black + rev: 20.8b1 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.9 + rev: 3.8.3 hooks: - id: flake8 - repo: https://github.com/fsfe/reuse-tool diff --git a/glucometerutils/drivers/fslibre.py b/glucometerutils/drivers/fslibre.py index 3917b65..07fc504 100644 --- a/glucometerutils/drivers/fslibre.py +++ b/glucometerutils/drivers/fslibre.py @@ -40,7 +40,10 @@ _BASE_ENTRY_MAP = ( ) # Fields of the records returned by $history? -_HISTORY_ENTRY_MAP = _BASE_ENTRY_MAP + ((13, "value"), (15, "errors"),) +_HISTORY_ENTRY_MAP = _BASE_ENTRY_MAP + ( + (13, "value"), + (15, "errors"), +) # Fields of the results returned by $arresult? where type = 2 _ARRESULT_TYPE2_ENTRY_MAP = ( diff --git a/glucometerutils/drivers/otultraeasy.py b/glucometerutils/drivers/otultraeasy.py index 22798c0..ec834f0 100644 --- a/glucometerutils/drivers/otultraeasy.py +++ b/glucometerutils/drivers/otultraeasy.py @@ -49,7 +49,8 @@ _SERIAL_NUMBER_REQUEST = construct.Const( ) _SERIAL_NUMBER_RESPONSE = construct.Struct( - success=_COMMAND_SUCCESS, serial_number=construct.GreedyString(encoding="ascii"), + success=_COMMAND_SUCCESS, + serial_number=construct.GreedyString(encoding="ascii"), ) _DATETIME_REQUEST = construct.Struct( @@ -78,11 +79,13 @@ _GLUCOSE_UNIT_RESPONSE = construct.Struct( _MEMORY_ERASE_REQUEST = construct.Const(b"\x05\x1A") _READING_COUNT_RESPONSE = construct.Struct( - const=construct.Const(b"\x0f"), count=construct.Int16ul, + const=construct.Const(b"\x0f"), + count=construct.Int16ul, ) _READ_RECORD_REQUEST = construct.Struct( - const=construct.Const(b"\x05\x1f"), record_id=construct.Int16ul, + const=construct.Const(b"\x05\x1f"), + record_id=construct.Int16ul, ) _READING_RESPONSE = construct.Struct( diff --git a/glucometerutils/drivers/otverio2015.py b/glucometerutils/drivers/otverio2015.py index a3ec888..b7b4c93 100644 --- a/glucometerutils/drivers/otverio2015.py +++ b/glucometerutils/drivers/otverio2015.py @@ -50,11 +50,13 @@ _QUERY_REQUEST = construct.Struct( ) _QUERY_RESPONSE = construct.Struct( - const=construct.Const(b"\x03\x06"), value=construct.CString(encoding="utf-16-le"), + const=construct.Const(b"\x03\x06"), + value=construct.CString(encoding="utf-16-le"), ) _READ_PARAMETER_REQUEST = construct.Struct( - const=construct.Const(b"\x03"), selector=construct.Enum(construct.Byte, unit=0x04), + const=construct.Const(b"\x03"), + selector=construct.Enum(construct.Byte, unit=0x04), ) _READ_UNIT_RESPONSE = construct.Struct( @@ -80,7 +82,8 @@ _MEMORY_ERASE_REQUEST = construct.Const(b"\x03\x1a") _READ_RECORD_COUNT_REQUEST = construct.Const(b"\x03\x27\x00") _READ_RECORD_COUNT_RESPONSE = construct.Struct( - success=_COMMAND_SUCCESS, count=construct.Int16ul, + success=_COMMAND_SUCCESS, + count=construct.Int16ul, ) _READ_RECORD_REQUEST = construct.Struct( diff --git a/glucometerutils/drivers/otverioiq.py b/glucometerutils/drivers/otverioiq.py index 617c778..a5a7553 100644 --- a/glucometerutils/drivers/otverioiq.py +++ b/glucometerutils/drivers/otverioiq.py @@ -42,7 +42,8 @@ _VERSION_RESPONSE = construct.Struct( _SERIAL_NUMBER_REQUEST = construct.Const(b"\x03\x0b\x01\x02") _SERIAL_NUMBER_RESPONSE = construct.Struct( - success=_COMMAND_SUCCESS, serial_number=construct.CString(encoding="ascii"), + success=_COMMAND_SUCCESS, + serial_number=construct.CString(encoding="ascii"), ) _READ_RTC_REQUEST = construct.Const(b"\x03\x20\x02") @@ -71,11 +72,13 @@ _MEMORY_ERASE_REQUEST = construct.Const(b"\x03\x1a") _READ_RECORD_COUNT_REQUEST = construct.Const(b"\x03\x27\x00") _READ_RECORD_COUNT_RESPONSE = construct.Struct( - success=_COMMAND_SUCCESS, count=construct.Int16ul, + success=_COMMAND_SUCCESS, + count=construct.Int16ul, ) _READ_RECORD_REQUEST = construct.Struct( - const=construct.Const(b"\x03\x21"), record_id=construct.Int16ul, + const=construct.Const(b"\x03\x21"), + record_id=construct.Int16ul, ) _MEAL_FLAG = { diff --git a/glucometerutils/drivers/td4277.py b/glucometerutils/drivers/td4277.py index ff04e31..ecbd2ed 100644 --- a/glucometerutils/drivers/td4277.py +++ b/glucometerutils/drivers/td4277.py @@ -75,7 +75,9 @@ _MODEL_STRUCT = construct.Struct( ) _DATETIME_STRUCT = construct.Struct( - day=construct.Int16ul, minute=construct.Byte, hour=construct.Byte, + day=construct.Int16ul, + minute=construct.Byte, + hour=construct.Byte, ) _DAY_BITSTRUCT = construct.BitStruct( @@ -85,11 +87,13 @@ _DAY_BITSTRUCT = construct.BitStruct( ) _READING_COUNT_STRUCT = construct.Struct( - count=construct.Int16ul, unknown=construct.Int16ul, + count=construct.Int16ul, + unknown=construct.Int16ul, ) _READING_SELECTION_STRUCT = construct.Struct( - record_id=construct.Int16ul, const=construct.Const(b"\x00\x00"), + record_id=construct.Int16ul, + const=construct.Const(b"\x00\x00"), ) _MEAL_FLAG = { diff --git a/glucometerutils/drivers/tests/test_contourusb.py b/glucometerutils/drivers/tests/test_contourusb.py index 9392af8..edda495 100644 --- a/glucometerutils/drivers/tests/test_contourusb.py +++ b/glucometerutils/drivers/tests/test_contourusb.py @@ -9,6 +9,7 @@ from unittest.mock import Mock from absl.testing import absltest + from glucometerutils.support import contourusb diff --git a/glucometerutils/drivers/tests/test_fsoptium.py b/glucometerutils/drivers/tests/test_fsoptium.py index 1c51ac2..848e9c6 100644 --- a/glucometerutils/drivers/tests/test_fsoptium.py +++ b/glucometerutils/drivers/tests/test_fsoptium.py @@ -9,6 +9,7 @@ import datetime from absl.testing import parameterized + from glucometerutils import exceptions from glucometerutils.drivers import fsoptium diff --git a/glucometerutils/drivers/tests/test_otultra2.py b/glucometerutils/drivers/tests/test_otultra2.py index 093f4f4..45b1883 100644 --- a/glucometerutils/drivers/tests/test_otultra2.py +++ b/glucometerutils/drivers/tests/test_otultra2.py @@ -9,6 +9,7 @@ from unittest import mock from absl.testing import parameterized + from glucometerutils import exceptions from glucometerutils.drivers import otultra2 from glucometerutils.support import lifescan diff --git a/glucometerutils/drivers/tests/test_otultraeasy.py b/glucometerutils/drivers/tests/test_otultraeasy.py index 9a6a470..00ea049 100644 --- a/glucometerutils/drivers/tests/test_otultraeasy.py +++ b/glucometerutils/drivers/tests/test_otultraeasy.py @@ -7,6 +7,7 @@ # pylint: disable=protected-access,missing-docstring from absl.testing import absltest + from glucometerutils.drivers import otultraeasy diff --git a/glucometerutils/drivers/tests/test_td4277.py b/glucometerutils/drivers/tests/test_td4277.py index 8238977..031381f 100644 --- a/glucometerutils/drivers/tests/test_td4277.py +++ b/glucometerutils/drivers/tests/test_td4277.py @@ -9,6 +9,7 @@ import datetime from absl.testing import parameterized + from glucometerutils.drivers import td4277 diff --git a/glucometerutils/support/contourusb.py b/glucometerutils/support/contourusb.py index cf78d69..c61ab41 100644 --- a/glucometerutils/support/contourusb.py +++ b/glucometerutils/support/contourusb.py @@ -72,8 +72,7 @@ class Mode(enum.Enum): class ContourHidDevice(driver.GlucometerDevice): - """Base class implementing the ContourUSB HID common protocol. - """ + """Base class implementing the ContourUSB HID common protocol.""" blocksize = 64 diff --git a/glucometerutils/support/tests/test_construct_extras.py b/glucometerutils/support/tests/test_construct_extras.py index 3f8f1f6..c2894cb 100644 --- a/glucometerutils/support/tests/test_construct_extras.py +++ b/glucometerutils/support/tests/test_construct_extras.py @@ -9,8 +9,8 @@ import datetime import construct - from absl.testing import absltest + from glucometerutils.support import construct_extras _TEST_DATE1 = datetime.datetime(1970, 1, 2, 0, 0) diff --git a/glucometerutils/support/tests/test_freestyle.py b/glucometerutils/support/tests/test_freestyle.py index 2124df7..fd3f403 100644 --- a/glucometerutils/support/tests/test_freestyle.py +++ b/glucometerutils/support/tests/test_freestyle.py @@ -7,6 +7,7 @@ # pylint: disable=protected-access,missing-docstring from absl.testing import absltest + from glucometerutils.support import freestyle diff --git a/glucometerutils/support/tests/test_lifescan.py b/glucometerutils/support/tests/test_lifescan.py index dbb338a..b54ca07 100755 --- a/glucometerutils/support/tests/test_lifescan.py +++ b/glucometerutils/support/tests/test_lifescan.py @@ -9,6 +9,7 @@ import array from absl.testing import absltest + from glucometerutils.support import lifescan diff --git a/glucometerutils/tests/test_common.py b/glucometerutils/tests/test_common.py index 478a58b..442d223 100644 --- a/glucometerutils/tests/test_common.py +++ b/glucometerutils/tests/test_common.py @@ -10,6 +10,7 @@ import datetime import unittest from absl.testing import parameterized + from glucometerutils import common TEST_DATETIME = datetime.datetime(2018, 1, 1, 0, 30, 45) diff --git a/reversing_tools/abbott/extract_freestyle.py b/reversing_tools/abbott/extract_freestyle.py index 52eeaf2..0c0888a 100755 --- a/reversing_tools/abbott/extract_freestyle.py +++ b/reversing_tools/abbott/extract_freestyle.py @@ -232,7 +232,10 @@ def main(): print( usbmon.chatter.dump_bytes( - packet.direction, message, prefix=f"[{message_type}]", print_empty=True, + packet.direction, + message, + prefix=f"[{message_type}]", + print_empty=True, ), "\n", ) @@ -3,10 +3,9 @@ # SPDX-FileCopyrightText: © 2013 The glucometerutils Authors # SPDX-License-Identifier: MIT -from setuptools import setup - # Ensure it's present. import setuptools_scm # noqa: F401 +from setuptools import setup extras_require = { # These are all the drivers' dependencies. Optional dependencies are |