Skip to content

Commit

Permalink
Make Queue objects iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Feb 21, 2021
1 parent fd49dd7 commit f960cd3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/ECNQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,13 @@ def __len__(self) -> int:
def __repr__(self) -> str:
return f'{self.name}_queue'

# Implements the interable interface requirements by passing direct references
# to the item list's interable values.
def __iter__(self) -> list:
return iter(self.items)
def __next__(self) -> int:
return self.items.__next__()

def getValidQueues() -> list:
"""Returns a list of queues on the filesystem excluding ignored queues.
Expand Down

0 comments on commit f960cd3

Please sign in to comment.