Skip to content

Commit

Permalink
make sure kwargs that are passed to sftp_client_kwargs are acceptable
Browse files Browse the repository at this point in the history
  • Loading branch information
ttomasz committed Jun 16, 2024
1 parent 62c16a1 commit 0a8a32d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions sshfs/pools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ def __init__(
self.unsafe_terminate = unsafe_terminate
self._stack = AsyncExitStack()

self.other_init_params = kwargs or {}
self.sftp_client_kwargs = {
k: v
for k, v in kwargs.items()
if k
in {
"env",
"send_env",
"path_encoding",
"path_errors",
"sftp_version",
}
}

async def _maybe_new_channel(self):
# If there is no hard limit or the limit is not hit yet
Expand All @@ -49,7 +60,7 @@ async def _maybe_new_channel(self):
):
try:
return await self._stack.enter_async_context(
self.client.start_sftp_client(**self.other_init_params)
self.client.start_sftp_client(**self.sftp_client_kwargs)
)
except ChannelOpenError:
# If we can't create any more channels, then change
Expand Down

0 comments on commit 0a8a32d

Please sign in to comment.