Skip to content

Commit afe8335

Browse files
committed
Update RemoteObject in branding manager to use inspect.get_annotations
1 parent ad306f4 commit afe8335

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bot/exts/backend/branding/_repository.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import inspect
12
import typing as t
23
from datetime import UTC, date, datetime
34

@@ -45,10 +46,11 @@ class RemoteObject:
4546

4647
def __init__(self, dictionary: dict[str, t.Any]) -> None:
4748
"""Initialize by grabbing annotated attributes from `dictionary`."""
48-
missing_keys = self.__annotations__.keys() - dictionary.keys()
49+
annotation_keys = inspect.get_annotations(self.__class__)
50+
missing_keys = annotation_keys - dictionary.keys()
4951
if missing_keys:
5052
raise KeyError(f"Fetched object lacks expected keys: {missing_keys}")
51-
for annotation in self.__annotations__:
53+
for annotation in annotation_keys:
5254
setattr(self, annotation, dictionary[annotation])
5355

5456

0 commit comments

Comments
 (0)