Mercurial > libervia-backend
comparison twisted/plugins/sat_plugin.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 | f9a5b810f14d |
children | 4b842c1fb686 |
comparison
equal
deleted
inserted
replaced
4036:c4464d7ae97b | 4037:524856bd7b19 |
---|---|
34 | 34 |
35 def initialise(options): | 35 def initialise(options): |
36 """Method to initialise global modules""" | 36 """Method to initialise global modules""" |
37 # XXX: We need to configure logs before any log method is used, so here is the best place. | 37 # XXX: We need to configure logs before any log method is used, so here is the best place. |
38 from sat.core import log_config | 38 from sat.core import log_config |
39 log_config.satConfigure(C.LOG_BACKEND_TWISTED, C, backend_data=options) | 39 log_config.sat_configure(C.LOG_BACKEND_TWISTED, C, backend_data=options) |
40 | 40 |
41 | 41 |
42 class Options(usage.Options): | 42 class Options(usage.Options): |
43 optParameters = [] | 43 optParameters = [] |
44 | 44 |
48 | 48 |
49 tapname = C.APP_NAME_FILE | 49 tapname = C.APP_NAME_FILE |
50 description = _("%s XMPP client backend") % C.APP_NAME_FULL | 50 description = _("%s XMPP client backend") % C.APP_NAME_FULL |
51 options = Options | 51 options = Options |
52 | 52 |
53 def setDebugger(self): | 53 def set_debugger(self): |
54 from twisted.internet import defer | 54 from twisted.internet import defer |
55 if defer.Deferred.debug: | 55 if defer.Deferred.debug: |
56 # if we are in debug mode, we want to use ipdb instead of pdb | 56 # if we are in debug mode, we want to use ipdb instead of pdb |
57 try: | 57 try: |
58 import ipdb | 58 import ipdb |
63 pass | 63 pass |
64 | 64 |
65 def makeService(self, options): | 65 def makeService(self, options): |
66 from twisted.internet import asyncioreactor | 66 from twisted.internet import asyncioreactor |
67 asyncioreactor.install() | 67 asyncioreactor.install() |
68 self.setDebugger() | 68 self.set_debugger() |
69 # XXX: Libervia must be imported after log configuration, | 69 # XXX: Libervia must be imported after log configuration, |
70 # because it write stuff to logs | 70 # because it write stuff to logs |
71 initialise(options.parent) | 71 initialise(options.parent) |
72 from sat.core.sat_main import SAT | 72 from sat.core.sat_main import SAT |
73 return SAT() | 73 return SAT() |