From: Kefu Chai Date: Mon, 1 Feb 2021 10:53:18 +0000 (+0800) Subject: pybind/mgr/hello: use f-string when appropriate X-Git-Tag: v17.1.0~3077^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1e19226a18ae5ff8fee6e7087cd9aa15a99e01df;p=ceph.git pybind/mgr/hello: use f-string when appropriate Signed-off-by: Kefu Chai --- 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: