From: Zbigniew Jędrzejewski-Szmek Date: Mon, 3 Feb 2025 09:38:01 +0000 (+0100) Subject: ukify: drop dots from exception messages X-Git-Tag: v258-rc1~1181^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd208a5421c10f6f523864553941f281d931fefc;p=thirdparty%2Fsystemd.git ukify: drop dots from exception messages In Python, exception messages are often embedded in surrounding text, so in general they should not contain punctuation. Also, no need to instantiate the exception object if no arguments are used. --- diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 097a7ee0c66..fb3912f9021 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -489,11 +489,11 @@ class UKI: class SignTool: @staticmethod def sign(input_f: str, output_f: str, opts: UkifyConfig) -> None: - raise NotImplementedError() + raise NotImplementedError @staticmethod def verify(opts: UkifyConfig) -> bool: - raise NotImplementedError() + raise NotImplementedError @staticmethod def from_string(name: str) -> type['SignTool']: @@ -1028,7 +1028,7 @@ def pe_add_sections(opts: UkifyConfig, uki: UKI, output: str) -> None: for i, s in enumerate(pe.sections[:n_original_sections]): if pe_strip_section_name(s.Name) == section.name and section.name != '.dtbauto': if new_section.Misc_VirtualSize > s.SizeOfRawData: - raise PEError(f'Not enough space in existing section {section.name} to append new data.') + raise PEError(f'Not enough space in existing section {section.name} to append new data') padding = bytes(new_section.SizeOfRawData - new_section.Misc_VirtualSize) pe.__data__ = ( @@ -1081,9 +1081,8 @@ def pe_add_sections(opts: UkifyConfig, uki: UKI, output: str) -> None: encoded = json.dumps(j).encode() if len(encoded) > section.SizeOfRawData: raise PEError( - f'Not enough space in existing section .pcrsig of size {section.SizeOfRawData} to append new data of size {len(encoded)}.' # noqa: E501 + f'Not enough space in existing section .pcrsig of size {section.SizeOfRawData} to append new data of size {len(encoded)}' # noqa: E501 ) - section.Misc_VirtualSize = len(encoded) # bytes(n) results in an array of n zeroes padding = bytes(section.SizeOfRawData - len(encoded)) @@ -1242,12 +1241,12 @@ def parse_hwid_dir(path: Path) -> bytes: def parse_efifw_dir(path: Path) -> bytes: if not path.is_dir(): - raise ValueError(f'{path} is not a directory or it does not exist.') + raise ValueError(f'{path} is not a directory or it does not exist') # only one firmware image must be present in the directory # to uniquely identify that firmware with its ID. if len(list(path.glob('*'))) != 1: - raise ValueError(f'{path} must contain exactly one firmware image file.') + raise ValueError(f'{path} must contain exactly one firmware image file') payload_blob = b'' for fw in path.iterdir():