mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-05 05:42:37 +02:00
refactor: str -> Path
This commit is contained in:
parent
49c2c58cd8
commit
48748ff00b
1 changed files with 2 additions and 3 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import mimetypes
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
|
|
@ -190,7 +189,7 @@ class OmniParseClient:
|
|||
# Do not verify if only byte data is provided
|
||||
return
|
||||
|
||||
file_ext = os.path.splitext(verify_file_path)[1].lower()
|
||||
file_ext = Path(verify_file_path).suffix
|
||||
if file_ext not in allowed_file_extensions:
|
||||
raise ValueError(f"Not allowed {file_ext} File extension must be one of {allowed_file_extensions}")
|
||||
|
||||
|
|
@ -219,7 +218,7 @@ class OmniParseClient:
|
|||
Returns bytes if only_bytes is True, otherwise returns a tuple (filename, file_bytes, mime_type).
|
||||
"""
|
||||
if isinstance(file_input, (str, Path)):
|
||||
filename = os.path.basename(str(file_input))
|
||||
filename = Path(file_input).name
|
||||
file_bytes = await aread_bin(file_input)
|
||||
|
||||
if only_bytes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue