Skip to content

Commit

Permalink
Use functools.partial for kwargs in ensure_awaitable (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
padraic-shafer authored Mar 15, 2024
1 parent 52ae5d2 commit 7ef1c94
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tiled/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,7 @@ async def ensure_awaitable(func, *args, **kwargs):
else:
# run_sync() does not apply **kwargs to func
# https://github.com/agronholm/anyio/issues/414
def func_with_kwargs(*args):
return func(*args, **kwargs)

return await anyio.to_thread.run_sync(func_with_kwargs, *args)
return await anyio.to_thread.run_sync(functools.partial(func, **kwargs), *args)


def path_from_uri(uri):
Expand Down

0 comments on commit 7ef1c94

Please sign in to comment.