From 1e19226a18ae5ff8fee6e7087cd9aa15a99e01df Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 1 Feb 2021 18:53:18 +0800 Subject: [PATCH] pybind/mgr/hello: use f-string when appropriate Signed-off-by: Kefu Chai --- src/pybind/mgr/hello/module.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/hello/module.py b/src/pybind/mgr/hello/module.py index 395a1bee1584a..d4b50f401fcd3 100644 --- a/src/pybind/mgr/hello/module.py +++ b/src/pybind/mgr/hello/module.py @@ -82,14 +82,12 @@ class Hello(MgrModule): """ Say hello """ - out = '' if person_name is None: - out = 'Hello, ' + cast(str, self.get_module_option('place')) + who = cast(str, self.get_module_option('place')) else: - out = f'Hello, {person_name}' - if self.get_module_option('emphatic'): - out += '!' - return HandleCommandResult(stdout=out) + who = person_name + fin = '!' if self.get_module_option('emphatic') else '' + return HandleCommandResult(stdout=f'Hello, {who}{fin}') @CLIReadCommand('count') def count(self, num: int) -> HandleCommandResult: -- 2.39.5