Mercurial > libervia-backend
comparison sat/plugins/plugin_misc_debug.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 | ab2696e34d29 |
comparison
equal
deleted
inserted
replaced
2623:49533de4540b | 2624:56f94936df1e |
---|---|
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _ | 20 from sat.core.i18n import _ |
21 from sat.core.log import getLogger | 21 from sat.core.log import getLogger |
22 | |
22 log = getLogger(__name__) | 23 log = getLogger(__name__) |
23 from sat.core.constants import Const as C | 24 from sat.core.constants import Const as C |
24 import json | 25 import json |
25 | 26 |
26 PLUGIN_INFO = { | 27 PLUGIN_INFO = { |
29 C.PI_TYPE: "Misc", | 30 C.PI_TYPE: "Misc", |
30 C.PI_PROTOCOLS: [], | 31 C.PI_PROTOCOLS: [], |
31 C.PI_DEPENDENCIES: [], | 32 C.PI_DEPENDENCIES: [], |
32 C.PI_MAIN: "Debug", | 33 C.PI_MAIN: "Debug", |
33 C.PI_HANDLER: "no", | 34 C.PI_HANDLER: "no", |
34 C.PI_DESCRIPTION: _("""Set of method to make development and debugging easier""") | 35 C.PI_DESCRIPTION: _("""Set of method to make development and debugging easier"""), |
35 } | 36 } |
36 | 37 |
37 | 38 |
38 class Debug(object): | 39 class Debug(object): |
39 | |
40 def __init__(self, host): | 40 def __init__(self, host): |
41 log.info(_("Plugin Debug initialization")) | 41 log.info(_("Plugin Debug initialization")) |
42 self.host = host | 42 self.host = host |
43 host.bridge.addMethod("debugFakeSignal", ".plugin", in_sign='sss', out_sign='', method=self._fakeSignal) | 43 host.bridge.addMethod( |
44 | 44 "debugFakeSignal", |
45 ".plugin", | |
46 in_sign="sss", | |
47 out_sign="", | |
48 method=self._fakeSignal, | |
49 ) | |
45 | 50 |
46 def _fakeSignal(self, signal, arguments, profile_key): | 51 def _fakeSignal(self, signal, arguments, profile_key): |
47 """send a signal from backend | 52 """send a signal from backend |
48 | 53 |
49 @param signal(str): name of the signal | 54 @param signal(str): name of the signal |
54 method = getattr(self.host.bridge, signal) | 59 method = getattr(self.host.bridge, signal) |
55 if profile_key != C.PROF_KEY_NONE: | 60 if profile_key != C.PROF_KEY_NONE: |
56 profile = self.host.memory.getProfileName(profile_key) | 61 profile = self.host.memory.getProfileName(profile_key) |
57 args.append(profile) | 62 args.append(profile) |
58 method(*args) | 63 method(*args) |
59 | |
60 | |
61 |