mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-19 14:48:38 +03:00
Update chia/util/files.py
Co-authored-by: Kyle Altendorf <sda@fstab.net>
This commit is contained in:
parent
0c943993bd
commit
5280cde7d2
@ -73,8 +73,10 @@ async def write_file_async(
|
||||
mode: Literal["w+", "w+b"] = "w+" if type(data) == str else "w+b"
|
||||
temp_file_path: Path
|
||||
async with tempfile.NamedTemporaryFile(dir=file_path.parent, mode=mode, delete=False) as f:
|
||||
temp_file_path = f.name
|
||||
await f.write(data)
|
||||
# Ignoring type error since it is not obvious how to tie the type of the data
|
||||
# being passed in to the type of the file object, etc.
|
||||
temp_file_path = f.name # type: ignore[assignment]
|
||||
await f.write(data) # type: ignore[arg-type]
|
||||
await f.flush()
|
||||
os.fsync(f.fileno())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user