mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-03-10 02:41:10 +00:00
hints: allow more properties to be used for filtering the hint list
Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
This commit is contained in:
parent
4b395f79ad
commit
6c09b55a84
19
hints.py
19
hints.py
@ -18,14 +18,19 @@ class HintCollection:
|
||||
def __init__(self):
|
||||
self._hints = []
|
||||
|
||||
def __getitem__(self, type=None, onlyactive=True):
|
||||
return self.hints(type, onlyactive)
|
||||
def __getitem__(self, type=None):
|
||||
return self.hints(type)
|
||||
|
||||
def hints(self, type=None, onlyactive=True):
|
||||
if type:
|
||||
return [ hint for hint in self._hints if hint.type == type and (hint.active or onlyactive)]
|
||||
else:
|
||||
return self._hints[:]
|
||||
def hints(self, type=None, onlyactive=True, package=None, \
|
||||
version=None, days=None, removal=None):
|
||||
|
||||
return [ hint for hint in self._hints if
|
||||
(type is None or type == hint.type) and
|
||||
(onlyactive or hint.active) and
|
||||
(package is None or package == hint.packages[0].package) and
|
||||
(version is None or version == hint.packages[0].version) and
|
||||
(removal is None or removal == hint.packages[0].is_removal)
|
||||
]
|
||||
|
||||
def add_hint(self, hint, user):
|
||||
self._hints.append(Hint(hint, user))
|
||||
|
Loading…
x
Reference in New Issue
Block a user