Use removeprefix/removesuffix instead of incorrect lstrip/rstrip calls (#3109)

This commit is contained in:
correctmost 2025-01-12 00:50:09 +00:00 committed by GitHub
parent 6681501904
commit 4212357c6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -1633,7 +1633,7 @@ Exec = /bin/sh -c "{hook_command}"
last_execution_time = SysCommand(
f"systemctl show --property=ActiveEnterTimestamp --no-pager {service_name}",
environment_vars={'SYSTEMD_COLORS': '0'}
).decode().lstrip('ActiveEnterTimestamp=')
).decode().removeprefix('ActiveEnterTimestamp=')
if not last_execution_time:
return None

View File

@ -254,7 +254,7 @@ class MirrorListHandler:
url = line.removeprefix('Server = ')
mirror_entry = MirrorStatusEntryV3(
url=url.rstrip('$repo/os/$arch'),
url=url.removesuffix('$repo/os/$arch'),
protocol=urllib.parse.urlparse(url).scheme,
active=True,
country=current_region or 'Worldwide',