Mercurial > libervia-backend
diff sat/tools/trigger.py @ 2624:56f94936df1e
code style reformatting using black
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 20:14:46 +0200 |
parents | 26edcf3a30eb |
children | 3a8e7ec4648a |
line wrap: on
line diff
--- a/sat/tools/trigger.py Wed Jun 27 07:51:29 2018 +0200 +++ b/sat/tools/trigger.py Wed Jun 27 20:14:46 2018 +0200 @@ -21,6 +21,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger + log = getLogger(__name__) @@ -30,6 +31,7 @@ class SkipOtherTriggers(Exception): """ Exception to raise if normal behaviour must be followed instead of following triggers list """ + pass @@ -37,8 +39,8 @@ """This class manage triggers: code which interact to change the behaviour of SàT""" try: # FIXME: to be removed when a better solution is found - MIN_PRIORITY = float('-inf') - MAX_PRIORITY = float('+inf') + MIN_PRIORITY = float("-inf") + MAX_PRIORITY = float("+inf") except: # XXX: Pyjamas will bug if you specify ValueError here # Pyjamas uses the JS Float class MIN_PRIORITY = Number.NEGATIVE_INFINITY @@ -57,14 +59,20 @@ """ if point_name not in self.__triggers: self.__triggers[point_name] = [] - if priority != 0 and priority in [trigger_tuple[0] for trigger_tuple in self.__triggers[point_name]]: + if priority != 0 and priority in [ + trigger_tuple[0] for trigger_tuple in self.__triggers[point_name] + ]: if priority in (self.MIN_PRIORITY, self.MAX_PRIORITY): log.warning(_(u"There is already a bound priority [%s]") % point_name) else: - log.debug(_(u"There is already a trigger with the same priority [%s]") % point_name) + log.debug( + _(u"There is already a trigger with the same priority [%s]") + % point_name + ) self.__triggers[point_name].append((priority, callback)) - self.__triggers[point_name].sort(key=lambda trigger_tuple: - trigger_tuple[0], reverse=True) + self.__triggers[point_name].sort( + key=lambda trigger_tuple: trigger_tuple[0], reverse=True + ) def remove(self, point_name, callback): """Remove a trigger from a point