mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-05 07:37:50 +00:00
fix(proxy): compare the stream buffer without narrowing the operand
typing.cast is banned here, and binding the isinstance-narrowed operand only moved the basedpyright error to another rule. Compare the retained frames with the other operand directly; behaviour is unchanged.
This commit is contained in:
parent
340061916e
commit
16367a5969
1 changed files with 2 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from collections import deque
|
||||
from collections.abc import Iterator, Sequence
|
||||
from typing import Final, cast, overload
|
||||
from typing import Final, overload
|
||||
|
||||
_FRAME_SEPARATORS: Final = (b"\r\n\r\n", b"\n\n")
|
||||
|
||||
|
|
@ -108,9 +108,7 @@ class BoundedChunkBuffer(Sequence[bytes]):
|
|||
return len(self._frames())
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if not isinstance(other, Sequence):
|
||||
return False
|
||||
return list(self) == list(cast(Sequence[object], other)) # cast-ok: isinstance narrows to Sequence[Unknown]
|
||||
return list(self) == other
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
return self.total_bytes > 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue