From 850c68f3e5652fccb85758d9b80be6573b2d1ad0 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Mon, 27 May 2024 14:00:01 +0200 Subject: [PATCH] feat: implemented functionality to type out the choice --- music_kraken/download/components.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/music_kraken/download/components.py b/music_kraken/download/components.py index e30bcb5..f11d41c 100644 --- a/music_kraken/download/components.py +++ b/music_kraken/download/components.py @@ -28,6 +28,8 @@ class Option: self._raw_keys = set(keys or []) self._raw_keys.add(self.text) + self._raw_keys.add(self.value) + self._raw_keys.add(str(self.value)) self.keys = set(self.parse_key(key) for key in self._raw_keys) def register_key(self, key: Any): @@ -100,10 +102,10 @@ class Select: yield option def __contains__(self, key: Any) -> bool: - return key in self._key_to_option + return self._parse_option_key(key) in self._key_to_option def __getitem__(self, key: Any) -> Option: - return self._key_to_option[key] + return self._key_to_option[self._parse_option_key(key)] def create_option(self, key: Any, **kwargs) -> Option: if not self.can_create_options: