mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-16 18:30:45 +00:00
sepolgen: Allow returning of bastard matches
Return low quality matches as well as high quality matches. Sometimes we just want the crap with the sugar. Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
parent
3babdf190b
commit
065e5d3149
@ -50,7 +50,7 @@ class Match:
|
||||
return 1
|
||||
|
||||
class MatchList:
|
||||
DEFAULT_THRESHOLD = 120
|
||||
DEFAULT_THRESHOLD = 150
|
||||
def __init__(self):
|
||||
# Match objects that pass the threshold
|
||||
self.children = []
|
||||
@ -63,14 +63,15 @@ class MatchList:
|
||||
def best(self):
|
||||
if len(self.children):
|
||||
return self.children[0]
|
||||
else:
|
||||
return None
|
||||
if len(self.bastards):
|
||||
return self.bastards[0]
|
||||
return None
|
||||
|
||||
def __len__(self):
|
||||
# Only return the length of the matches so
|
||||
# that this can be used to test if there is
|
||||
# a match.
|
||||
return len(self.children)
|
||||
return len(self.children) + len(self.bastards)
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.children)
|
||||
|
Loading…
Reference in New Issue
Block a user