22import posixpath
33import shlex
44import stat
5- import threading
65import weakref
76from contextlib import AsyncExitStack , suppress
87from datetime import datetime
@@ -44,8 +43,8 @@ def __init__(
4443 host: str
4544 SSH host to connect.
4645 **kwargs: Any
47- Any option that will be passed to either the top level `AsyncFileSystem`
48- or the `asyncssh.connect`.
46+ Any option that will be passed to either the top level
47+ `AsyncFileSystem` or the `asyncssh.connect`.
4948 pool_type: sshfs.pools.base.BaseSFTPChannelPool
5049 Pool manager to use (when doing concurrent operations together,
5150 pool managers offer the flexibility of prioritizing channels
@@ -54,12 +53,14 @@ def __init__(
5453
5554 super ().__init__ (self , ** kwargs )
5655
56+ max_sessions = kwargs .pop ("max_sessions" , _DEFAULT_MAX_SESSIONS )
57+ if max_sessions <= _SHELL_CHANNELS :
58+ raise ValueError (
59+ f"max_sessions must be greater than { _SHELL_CHANNELS } "
60+ )
5761 _client_args = kwargs .copy ()
5862 _client_args .setdefault ("known_hosts" , None )
5963
60- max_sessions = kwargs .get ("max_sessions" , _DEFAULT_MAX_SESSIONS )
61- assert max_sessions > _SHELL_CHANNELS
62-
6364 self ._stack = AsyncExitStack ()
6465 self .active_executors = 0
6566 self ._client , self ._pool = self .connect (
0 commit comments