mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-11-30 13:23:21 +01:00
Avoid slice when the reader wants the full buffer
This commit is contained in:
parent
9e46d00d26
commit
c31bdde31c
@ -118,6 +118,7 @@ class APIFrameHelper:
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
assert self._buffer is not None, "Buffer should be set"
|
assert self._buffer is not None, "Buffer should be set"
|
||||||
if original_pos == 0 and self._buffer_len == new_pos:
|
if original_pos == 0 and self._buffer_len == new_pos:
|
||||||
|
assert self._buffer == self._buffer[original_pos:new_pos]
|
||||||
return self._buffer
|
return self._buffer
|
||||||
return self._buffer[original_pos:new_pos]
|
return self._buffer[original_pos:new_pos]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user