aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-12-20 16:31:26 +0800
committerGravatar ionite34 <[email protected]>2022-12-20 16:31:26 +0800
commit3dfde52eda8f2af0475855c26bd5c1c2d2a0818d (patch)
treebdec8fcd69802c3b7daf9c16494a3700293048b7
parentUpdate README punctuation (diff)
Truncate FileAttachment repr to avoid log spam
-rw-r--r--snekbox/snekio.py5
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:
"""