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.
This commit is contained in:
Goffi 2023-04-08 13:54:42 +02:00
commit 6a6f15707a

View file

@ -49,8 +49,8 @@ class PubsubAdmin(object):
def __init__(self, host):
self.host = host
host.bridge.addMethod(
"psAdminItemsSend",
host.bridge.add_method(
"ps_admin_items_send",
".plugin",
in_sign="ssasss",
out_sign="as",
@ -60,7 +60,7 @@ class PubsubAdmin(object):
def _publish(self, service, nodeIdentifier, items, extra=None,
profile_key=C.PROF_KEY_NONE):
client = self.host.getClient(profile_key)
client = self.host.get_client(profile_key)
service = None if not service else jid.JID(service)
extra = data_format.deserialise(extra)
items = [generic.parseXml(i.encode('utf-8')) for i in items]
@ -68,7 +68,7 @@ class PubsubAdmin(object):
client, service, nodeIdentifier, items, extra
)
def _sendCb(self, iq_result):
def _send_cb(self, iq_result):
publish_elt = iq_result.admin.pubsub.publish
ids = []
for item_elt in publish_elt.elements(pubsub.NS_PUBSUB, 'item'):
@ -90,5 +90,5 @@ class PubsubAdmin(object):
for item in items:
publish_elt.addChild(item)
d = iq_elt.send()
d.addCallback(self._sendCb)
d.addCallback(self._send_cb)
return d