MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / read_file

Function read_file

fastdeploy/entrypoints/openai/run_batch.py:161–167  ·  view source on GitHub ↗
(path_or_url: str)

Source from the content-addressed store, hash-verified

159
160
161async def read_file(path_or_url: str) -> str:
162 if path_or_url.startswith("http://") or path_or_url.startswith("https://"):
163 async with aiohttp.ClientSession() as session, session.get(path_or_url) as resp:
164 return await resp.text()
165 else:
166 with open(path_or_url, encoding="utf-8") as f:
167 return f.read()
168
169
170async def write_local_file(output_path: str, batch_outputs: list[BatchRequestOutput]) -> None:

Callers 3

test_read_file_httpMethod · 0.90
test_read_file_localMethod · 0.90
run_batchFunction · 0.85

Calls 2

getMethod · 0.45
readMethod · 0.45

Tested by 2

test_read_file_httpMethod · 0.72
test_read_file_localMethod · 0.72