Skip to content
Closed
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers =
[options]
install_requires =
fsspec>=2021.8.1
asyncssh>=2.11.0,<3
asyncssh==2.19.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it this way:

Suggested change
asyncssh==2.19.0
asyncssh>=2.11.0,<3

packages = find:

[options.extras_require]
Expand Down
25 changes: 20 additions & 5 deletions sshfs/config.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
import getpass
from contextlib import suppress
from pathlib import Path
import asyncssh

from asyncssh.config import SSHClientConfig

SSH_CONFIG = Path("~", ".ssh", "config").expanduser()


def parse_config(
*, host, user=(), port=(), local_user=None, config_files=None
):
def parse_config(*, host, user=(), port=(), local_user=None, config_files=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add a warning that the function is deprecated.

if config_files is None:
config_files = [SSH_CONFIG]

if local_user is None:
with suppress(KeyError):
with suppress(OSError): # Use OSError as getuser() might raise this.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep KeyError too. I see that it raises OSError now in 3.13, but that is not true for older versions.

Suggested change
with suppress(OSError): # Use OSError as getuser() might raise this.
with suppress(OSError): # Use OSError as getuser() might raise this.

local_user = getpass.getuser()

last_config = None
reload = False

return SSHClientConfig.load(
# Check asyncssh version
version = tuple(map(int, asyncssh.__version__.split(".")))
if version <= (2, 18, 0): # Compare version properly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if version <= (2, 18, 0): # Compare version properly
if version < (2, 19, 0): # Compare version properly

return SSHClientConfig.load(
last_config,
config_files,
reload,
local_user,
user,
host,
port,
)
canonical = False # Fixed typo
final = False # Fixed typo
return SSHClientConfig.load(
last_config,
config_files,
reload,
canonical, # Use correct parameter
final, # Use correct parameter
Comment on lines +40 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these comments are unnecessary.

local_user,
user,
host,
Expand Down
Loading