mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-12 12:06:04 +00:00
fix(mypy): resolve union type and list annotation errors
- batches.py: Fix bytes/memoryview union type narrowing issue - encoder_utils.py: Add type annotation for masks_list 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a7866dff48
commit
6fa7af52f9
2 changed files with 5 additions and 6 deletions
|
|
@ -358,11 +358,10 @@ class ReferenceBatchesImpl(Batches):
|
|||
|
||||
# TODO(SECURITY): do something about large files
|
||||
file_content_response = await self.files_api.openai_retrieve_file_content(batch.input_file_id)
|
||||
# Handle both bytes and memoryview types
|
||||
body = file_content_response.body
|
||||
if isinstance(body, memoryview):
|
||||
body = bytes(body)
|
||||
file_content = body.decode("utf-8")
|
||||
# Handle both bytes and memoryview types - convert to bytes unconditionally
|
||||
# (bytes(x) returns x if already bytes, creates new bytes from memoryview otherwise)
|
||||
body_bytes = bytes(file_content_response.body)
|
||||
file_content = body_bytes.decode("utf-8")
|
||||
for line_num, line in enumerate(file_content.strip().split("\n"), 1):
|
||||
if line.strip(): # skip empty lines
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue