python/sepolgen: return NotImplemented instead of raising it

sepolgen uses "return NotImplemented" (in access.py and matching.py) in
order to make Python's sorting function use an other call to compare
objects. For this to work, "NotImplemented" needs to be returned, not
raised like _compare's default implementation does.

This issue has been found using flake8. This Python linter reported:

    python/sepolgen/src/sepolgen/util.py:128:9: F901 'raise
    NotImplemented' should be 'raise NotImplementedError'

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2018-08-04 11:26:46 +02:00
parent 03c708d28d
commit a0c167ed22
No known key found for this signature in database
GPG Key ID: C191415F340DAAA0

View File

@ -123,7 +123,7 @@ class Comparison():
_compare function within your class."""
def _compare(self, other, method):
raise NotImplemented
return NotImplemented
def __eq__(self, other):
return self._compare(other, lambda a, b: a == b)