aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-11-28 10:36:48 +0800
committerGravatar ionite34 <[email protected]>2022-11-28 10:36:48 +0800
commitfabaae9472321ec35a0736b96ea4af9b72d30eae (patch)
tree8d112a67e195810be0d619fc1a6adbfa8c99b016
parentRefactor FileAttachment as non generic (diff)
Rename `json` to `as_dict`, `FileAttachment` now frozen
-rw-r--r--snekbox/snekio.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/snekbox/snekio.py b/snekbox/snekio.py
index 9321eb2..2d2de6e 100644
--- a/snekbox/snekio.py
+++ b/snekbox/snekio.py
@@ -40,7 +40,7 @@ class IllegalPathError(ParsingError):
"""Raised when an attachment has an illegal path."""
-@dataclass
+@dataclass(frozen=True)
class FileAttachment:
"""A file attachment."""
@@ -79,7 +79,7 @@ class FileAttachment:
file.write_bytes(self.content)
@cached_property
- def json(self) -> dict[str, str]:
+ def as_dict(self) -> dict[str, str]:
"""Convert the attachment to a dict."""
content = b64encode(self.content).decode("ascii")
return {