Skip to content

Commit

Permalink
feat(core): converted get_warnings to output sorted list
Browse files Browse the repository at this point in the history
  • Loading branch information
UrbanoFonseca committed Jul 13, 2021
1 parent 6721bc6 commit 1ee36c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ydata_quality/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def get_warnings(self,
test: Optional[str] = None,
priority: Optional[Priority] = None):
"Retrieves warnings filtered by their properties."
filtered = self.warnings # original set
filtered = list(self.warnings) # convert original set
filtered = [w for w in filtered if w.category == category] if category else filtered
filtered = [w for w in filtered if w.test == test] if test else filtered
filtered = [w for w in filtered if w.priority == Priority(priority)] if priority else filtered
return set(filtered)
filtered.sort() # sort by priority
return filtered

@property
def tests(self):
Expand Down

0 comments on commit 1ee36c6

Please sign in to comment.