From 99d45a3c30812b76284d893287287955547963a2 Mon Sep 17 00:00:00 2001 From: demberto Date: Thu, 29 Sep 2022 21:36:35 +0530 Subject: [PATCH] fix: `U16TupleEvent`, closes #68 --- CHANGELOG.md | 2 ++ pyflp/_events.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cfc5f3..172acbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - String are decoded as UTF16 when version is 11.5+ now [#65]. - `Insert.stereo_separation` docstring for maximum, minimum value. +- `U16TupleEvent.value` [#68]. ### Removed @@ -41,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#58]: https://github.com/demberto/PyFLP/issues/58 [#65]: https://github.com/demberto/PyFLP/issues/65 [#66]: https://github.com/demberto/PyFLP/issues/66 +[#68]: https://github.com/demberto/PyFLP/issues/68 ## 2.0.0a1 - 2022-09-21 diff --git a/pyflp/_events.py b/pyflp/_events.py index d12072d..cbbadc2 100644 --- a/pyflp/_events.py +++ b/pyflp/_events.py @@ -21,6 +21,7 @@ import abc import enum +import struct import sys import warnings from collections.abc import Hashable, Sized @@ -65,6 +66,7 @@ T = TypeVar("T") T_co = TypeVar("T_co", covariant=True) +UShortTuple = struct.Struct("HH") # ! MRO erros when deriving from SupportsBytes on Python 3.7 @@ -303,11 +305,11 @@ class U16TupleEvent(DWordEventBase[Tuple[int, int]]): @property def value(self) -> tuple[int, int]: - return UInt.unpack(self._raw) + return UShortTuple.unpack(self._raw) @value.setter def value(self, value: tuple[int, int]): - self._raw = UInt.pack(*value) + self._raw = UShortTuple.pack(*value) class ColorEvent(DWordEventBase[colour.Color]):