chg: Type in the warning list is now enforced

regex-type
Raphaël Vinot 2017-12-22 15:35:36 +01:00
parent a608dd5c13
commit 10f706cfcb
2 changed files with 5 additions and 7 deletions

View File

@ -38,8 +38,7 @@ class WarningList():
self.description = self.warninglist['description']
self.version = int(self.warninglist['version'])
self.name = self.warninglist['name']
if self.warninglist.get('type'):
self.type = self.warninglist['type']
self.type = self.warninglist['type']
if self.warninglist.get('matching_attributes'):
self.matching_attributes = self.warninglist['matching_attributes']
@ -59,9 +58,8 @@ class WarningList():
def to_dict(self):
to_return = {'list': [str(e) for e in self.list], 'name': self.name,
'description': self.description, 'version': self.version}
if hasattr(self, 'type'):
to_return['type'] = self.type
'description': self.description, 'version': self.version,
'type': self.type}
if hasattr(self, 'matching_attributes'):
to_return['matching_attributes'] = self.matching_attributes
return to_return
@ -126,7 +124,7 @@ class WarningLists(collections.Mapping):
matches = []
for name, wl in self.warninglists.items():
if value in wl:
matches.append(wl)
matches.append(wl)
return matches
def __len__(self):

@ -1 +1 @@
Subproject commit 0f23d9cb18485d190cd495ee02d9bfe872674561
Subproject commit 260da4af14b434b4eb5b697c9e3b9860878e6550