Skip to content

Commit da82e76

Browse files
Update config.py to be compatible with SSHClientConfig load method
1 parent 1c70799 commit da82e76

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

sshfs/config.py

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import getpass
22
from contextlib import suppress
3-
from pathlib import Path
4-
3+
from pathlib import Path, PurePath
4+
from typing import Sequence, Union
55
from asyncssh.config import SSHClientConfig
66

77
SSH_CONFIG = Path("~", ".ssh", "config").expanduser()
8-
9-
8+
FilePath = Union[str, PurePath]
109
def parse_config(
1110
*, host, user=(), port=(), local_user=None, config_files=None
1211
):
@@ -19,13 +18,24 @@ def parse_config(
1918

2019
last_config = None
2120
reload = False
22-
23-
return SSHClientConfig.load(
24-
last_config,
25-
config_files,
26-
reload,
27-
local_user,
28-
user,
29-
host,
30-
port,
21+
config = SSHClientConfig(
22+
last_config =last_config,
23+
reload = reload,
24+
canonical = False,
25+
final=False,
26+
local_user = local_user,
27+
user = user,
28+
host = host,
29+
port = port,
3130
)
31+
32+
if config_files:
33+
if isinstance(config_files, (str, PurePath)):
34+
paths: Sequence[FilePath] = [config_files]
35+
else:
36+
paths = config_files
37+
38+
for path in paths:
39+
config.parse(Path(path))
40+
config.loaded = True
41+
return config

0 commit comments

Comments
 (0)