diff --git a/Options.py b/Options.py index e106be5b..960e6c19 100644 --- a/Options.py +++ b/Options.py @@ -771,7 +771,7 @@ class VerifyKeys(metaclass=FreezeValidKeys): f"Did you mean '{picks[0][0]}' ({picks[0][1]}% sure)") -class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys): +class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys, typing.Mapping[str, typing.Any]): default: typing.Dict[str, typing.Any] = {} supports_weighting = False @@ -789,8 +789,14 @@ class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys): def get_option_name(self, value): return ", ".join(f"{key}: {v}" for key, v in value.items()) - def __contains__(self, item): - return item in self.value + def __getitem__(self, item: str) -> typing.Any: + return self.value.__getitem__(item) + + def __iter__(self) -> typing.Iterator[str]: + return self.value.__iter__() + + def __len__(self) -> int: + return self.value.__len__() class ItemDict(OptionDict):