diff --git a/src/borg/archiver/debug_cmd.py b/src/borg/archiver/debug_cmd.py index 860bc7ae7..bb05c53d9 100644 --- a/src/borg/archiver/debug_cmd.py +++ b/src/borg/archiver/debug_cmd.py @@ -152,9 +152,9 @@ class DebugMixIn: wanted = args.wanted try: if wanted.startswith("hex:"): - wanted = hex_to_bin(wanted[4:]) + wanted = hex_to_bin(wanted.removeprefix("hex:")) elif wanted.startswith("str:"): - wanted = wanted[4:].encode() + wanted = wanted.removeprefix("str:").encode() else: raise ValueError("unsupported search term") except (ValueError, UnicodeEncodeError): diff --git a/src/borg/remote.py b/src/borg/remote.py index d835b04b9..f57c2a140 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -311,10 +311,7 @@ class RepositoryServer: # pragma: no cover raise sock_dir = os.path.dirname(self.socket_path) os.makedirs(sock_dir, exist_ok=True) - if self.socket_path.endswith(".sock"): - pid_file = self.socket_path.replace(".sock", ".pid") - else: - pid_file = self.socket_path + ".pid" + pid_file = self.socket_path.removesuffix(".sock") + ".pid" pid = os.getpid() with open(pid_file, "w") as f: f.write(str(pid))