mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-28 04:03:21 -04:00
refactor: use .remove(prefix|suffix) str methods (py39)
This commit is contained in:
parent
8f40baa34b
commit
6157c4b968
2 changed files with 3 additions and 6 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue