aboutsummaryrefslogtreecommitdiff
path: root/tools/cru-py/cru/list.py
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-11-11 01:12:29 +0800
committerYuqian Yang <crupest@crupest.life>2025-01-14 22:36:08 +0800
commita5c2f62b0b3c4ec6ce46c57bcd99319a85900798 (patch)
tree0cb89834a1ed32bdf20597309c78c3a5cbca3c88 /tools/cru-py/cru/list.py
parentb9788b23bbd000d2a2d14402b4e2abacd5a57365 (diff)
downloadcrupest-a5c2f62b0b3c4ec6ce46c57bcd99319a85900798.tar.gz
crupest-a5c2f62b0b3c4ec6ce46c57bcd99319a85900798.tar.bz2
crupest-a5c2f62b0b3c4ec6ce46c57bcd99319a85900798.zip
HALF WORK: 2024.1.14
Diffstat (limited to 'tools/cru-py/cru/list.py')
-rw-r--r--tools/cru-py/cru/list.py4
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