objects.fs: use getpass for prompts

Note that this will change the behaviour of DVC to always show
prompt even in --quiet mode, which is what we need.
Previously it'd prompt without any message.
This commit is contained in:
Saugat Pachhai (सौगात)
2022-05-17 16:06:27 +05:45
committed by skshetry
parent d82e094b13
commit 092eda183c
2 changed files with 4 additions and 10 deletions
+2 -5
View File
@@ -1,9 +1,9 @@
import threading
from getpass import getpass
from typing import BinaryIO, Union
from funcy import cached_property, memoize, wrap_with
from dvc import prompt
from dvc.scheme import Schemes
from .._callback import DEFAULT_CALLBACK, FsspecCallback
@@ -13,10 +13,7 @@ from ..base import AnyFSPath, FileSystem
@wrap_with(threading.Lock())
@memoize
def ask_password(host, user):
return prompt.password(
"Enter a password for "
"host '{host}' user '{user}'".format(host=host, user=user)
)
return getpass(f"Enter a password for host '{host}' user '{user}':\n")
def make_context(ssl_verify):
+2 -5
View File
@@ -4,7 +4,6 @@ import threading
from funcy import cached_property, memoize, silent, wrap_prop, wrap_with
from dvc import prompt
from dvc.scheme import Schemes
from .._callback import DEFAULT_CALLBACK
@@ -17,11 +16,9 @@ DEFAULT_PORT = 22
@wrap_with(threading.Lock())
@memoize
def ask_password(host, user, port):
return prompt.password(
return getpass.getpass(
"Enter a private key passphrase or a password for "
"host '{host}' port '{port}' user '{user}'".format(
host=host, port=port, user=user
)
f"host '{host}' port '{port}' user '{user}':\n"
)