diff options
author | crupest <crupest@outlook.com> | 2024-11-11 01:12:29 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-01-14 22:36:08 +0800 |
commit | 5a4898d8fe48de877e3a9d35db3774fefd4a5be9 (patch) | |
tree | 0cb89834a1ed32bdf20597309c78c3a5cbca3c88 /tools/cru-py/cru/list.py | |
parent | 9ca818450a89b98c1de063b15ffbd3e7c6615f50 (diff) | |
download | crupest-5a4898d8fe48de877e3a9d35db3774fefd4a5be9.tar.gz crupest-5a4898d8fe48de877e3a9d35db3774fefd4a5be9.tar.bz2 crupest-5a4898d8fe48de877e3a9d35db3774fefd4a5be9.zip |
HALF WORK: 2024.1.14
Diffstat (limited to 'tools/cru-py/cru/list.py')
-rw-r--r-- | tools/cru-py/cru/list.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/cru-py/cru/list.py b/tools/cru-py/cru/list.py index c65c793..53c3c77 100644 --- a/tools/cru-py/cru/list.py +++ b/tools/cru-py/cru/list.py @@ -93,6 +93,10 @@ class CruUniqueKeyList(Generic[_T, _K]): raise KeyError(f"Key {key} not found!") return value # type: ignore + @property + def keys(self) -> Iterable[_K]: + return self._list.as_cru_iterator().map(self._key_getter) + def has_key(self, key: _K) -> bool: return self.get_or(key) != CruNotFound.VALUE |