From 2d53a1a786e6bd580c0f66c5e1c7df31cedc9724 Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Mon, 16 Mar 2026 11:26:45 +0800 Subject: [PATCH] feat: Add iter method and Iterator class to _ds.pyi Sync type stubs with ds.cc to include: - Search.iter() method returning Iterator - Chain.iter() method returning Iterator - New Iterator class with next() method Co-Authored-By: Claude Opus 4.6 --- apyds/_ds.pyi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apyds/_ds.pyi b/apyds/_ds.pyi index 0358a1f..5e75f09 100644 --- a/apyds/_ds.pyi +++ b/apyds/_ds.pyi @@ -675,6 +675,14 @@ class Search: """ ... + def iter(self) -> Iterator: + """Return an iterator over the search results. + + Returns: + An Iterator object that can be used to iterate over rules. + """ + ... + class Chain: """C++ binding for ds::chain_t.""" @@ -728,3 +736,23 @@ class Chain: Returns: The number of rules processed. """ + ... + + def iter(self) -> Iterator: + """Return an iterator over the chain results. + + Returns: + An Iterator object that can be used to iterate over rules. + """ + ... + +class Iterator: + """Iterator for Search and Chain results.""" + + def next(self) -> Optional[Rule]: + """Get the next rule in the iteration. + + Returns: + The next Rule object, or None if iteration is complete. + """ + ...