From 5a4898d8fe48de877e3a9d35db3774fefd4a5be9 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 11 Nov 2024 01:12:29 +0800 Subject: HALF WORK: 2024.1.14 --- tools/cru-py/cru/list.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/cru-py/cru/list.py') 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 -- cgit v1.2.3