Skip to content

Commit

Permalink
ConstraintExpression: Add __iter__.
Browse files Browse the repository at this point in the history
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
  • Loading branch information
pebenito committed Oct 14, 2020
1 parent 582f883 commit aceedd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions setools/policyrep.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ class ConstraintExpression(PolicyObject):
def __ge__(self, other) -> bool: ...
def __getitem__(self, index) -> Union[str, FrozenSet[TypeOrAttr], FrozenSet[Role], FrozenSet[User]]: ...
def __gt__(self, other) -> bool: ...
def __iter__(self) -> Iterator[Union[FrozenSet[Role], FrozenSet[Type], FrozenSet[User], str]]: ...
def __le__(self, other) -> bool: ...
def __lt__(self, other) -> bool: ...
def __ne__(self, other) -> bool: ...
Expand Down
3 changes: 3 additions & 0 deletions setools/policyrep/constraint.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ cdef class ConstraintExpression(PolicyObject):
def __getitem__(self, idx):
return self._postfix[idx]

def __iter__(self):
return iter(self._postfix)

def __eq__(self, other):
return self._postfix == other

Expand Down

0 comments on commit aceedd8

Please sign in to comment.