Change argument order for HintCollection.add_hint

Signed-off-by: Niels Thykier <niels@thykier.net>
pre-rebase-2016-10-25
Niels Thykier 9 years ago
parent 513550a8f1
commit 6328b15a9c

@ -2804,7 +2804,7 @@ class Britney(object):
elif user_input and user_input[0] in ('remove', 'approve', 'urgent', 'age-days', elif user_input and user_input[0] in ('remove', 'approve', 'urgent', 'age-days',
'block', 'block-udeb', 'unblock', 'unblock-udeb', 'block', 'block-udeb', 'unblock', 'unblock-udeb',
'block-all', 'force'): 'block-all', 'force'):
self.hints.add_hint(' '.join(user_input), 'hint-tester') self.hints.add_hint('hint-tester', ' '.join(user_input))
self.write_excuses() self.write_excuses()
# run a hint # run a hint
elif user_input and user_input[0] in ('easy', 'hint', 'force-hint'): elif user_input and user_input[0] in ('easy', 'hint', 'force-hint'):

@ -39,14 +39,14 @@ class HintCollection(object):
(removal is None or removal == hint.packages[0].is_removal) (removal is None or removal == hint.packages[0].is_removal)
] ]
def add_hint(self, hint, user): def add_hint(self, user, hint):
self._hints.append(Hint(hint, user)) self._hints.append(Hint(user, hint))
class Hint(object): class Hint(object):
NO_VERSION = [ 'block', 'block-all', 'block-udeb' ] NO_VERSION = [ 'block', 'block-all', 'block-udeb' ]
def __init__(self, hint, user): def __init__(self, user, hint):
self._hint = hint self._hint = hint
self._user = user self._user = user
self._active = True self._active = True
@ -134,16 +134,16 @@ class Hint(object):
def age_day_hint(hints, who, hint_name, new_age, *args): def age_day_hint(hints, who, hint_name, new_age, *args):
for package in args: for package in args:
h = [hint_name, new_age] + package.split(' ') h = [hint_name, new_age] + package.split(' ')
hints.add_hint(h, who) hints.add_hint(who, h)
def split_into_one_hint_per_package(hints, who, hint_name, *args): def split_into_one_hint_per_package(hints, who, hint_name, *args):
for package in args: for package in args:
hints.add_hint([hint_name, package], who) hints.add_hint(who, [hint_name, package])
def single_hint_taking_list_of_packages(hints, who, *args): def single_hint_taking_list_of_packages(hints, who, *args):
hints.add_hint(args, who) hints.add_hint(who, args)
class HintParser(object): class HintParser(object):

Loading…
Cancel
Save