mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-04 07:18:27 +01:00
fs.ssh: remove unused vars
This commit is contained in:
committed by
Saugat Pachhai
parent
5d64f6504f
commit
0d48598e4b
+3
-7
@@ -11,8 +11,7 @@ from dvc.utils.fs import as_atomic
|
||||
from ._callback import DEFAULT_CALLBACK
|
||||
from .base import FileSystem
|
||||
|
||||
_SSH_TIMEOUT = 60 * 30
|
||||
_SSH_CONFIG_FILE = os.path.expanduser(os.path.join("~", ".ssh", "config"))
|
||||
DEFAULT_PORT = 22
|
||||
|
||||
|
||||
@wrap_with(threading.Lock())
|
||||
@@ -30,8 +29,6 @@ def ask_password(host, user, port):
|
||||
class SSHFileSystem(FileSystem):
|
||||
scheme = Schemes.SSH
|
||||
REQUIRES = {"sshfs": "sshfs"}
|
||||
|
||||
DEFAULT_PORT = 22
|
||||
PARAM_CHECKSUM = "md5"
|
||||
|
||||
@classmethod
|
||||
@@ -65,11 +62,10 @@ class SSHFileSystem(FileSystem):
|
||||
or user_ssh_config.get("User")
|
||||
or getpass.getuser()
|
||||
)
|
||||
|
||||
login_info["port"] = (
|
||||
config.get("port")
|
||||
or silent(int)(user_ssh_config.get("Port"))
|
||||
or self.DEFAULT_PORT
|
||||
or DEFAULT_PORT
|
||||
)
|
||||
|
||||
if config.get("ask_password") and config.get("password") is None:
|
||||
@@ -91,7 +87,7 @@ class SSHFileSystem(FileSystem):
|
||||
os.path.expanduser(key) for key in raw_keys
|
||||
]
|
||||
|
||||
login_info["timeout"] = config.get("timeout", _SSH_TIMEOUT)
|
||||
login_info["timeout"] = config.get("timeout", 1800)
|
||||
|
||||
# These two settings fine tune the asyncssh to use the
|
||||
# fastest encryption algorithm and disable compression
|
||||
|
||||
@@ -4,6 +4,7 @@ from functools import partial, partialmethod
|
||||
from typing import TYPE_CHECKING, Iterator, Optional
|
||||
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.fs.ssh import DEFAULT_PORT as DEFAULT_SSH_PORT
|
||||
from dvc.fs.ssh import SSHFileSystem
|
||||
from dvc.utils.fs import makedirs
|
||||
|
||||
@@ -68,7 +69,7 @@ class TerraformBackend(BaseMachineBackend):
|
||||
resource = tpi.default_resource(name)
|
||||
return {
|
||||
"host": resource["instance_ip"],
|
||||
"port": SSHFileSystem.DEFAULT_PORT,
|
||||
"port": DEFAULT_SSH_PORT,
|
||||
"username": "ubuntu",
|
||||
"fs_factory": partial(_sshfs, dict(resource)),
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import os
|
||||
import pytest
|
||||
from mock import mock_open, patch
|
||||
|
||||
from dvc.fs.ssh import SSHFileSystem
|
||||
from dvc.fs.ssh import DEFAULT_PORT, SSHFileSystem
|
||||
|
||||
|
||||
def test_get_kwargs_from_urls():
|
||||
@@ -99,7 +99,7 @@ def test_ssh_user(mock_file, config, expected_user):
|
||||
[
|
||||
({"host": "example.com"}, 1234),
|
||||
({"host": "example.com", "port": 4321}, 4321),
|
||||
({"host": "not_in_ssh_config.com"}, SSHFileSystem.DEFAULT_PORT),
|
||||
({"host": "not_in_ssh_config.com"}, DEFAULT_PORT),
|
||||
({"host": "not_in_ssh_config.com", "port": 2222}, 2222),
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user