]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/hello: use f-string when appropriate 39186/head
authorKefu Chai <kchai@redhat.com>
Mon, 1 Feb 2021 10:53:18 +0000 (18:53 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Feb 2021 12:50:07 +0000 (20:50 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/hello/module.py

index 395a1bee1584a137b38d62675d085076bfff2352..d4b50f401fcd357e2b70f767dc8819e942c7ce2f 100644 (file)
@@ -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: