Skip to content

Commit

Permalink
Merge pull request #28 from hugoideler/master
Browse files Browse the repository at this point in the history
Fix argument for aiofiles.open()
  • Loading branch information
zxdavb authored Oct 27, 2024
2 parents eb7093c + feb81bb commit fa1deb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/evohomeasync2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def _write(filename: TextIOWrapper | Any, content: str) -> None:
"""Write to a file, async if possible and sync otherwise."""

try:
async with aiofiles.open(filename, "w") as fp: # type: ignore[call-overload]
async with aiofiles.open(filename.name, "w") as fp: # type: ignore[call-overload]
await fp.write(content)
except TypeError: # if filename is sys.stdout:
filename.write(content)
Expand Down Expand Up @@ -358,7 +358,7 @@ async def set_schedules(
evo: EvohomeClient = ctx.obj[SZ_EVO]

# will TypeError if filename is sys.stdin
async with aiofiles.open(filename) as fp: # type: ignore[call-overload]
async with aiofiles.open(filename.name) as fp: # type: ignore[call-overload]
content = await fp.read()

success = await _get_tcs(evo, loc_idx).set_schedules(json.loads(content))
Expand Down

0 comments on commit fa1deb3

Please sign in to comment.