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

@ -45,32 +45,32 @@ class FileSharingInvitation:
def __init__(self, host):
log.info(_("File Sharing Invitation plugin initialization"))
self.host = host
ns_fis = host.getNamespace("fis")
host.plugins["INVITATION"].registerNamespace(ns_fis, self.onInvitation)
host.bridge.addMethod(
"FISInvite",
ns_fis = host.get_namespace("fis")
host.plugins["INVITATION"].register_namespace(ns_fis, self.on_invitation)
host.bridge.add_method(
"fis_invite",
".plugin",
in_sign="ssssssss",
out_sign="",
method=self._sendFileSharingInvitation,
method=self._send_file_sharing_invitation,
async_=True
)
def _sendFileSharingInvitation(
def _send_file_sharing_invitation(
self, invitee_jid_s, service_s, repos_type=None, namespace=None, path=None,
name=None, extra_s='', profile_key=C.PROF_KEY_NONE):
client = self.host.getClient(profile_key)
client = self.host.get_client(profile_key)
invitee_jid = jid.JID(invitee_jid_s)
service = jid.JID(service_s)
extra = data_format.deserialise(extra_s)
return defer.ensureDeferred(
self.host.plugins["INVITATION"].sendFileSharingInvitation(
self.host.plugins["INVITATION"].send_file_sharing_invitation(
client, invitee_jid, service, repos_type=repos_type or None,
namespace=namespace or None, path=path or None, name=name or None,
extra=extra)
)
def onInvitation(
def on_invitation(
self,
client: SatXMPPEntity,
namespace: str,
@ -97,7 +97,7 @@ class FileSharingInvitation:
path=path)
)
return defer.ensureDeferred(
self.host.plugins['LIST_INTEREST'].registerFileSharing(
self.host.plugins['LIST_INTEREST'].register_file_sharing(
client, service, repos_type, sharing_ns, path, name, extra
)
)