diff options
author | 2022-12-20 16:31:26 +0800 | |
---|---|---|
committer | 2022-12-20 16:31:26 +0800 | |
commit | 3dfde52eda8f2af0475855c26bd5c1c2d2a0818d (patch) | |
tree | bdec8fcd69802c3b7daf9c16494a3700293048b7 | |
parent | Update README punctuation (diff) |
Truncate FileAttachment repr to avoid log spam
-rw-r--r-- | snekbox/snekio.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/snekbox/snekio.py b/snekbox/snekio.py index b5bd5a1..45ebc61 100644 --- a/snekbox/snekio.py +++ b/snekbox/snekio.py @@ -43,6 +43,11 @@ class FileAttachment: path: str content: bytes + def __repr__(self) -> str: + path = f"{self.path[:30]}..." if len(self.path) > 30 else self.path + content = f"{self.content[:15]}..." if len(self.content) > 15 else self.content + return f"{self.__class__.__name__}(path={path!r}, content={content!r})" + @classmethod def from_dict(cls, data: dict[str, str]) -> FileAttachment: """ |