Skip to content

Commit f7ec708

Browse files
authored
fix: various issues with Choice (#839)
1 parent b4cd9e9 commit f7ec708

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

interactions/client/models/command.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ class Choice(DictSerializerMixin):
3131
:ivar Optional[Dict[Union[str, Locale], str]] name_localizations?: The dictionary of localization for the ``name`` field. This enforces the same restrictions as the ``name`` field.
3232
"""
3333

34-
_json: dict = field()
3534
name: str = field()
3635
value: Union[str, int, float] = field()
37-
name_localizations: Optional[Dict[Union[str, Locale], str]] = field()
36+
name_localizations: Optional[Dict[Union[str, Locale], str]] = field(default=None)
3837

39-
def __init__(self, **kwargs) -> None:
40-
super().__init__(**kwargs)
38+
def __attrs_post_init__(self):
4139
if self._json.get("name_localizations"):
4240
if any(
43-
type(x) != str for x in self._json.get("name_localizations")
41+
type(x) != str for x in self._json["name_localizations"]
4442
): # check if Locale object is used to create localisation at any certain point.
4543
self._json["name_localizations"] = {
4644
k.value if isinstance(k, Locale) else k: v

0 commit comments

Comments
 (0)