mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-29 10:56:22 +02:00
feat: Action Node + exclude parameter
refactor: awrite
This commit is contained in:
parent
0adabfe53f
commit
8bf7d3186a
7 changed files with 58 additions and 53 deletions
|
|
@ -537,6 +537,14 @@ async def aread(file_path: str) -> str:
|
|||
return content
|
||||
|
||||
|
||||
async def awrite(filename: str | Path, data: str):
|
||||
"""Write file asynchronously."""
|
||||
pathname = Path(filename)
|
||||
pathname.parent.mkdir(parents=True, exist_ok=True)
|
||||
async with aiofiles.open(str(pathname), mode="w", encoding="utf-8") as writer:
|
||||
await writer.write(data)
|
||||
|
||||
|
||||
async def read_file_block(filename: str | Path, lineno: int, end_lineno: int):
|
||||
if not Path(filename).exists():
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue