Mercurial > libervia-backend
comparison sat/plugins/plugin_misc_debug.py @ 4037:524856bd7b19
massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.
However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.
To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.
This is a massive change, and may result in some bugs.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Apr 2023 13:54:42 +0200 |
parents | 2b0f739f8a46 |
children |
comparison
equal
deleted
inserted
replaced
4036:c4464d7ae97b | 4037:524856bd7b19 |
---|---|
38 | 38 |
39 class Debug(object): | 39 class Debug(object): |
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( | 43 host.bridge.add_method( |
44 "debugFakeSignal", | 44 "debug_signal_fake", |
45 ".plugin", | 45 ".plugin", |
46 in_sign="sss", | 46 in_sign="sss", |
47 out_sign="", | 47 out_sign="", |
48 method=self._fakeSignal, | 48 method=self._fake_signal, |
49 ) | 49 ) |
50 | 50 |
51 def _fakeSignal(self, signal, arguments, profile_key): | 51 def _fake_signal(self, signal, arguments, profile_key): |
52 """send a signal from backend | 52 """send a signal from backend |
53 | 53 |
54 @param signal(str): name of the signal | 54 @param signal(str): name of the signal |
55 @param arguments(unicode): json encoded list of arguments | 55 @param arguments(unicode): json encoded list of arguments |
56 @parm profile_key(unicode): profile_key to use or C.PROF_KEY_NONE if profile is not needed | 56 @parm profile_key(unicode): profile_key to use or C.PROF_KEY_NONE if profile is not needed |
57 """ | 57 """ |
58 args = json.loads(arguments) | 58 args = json.loads(arguments) |
59 method = getattr(self.host.bridge, signal) | 59 method = getattr(self.host.bridge, signal) |
60 if profile_key != C.PROF_KEY_NONE: | 60 if profile_key != C.PROF_KEY_NONE: |
61 profile = self.host.memory.getProfileName(profile_key) | 61 profile = self.host.memory.get_profile_name(profile_key) |
62 args.append(profile) | 62 args.append(profile) |
63 method(*args) | 63 method(*args) |