Skip to content

Commit

Permalink
facts: efibootmgr.EFIBootMgr: drop removeprefix/removesuffix, only ad…
Browse files Browse the repository at this point in the history
…ded in python 3.9
  • Loading branch information
bauen1 authored and Fizzadar committed Jan 3, 2025
1 parent 65438dd commit 7147572
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyinfra/facts/efibootmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ def process(self, output: Iterable[str]) -> Optional[EFIBootMgrInfoDict]:

# 1. Maybe have BootNext
if line and line.startswith("BootNext: "):
info["BootNext"] = int(line.removeprefix("BootNext: "), 16)
info["BootNext"] = int(line[len("BootNext: ") :], 16)
line = next(output, None)

# 2. Maybe have BootCurrent
if line and line.startswith("BootCurrent: "):
info["BootCurrent"] = int(line.removeprefix("BootCurrent: "), 16)
info["BootCurrent"] = int(line[len("BootCurrent: ") :], 16)
line = next(output, None)

# 3. Maybe have Timeout
if line and line.startswith("Timeout: "):
info["Timeout"] = int(line.removeprefix("Timeout: ").removesuffix(" seconds"))
info["Timeout"] = int(line[len("Timeout: ") : -len(" seconds")])
line = next(output, None)

# 4. `show_order`
if line and line.startswith("BootOrder: "):
entries = line.removeprefix("BootOrder: ")
entries = line[len("BootOrder: ") :]
info["BootOrder"] = list(map(lambda x: int(x, 16), entries.split(",")))
line = next(output, None)

Expand Down

0 comments on commit 7147572

Please sign in to comment.