From: Anubhav Shelat <ashelat@redhat.com>
To: linux-rt-users@vger.kernel.org
Cc: Anubhav Shelat <ashelat@redhat.com>
Subject: [PATCH v2 07/10] rteval: Use f-strings in services.py
Date: Thu, 1 Jun 2023 16:27:33 -0400 [thread overview]
Message-ID: <20230601202734.813515-8-ashelat@redhat.com> (raw)
In-Reply-To: <20230601202734.813515-1-ashelat@redhat.com>
Use f-strings in services.py
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
---
rteval/sysinfo/services.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/rteval/sysinfo/services.py b/rteval/sysinfo/services.py
index c85980e19165..a87b4abeea76 100644
--- a/rteval/sysinfo/services.py
+++ b/rteval/sysinfo/services.py
@@ -55,17 +55,17 @@ class SystemServices:
break
if not servicesdir:
raise RuntimeError("No services dir (init.d) found on your system")
- self.__log(Log.DEBUG, "Services located in %s, going through each service file to check status" % servicesdir)
+ self.__log(Log.DEBUG, f"Services located in {servicesdir}, going through each service file to check status")
ret_services = {}
for service in glob.glob(os.path.join(servicesdir, '*')):
servicename = os.path.basename(service)
if not [1 for p in reject if fnmatch.fnmatch(servicename, p)] \
and os.access(service, os.X_OK):
- cmd = '%s -qs "\(^\|\W\)status)" %s' % (getcmdpath('grep'), service)
+ cmd = f'{getcmdpath("grep")} -qs "\(^\|\W\)status)" {service}'
c = subprocess.Popen(cmd, shell=True, encoding='utf-8')
c.wait()
if c.returncode == 0:
- cmd = ['env', '-i', 'LANG="%s"' % os.environ['LANG'], 'PATH="%s"' % os.environ['PATH'], 'TERM="%s"' % os.environ['TERM'], service, 'status']
+ cmd = ['env', '-i', f'LANG="{os.environ["LANG"]}"', f'PATH="{os.environ["PATH"]}"', f'TERM="{os.environ["TERM"]}"', service, 'status']
c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
c.wait()
if c.returncode == 0 and (c.stdout.read() or c.stderr.read()):
@@ -79,8 +79,8 @@ class SystemServices:
def __get_services_systemd(self):
ret_services = {}
- cmd = '%s list-unit-files -t service --no-legend' % getcmdpath('systemctl')
- self.__log(Log.DEBUG, "cmd: %s" % cmd)
+ cmd = f'{getcmdpath("systemctl")} list-unit-files -t service --no-legend'
+ self.__log(Log.DEBUG, f"cmd: {cmd}")
c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
for p in c.stdout:
# p are lines like b'servicename.service status'
@@ -133,7 +133,7 @@ def unit_test(rootdir):
return 0
except Exception as err:
- print("** EXCEPTION: %s" % str(err))
+ print(f"** EXCEPTION: {str(err)}")
return 1
--
2.31.1
next prev parent reply other threads:[~2023-06-01 20:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 20:27 [PATCH v2 00/10] Cover Letter Anubhav Shelat
2023-06-01 20:27 ` [PATCH v2 01/10] rteval: Use f-strings in rtevalclient.py Anubhav Shelat
2023-06-05 19:28 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 02/10] rteval: Use f-strings in rtevalConfig Anubhav Shelat
2023-06-05 19:31 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 03/10] rteval: Use f-strings in cputopology Anubhav Shelat
2023-06-12 18:32 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 04/10] rteval: Use f-strings in kernel.py Anubhav Shelat
2023-06-12 18:35 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 05/10] rteval: Use f-strings in memory.py Anubhav Shelat
2023-06-12 18:39 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 06/10] rteval: Use f-strings in osinfo Anubhav Shelat
2023-06-12 18:50 ` John Kacur
2023-06-01 20:27 ` Anubhav Shelat [this message]
2023-06-12 18:58 ` [PATCH v2 07/10] rteval: Use f-strings in services.py John Kacur
2023-06-01 20:27 ` [PATCH v2 08/10] rteval: Use f-strings in tools.py Anubhav Shelat
2023-06-12 18:59 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 09/10] Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class Anubhav Shelat
2023-06-06 15:22 ` John Kacur
2023-06-01 20:27 ` [PATCH v2 10/10] rteval: Use f-strings in __init__.py Anubhav Shelat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230601202734.813515-8-ashelat@redhat.com \
--to=ashelat@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).