Skip to content

Commit

Permalink
fix typing in __next__
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Jul 22, 2024
1 parent ccea686 commit fbac287
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions nicegui/element_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
T = TypeVar('T', bound=Element)


class ElementFilter(Generic[T], Iterator[T]):
class ElementFilter(Generic[T]):
DEFAULT_LOCAL_SCOPE = False

@overload
Expand Down Expand Up @@ -102,15 +102,10 @@ def _iterate(self, parent: Element, *, visited: Optional[List[Element]] = None)
for m in self._not_within_markers
for element in visited))
):
yield element
yield element # type: ignore
if element not in self._not_within_instances:
yield from self._iterate(element, visited=[*visited, element])

def __next__(self) -> T:
if self._iterator is None:
raise StopIteration
return next(self._iterator)

def __len__(self) -> int:
return len(list(iter(self)))

Expand Down

0 comments on commit fbac287

Please sign in to comment.