From 8f5d3eed9bde80853032040d1b78600a5247a24b Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 29 Sep 2021 13:32:32 +0200 Subject: [PATCH] ftguess: add a __str__ for simpler debugging --- oletools/ftguess.py | 7 +++++++ 1 file changed, 7 insertions(+), 0 deletions(-) diff --git a/oletools/ftguess.py b/oletools/ftguess.py index 04b10e7..817b2ce 100644 --- a/oletools/ftguess.py +++ b/oletools/ftguess.py @@ -683,6 +683,13 @@ class FileTypeGuesser(object): self.filetype = self.ftype.filetype self.application = self.ftype.application + def __str__(self): + """Give a short string representation of this object.""" + return '[FileTypeGuesser for {0}: {1} from {2} in {3}]'.format( + "data" if self.filepath is None + else os.path.basename(self.filepath), + self.filetype, self.application, self.container) + def close(self): """ This method must be called at the end of processing -- libgit2 0.21.4