Use removeprefix/removesuffix instead of incorrect lstrip/rstrip calls (#3109)
This commit is contained in:
parent
6681501904
commit
4212357c6f
|
|
@ -1633,7 +1633,7 @@ Exec = /bin/sh -c "{hook_command}"
|
||||||
last_execution_time = SysCommand(
|
last_execution_time = SysCommand(
|
||||||
f"systemctl show --property=ActiveEnterTimestamp --no-pager {service_name}",
|
f"systemctl show --property=ActiveEnterTimestamp --no-pager {service_name}",
|
||||||
environment_vars={'SYSTEMD_COLORS': '0'}
|
environment_vars={'SYSTEMD_COLORS': '0'}
|
||||||
).decode().lstrip('ActiveEnterTimestamp=')
|
).decode().removeprefix('ActiveEnterTimestamp=')
|
||||||
|
|
||||||
if not last_execution_time:
|
if not last_execution_time:
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ class MirrorListHandler:
|
||||||
|
|
||||||
url = line.removeprefix('Server = ')
|
url = line.removeprefix('Server = ')
|
||||||
mirror_entry = MirrorStatusEntryV3(
|
mirror_entry = MirrorStatusEntryV3(
|
||||||
url=url.rstrip('$repo/os/$arch'),
|
url=url.removesuffix('$repo/os/$arch'),
|
||||||
protocol=urllib.parse.urlparse(url).scheme,
|
protocol=urllib.parse.urlparse(url).scheme,
|
||||||
active=True,
|
active=True,
|
||||||
country=current_region or 'Worldwide',
|
country=current_region or 'Worldwide',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue