Skip to content

Commit

Permalink
Lose the list comprehension for line length
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper committed Sep 23, 2024
1 parent 57ae87a commit 42544aa
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions dissect/cstruct/types/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}>"


Expand Down

0 comments on commit 42544aa

Please sign in to comment.