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,16 +49,16 @@ class XEP_0376:
def __init__(self, host):
log.info(_("Pubsub Account Management initialization"))
self.host = host
host.registerNamespace("pam", NS_PAM)
host.register_namespace("pam", NS_PAM)
self._p = self.host.plugins["XEP-0060"]
host.trigger.add("XEP-0060_subscribe", self.subscribe)
host.trigger.add("XEP-0060_unsubscribe", self.unsubscribe)
host.trigger.add("XEP-0060_subscriptions", self.subscriptions)
def getHandler(self, client):
def get_handler(self, client):
return XEP_0376_Handler()
async def profileConnected(self, client):
async def profile_connected(self, client):
if not self.host.hasFeature(client, NS_PAM):
log.warning(
"Your server doesn't support Pubsub Account Management, this is used to "
@ -66,7 +66,7 @@ class XEP_0376:
"install it."
)
async def _subRequest(
async def _sub_request(
self,
client: SatXMPPEntity,
service: jid.JID,
@ -109,7 +109,7 @@ class XEP_0376:
if not self.host.hasFeature(client, NS_PAM) or client.is_component:
return True, None
await self._subRequest(client, service, nodeIdentifier, sub_jid, options, True)
await self._sub_request(client, service, nodeIdentifier, sub_jid, options, True)
# TODO: actual result is sent with <message> stanza, we have to get and use them
# to known the actual result. XEP-0376 returns an empty <iq> result, thus we don't
@ -130,7 +130,7 @@ class XEP_0376:
) -> bool:
if not self.host.hasFeature(client, NS_PAM) or client.is_component:
return True
await self._subRequest(client, service, nodeIdentifier, sub_jid, None, False)
await self._sub_request(client, service, nodeIdentifier, sub_jid, None, False)
return False
async def subscriptions(