Update to fstrings

This commit is contained in:
Melissa LeBlanc-Williams 2022-05-31 12:03:56 -07:00
parent 3df36b8185
commit 8314d1ca16

View file

@ -125,7 +125,7 @@ class Shell:
if message is None:
self.error("Exiting due to error")
else:
self.error("Exiting due to error: {}".format(message))
self.error(f"Exiting due to error: {message}")
sys.exit(1)
def error(self, message):
@ -258,7 +258,7 @@ class Shell:
"""
location = self.path(location)
return self.run_command(
"grep {} {}".format(search_term, location), suppress_message=True
f"grep {search_term} {location}", suppress_message=True
)
@staticmethod
@ -385,7 +385,7 @@ class Shell:
"""
if not self.is_root():
print("Installer must be run as root.")
print("Try 'sudo python3 {}'".format(self.script()))
print(f"Try 'sudo python3 {self.script()}'")
sys.exit(1)
def write_text_file(self, path, content, append=True):
@ -516,7 +516,7 @@ class Shell:
def check_kernel_update_reboot_required(self):
"""Checks if the pi needs to be rebooted since the last kernel update"""
if not self.exists("/lib/modules/{}".format(self.release())):
if not self.exists(f"/lib/modules/{self.release()}"):
self.error(
"OS has not been rebooted since last kernel update. "
"Please reboot and re-run the script."