feat: implemented functionality to type out the choice
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
7219048422
commit
850c68f3e5
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user