From 42544aadc51a0d789efdfc2da6a146ba52366709 Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:22:15 +0200 Subject: [PATCH] Lose the list comprehension for line length --- dissect/cstruct/types/structure.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dissect/cstruct/types/structure.py b/dissect/cstruct/types/structure.py index 84292cb..e4a6cc1 100644 --- a/dissect/cstruct/types/structure.py +++ b/dissect/cstruct/types/structure.py @@ -381,10 +381,15 @@ def __getitem__(self, item: str) -> Any: return getattr(self, item) def __repr__(self) -> str: - values = [ - f"{k}={hex(self[k]) if (issubclass(f.type, int) and not issubclass(f.type, (Pointer, Enum))) else repr(self[k])}" - for k, f in self.__class__.fields.items() - ] + values = [] + for k, f in self.__class__.fields.items(): + value = self[k] + if issubclass(f.type, int) and not issubclass(f.type, (Pointer, Enum)): + value = hex(value) + else: + value = repr(value) + values.append(f"{k}={value}") + return f"<{self.__class__.__name__} {' '.join(values)}>"