diff --git a/archinstall/lib/disk/fido.py b/archinstall/lib/disk/fido.py index b5faefef..ed604807 100644 --- a/archinstall/lib/disk/fido.py +++ b/archinstall/lib/disk/fido.py @@ -7,7 +7,7 @@ from typing import ClassVar from archinstall.lib.models.device_model import Fido2Device from ..exceptions import SysCallError -from ..general import SysCommand, SysCommandWorker, clear_vt100_escape_codes +from ..general import SysCommand, SysCommandWorker, clear_vt100_escape_codes_from_str from ..output import error, info @@ -44,7 +44,7 @@ class Fido2: error('fido2 support is most likely not installed') raise ValueError('HSM devices can not be detected, is libfido2 installed?') - fido_devices: str = clear_vt100_escape_codes(ret) # type: ignore[assignment] + fido_devices = clear_vt100_escape_codes_from_str(ret) manufacturer_pos = 0 product_pos = 0 diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 65130dc9..f83a86be 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -44,9 +44,11 @@ def locate_binary(name: str) -> str: raise RequirementError(f"Binary {name} does not exist.") -def clear_vt100_escape_codes(data: bytes | str) -> bytes | str: - if isinstance(data, bytes): - return re.sub(_VT100_ESCAPE_REGEX_BYTES, b'', data) +def clear_vt100_escape_codes(data: bytes) -> bytes: + return re.sub(_VT100_ESCAPE_REGEX_BYTES, b'', data) + + +def clear_vt100_escape_codes_from_str(data: str) -> str: return re.sub(_VT100_ESCAPE_REGEX, '', data) @@ -159,7 +161,7 @@ class SysCommandWorker: lines = filter(None, self._trace_log[self._trace_log_pos:last_line].splitlines()) for line in lines: if self.remove_vt100_escape_codes_from_lines: - line = clear_vt100_escape_codes(line) # type: ignore[assignment] + line = clear_vt100_escape_codes(line) yield line + b'\n'