From fabaae9472321ec35a0736b96ea4af9b72d30eae Mon Sep 17 00:00:00 2001 From: ionite34 Date: Mon, 28 Nov 2022 10:36:48 +0800 Subject: Rename `json` to `as_dict`, `FileAttachment` now frozen --- snekbox/snekio.py | 4 ++-- 1 file 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 { -- cgit v1.2.3