We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d8b7d0 commit c28ea1cCopy full SHA for c28ea1c
bot/exts/backend/branding/_repository.py
@@ -1,3 +1,4 @@
1
+import inspect
2
import typing as t
3
from datetime import UTC, date, datetime
4
@@ -45,10 +46,11 @@ class RemoteObject:
45
46
47
def __init__(self, dictionary: dict[str, t.Any]) -> None:
48
"""Initialize by grabbing annotated attributes from `dictionary`."""
- missing_keys = self.__annotations__.keys() - dictionary.keys()
49
+ annotation_keys = inspect.get_annotations(self.__class__)
50
+ missing_keys = annotation_keys - dictionary.keys()
51
if missing_keys:
52
raise KeyError(f"Fetched object lacks expected keys: {missing_keys}")
- for annotation in self.__annotations__:
53
+ for annotation in annotation_keys:
54
setattr(self, annotation, dictionary[annotation])
55
56
0 commit comments