From 663f7ca9505fb62a1355bc4e0d1db0128db409e9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 24 Nov 2023 11:46:15 -0600 Subject: [PATCH] Speed up plain text frame helper (#692) --- aioesphomeapi/_frame_helper/plain_text.pxd | 6 +++--- aioesphomeapi/_frame_helper/plain_text.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aioesphomeapi/_frame_helper/plain_text.pxd b/aioesphomeapi/_frame_helper/plain_text.pxd index 6e5fe92..d10e194 100644 --- a/aioesphomeapi/_frame_helper/plain_text.pxd +++ b/aioesphomeapi/_frame_helper/plain_text.pxd @@ -21,9 +21,9 @@ cdef class APIPlaintextFrameHelper(APIFrameHelper): add_length=bytes, end_of_frame_pos=cython.uint, length_int=cython.uint, - preamble=cython.uint, - length_high=cython.uint, - maybe_msg_type=cython.uint + preamble=char, + length_high=char, + maybe_msg_type=char ) cpdef data_received(self, object data) diff --git a/aioesphomeapi/_frame_helper/plain_text.py b/aioesphomeapi/_frame_helper/plain_text.py index 19618f7..c45857f 100644 --- a/aioesphomeapi/_frame_helper/plain_text.py +++ b/aioesphomeapi/_frame_helper/plain_text.py @@ -16,7 +16,7 @@ def _varuint_to_bytes(value: _int) -> bytes: if value <= 0x7F: return bytes((value,)) - result = [] + result = bytearray() while value: temp = value & 0x7F value >>= 7