Merge pull request #289 from YunoHost/actions/black

Format Python code with Black
This commit is contained in:
Alexandre Aubin 2021-09-03 15:56:37 +02:00 committed by GitHub
commit 10cb1ebefe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -525,7 +525,15 @@ class Interface:
credentials = self.prompt(msg, True, False, color="yellow")
return authenticator.authenticate_credentials(credentials=credentials)
def prompt(self, message, is_password=False, confirm=False, color="blue", prefill="", is_multiline=False):
def prompt(
self,
message,
is_password=False,
confirm=False,
color="blue",
prefill="",
is_multiline=False,
):
"""Prompt for a value
Keyword arguments:
@ -550,14 +558,16 @@ class Interface:
return value
else:
while True:
value = input(colorize(m18n.g("edit_text_question", message), color))
value = input(
colorize(m18n.g("edit_text_question", message), color)
)
value = value.lower().strip()
if value in ["", "n", "no"]:
return prefill
elif value in ['y', 'yes']:
elif value in ["y", "yes"]:
break
initial_message = prefill.encode('utf-8')
initial_message = prefill.encode("utf-8")
with tempfile.NamedTemporaryFile(suffix=".tmp") as tf:
tf.write(initial_message)