From 33ca556f0a5c0e4867557d27b62bea85ecd1849a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 16 Dec 2024 14:18:53 +1000 Subject: [PATCH 1/3] protocol: fix missing whitespace around / --- tuhi/protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuhi/protocol.py b/tuhi/protocol.py index 0153d27..fa35336 100644 --- a/tuhi/protocol.py +++ b/tuhi/protocol.py @@ -1771,7 +1771,7 @@ def __str__(self): if self.timestamp is not None: t = time.strftime('%y%m%d%H%M%S', time.gmtime(self.timestamp)) else: - t = time.strftime(f'boot+{self.time_offset/1000}s') + t = time.strftime(f'boot+{self.time_offset / 1000}s') return f'StrokeHeader: time: {t} new layer: {self.is_new_layer}, pen type: {self.pen_type}, pen id: {self.pen_id:#x}' From b79d883c2b54c949490b80ef0e665c9f33e52e07 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 16 Dec 2024 14:24:08 +1000 Subject: [PATCH 2/3] Remove braces around assert() and del() statements Fixes flake8: E275 missing whitespace after keyword --- tuhi/ble.py | 6 +++--- tuhi/dbusclient.py | 4 ++-- tuhi/gui/config.py | 2 +- tuhi/protocol.py | 12 ++++++------ tuhi/wacom.py | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tuhi/ble.py b/tuhi/ble.py index 7b18d9f..6e2919e 100755 --- a/tuhi/ble.py +++ b/tuhi/ble.py @@ -36,8 +36,8 @@ def __init__(self, obj): ''' self.obj = obj - assert(self.interface is not None) - assert(self.uuid is not None) + assert self.interface is not None + assert self.uuid is not None self._property_callbacks = {} self.interface.connect('g-properties-changed', @@ -117,7 +117,7 @@ def __init__(self, om, obj): self.om = om self.logger = logger.getChild(self.address) - assert(self.interface is not None) + assert self.interface is not None self.logger.debug(f'Device {self.objpath} - {self.name}') diff --git a/tuhi/dbusclient.py b/tuhi/dbusclient.py index 0dc7064..5757d73 100644 --- a/tuhi/dbusclient.py +++ b/tuhi/dbusclient.py @@ -111,7 +111,7 @@ def property(self, name): return p def terminate(self): - del(self.proxy) + del self.proxy class _DBusSystemObject(_DBusObject): @@ -284,7 +284,7 @@ def _on_mgr_devices_updated(self, manager, pspec): if d.address == self.address: self.is_registering = False self.manager.disconnect(self.s1) - del(self.s1) + del self.s1 logger.info(f'{self}: Registration successful') self.emit('registered') diff --git a/tuhi/gui/config.py b/tuhi/gui/config.py index e4eb824..3203563 100644 --- a/tuhi/gui/config.py +++ b/tuhi/gui/config.py @@ -78,7 +78,7 @@ def orientation(self): @orientation.setter def orientation(self, orientation): - assert(orientation in ['landscape', 'portrait']) + assert orientation in ['landscape', 'portrait'] self._add_key('Device', 'Orientation', orientation) @GObject.Property diff --git a/tuhi/protocol.py b/tuhi/protocol.py index fa35336..6d63eaa 100644 --- a/tuhi/protocol.py +++ b/tuhi/protocol.py @@ -68,10 +68,10 @@ def little_u16(x): 2-byte array, the return value is a 16-bit integer. ''' if isinstance(x, int): - assert(x <= 0xffff and x >= 0x0000) + assert x <= 0xffff and x >= 0x0000 return x.to_bytes(2, byteorder='little') else: - assert(len(x) == 2) + assert len(x) == 2 return int.from_bytes(x, byteorder='little') @@ -82,10 +82,10 @@ def little_u32(x): 4-byte array, the return value is a 16-bit integer. ''' if isinstance(x, int): - assert(x <= 0xffffffff and x >= 0x00000000) + assert x <= 0xffffffff and x >= 0x00000000 return x.to_bytes(4, byteorder='little') else: - assert(len(x) == 4) + assert len(x) == 4 return int.from_bytes(x, byteorder='little') @@ -96,10 +96,10 @@ def little_u64(x): 4-byte array, the return value is a 64-bit integer. ''' if isinstance(x, int): - assert(x <= 0xffffffffffffffff and x >= 0x0000000000000000) + assert x <= 0xffffffffffffffff and x >= 0x0000000000000000 return x.to_bytes(8, byteorder='little') else: - assert(len(x) == 8) + assert len(x) == 8 return int.from_bytes(x, byteorder='little') diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 348f44d..6fde76c 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -707,7 +707,7 @@ class WacomProtocolSpark(WacomProtocolBase): orientation = 'portrait' def __init__(self, device, uuid, protocol_version=ProtocolVersion.SPARK): - assert(protocol_version >= ProtocolVersion.SPARK) + assert protocol_version >= ProtocolVersion.SPARK super().__init__(device, uuid, protocol_version=protocol_version) @@ -734,7 +734,7 @@ class WacomProtocolSlate(WacomProtocolSpark): orientation = 'portrait' def __init__(self, device, uuid, protocol_version=ProtocolVersion.SLATE): - assert(protocol_version >= ProtocolVersion.SLATE) + assert protocol_version >= ProtocolVersion.SLATE super().__init__(device, uuid, protocol_version=protocol_version) device.connect_gatt_value(SYSEVENT_NOTIFICATION_CHRC_UUID, self._on_sysevent_data_received) @@ -808,7 +808,7 @@ class WacomProtocolIntuosPro(WacomProtocolSlate): orientation = 'landscape' def __init__(self, device, uuid, protocol_version=ProtocolVersion.INTUOS_PRO): - assert(protocol_version >= ProtocolVersion.INTUOS_PRO) + assert protocol_version >= ProtocolVersion.INTUOS_PRO super().__init__(device, uuid, protocol_version=protocol_version) @classmethod From 7d593f873bfd5130b5262464d1c8061b15ff4302 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 11 Dec 2024 08:54:49 +1000 Subject: [PATCH 3/3] CI: update the CI to current versions Ubuntu 24.10 is not yet available so let's use the prior one. --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3226e7b..cc21392 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,19 +6,19 @@ env: jobs: meson_test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install dependencies run: | sudo apt-get update -yq sudo apt-get install -yq --no-install-suggests --no-install-recommends $UBUNTU_PACKAGES - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: meson run: meson builddir - name: ninja run: ninja -C builddir test - name: capture build logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ always() }} # even if we fail with: name: meson logs