Add simple search
parent
b4f1b9dd69
commit
3895df0ea8
|
@ -51,6 +51,11 @@ class WarningList():
|
|||
to_return['matching_attributes'] = self.matching_attributes
|
||||
return to_return
|
||||
|
||||
def has_match(self, value):
|
||||
if value in self.list:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class WarningLists(collections.Mapping):
|
||||
|
||||
|
@ -79,5 +84,12 @@ class WarningLists(collections.Mapping):
|
|||
def __iter__(self):
|
||||
return iter(self.warninglists)
|
||||
|
||||
def search(self, value):
|
||||
matches = []
|
||||
for name, wl in self.warninglists.items():
|
||||
if wl.has_match(value):
|
||||
matches.append(wl)
|
||||
return matches
|
||||
|
||||
def __len__(self):
|
||||
return len(self.warninglists)
|
||||
|
|
Loading…
Reference in New Issue