aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-10-30 21:06:31 +0000
committerGravatar Joe Banks <[email protected]>2025-11-10 18:41:30 +0000
commitafe83351ee997e24a541ec76a76a37bb3dc1c071 (patch)
tree2d714b270539db34bb7da9fecc1b5ac36db6f857
parentUpgrade all dependencies to latest available versions (diff)
Update RemoteObject in branding manager to use inspect.get_annotations
-rw-r--r--bot/exts/backend/branding/_repository.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/backend/branding/_repository.py b/bot/exts/backend/branding/_repository.py
index d661cd7a8..18720e581 100644
--- a/bot/exts/backend/branding/_repository.py
+++ b/bot/exts/backend/branding/_repository.py
@@ -1,3 +1,4 @@
+import inspect
import typing as t
from datetime import UTC, date, datetime
@@ -45,10 +46,11 @@ class RemoteObject:
def __init__(self, dictionary: dict[str, t.Any]) -> None:
"""Initialize by grabbing annotated attributes from `dictionary`."""
- missing_keys = self.__annotations__.keys() - dictionary.keys()
+ annotation_keys = inspect.get_annotations(self.__class__)
+ missing_keys = annotation_keys - dictionary.keys()
if missing_keys:
raise KeyError(f"Fetched object lacks expected keys: {missing_keys}")
- for annotation in self.__annotations__:
+ for annotation in annotation_keys:
setattr(self, annotation, dictionary[annotation])