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:
parent
d50412c7f7
commit
6a6f15707a
1 changed files with 9945 additions and 9945 deletions
|
|
@ -51,12 +51,12 @@ class PubsubInvitation:
|
|||
self._p = host.plugins["XEP-0060"]
|
||||
# namespace to handler map
|
||||
self._ns_handler = {}
|
||||
host.bridge.addMethod(
|
||||
"psInvite",
|
||||
host.bridge.add_method(
|
||||
"ps_invite",
|
||||
".plugin",
|
||||
in_sign="sssssss",
|
||||
out_sign="",
|
||||
method=self._sendPubsubInvitation,
|
||||
method=self._send_pubsub_invitation,
|
||||
async_=True
|
||||
)
|
||||
|
||||
|
|
@ -66,12 +66,12 @@ class PubsubInvitation:
|
|||
handler
|
||||
) -> None:
|
||||
self._ns_handler[namespace] = handler
|
||||
self.host.plugins["INVITATION"].registerNamespace(namespace, self.onInvitation)
|
||||
self.host.plugins["INVITATION"].register_namespace(namespace, self.on_invitation)
|
||||
|
||||
def _sendPubsubInvitation(
|
||||
def _send_pubsub_invitation(
|
||||
self, invitee_jid_s, service_s, node, item_id=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)
|
||||
|
|
@ -104,13 +104,13 @@ class PubsubInvitation:
|
|||
if namespace:
|
||||
try:
|
||||
handler = self._ns_handler[namespace]
|
||||
preflight = handler.invitePreflight
|
||||
preflight = handler.invite_preflight
|
||||
except KeyError:
|
||||
pass
|
||||
except AttributeError:
|
||||
log.debug(f"no invitePreflight method found for {namespace!r}")
|
||||
log.debug(f"no invite_preflight method found for {namespace!r}")
|
||||
else:
|
||||
await utils.asDeferred(
|
||||
await utils.as_deferred(
|
||||
preflight,
|
||||
client, invitee_jid, service, node, item_id, name, extra
|
||||
)
|
||||
|
|
@ -118,11 +118,11 @@ class PubsubInvitation:
|
|||
item_id = extra.pop("default_item_id", None)
|
||||
|
||||
# we authorize our invitee to see the nodes of interest
|
||||
await self._p.setNodeAffiliations(client, service, node, {invitee_jid: "member"})
|
||||
await self._p.set_node_affiliations(client, service, node, {invitee_jid: "member"})
|
||||
log.debug(f"affiliation set on {service}'s {node!r} node")
|
||||
|
||||
# now we send the invitation
|
||||
self.host.plugins["INVITATION"].sendPubsubInvitation(
|
||||
self.host.plugins["INVITATION"].send_pubsub_invitation(
|
||||
client,
|
||||
invitee_jid,
|
||||
service,
|
||||
|
|
@ -132,7 +132,7 @@ class PubsubInvitation:
|
|||
extra=extra
|
||||
)
|
||||
|
||||
async def onInvitation(
|
||||
async def on_invitation(
|
||||
self,
|
||||
client: SatXMPPEntity,
|
||||
namespace: str,
|
||||
|
|
@ -153,7 +153,7 @@ class PubsubInvitation:
|
|||
except AttributeError:
|
||||
log.debug(f"no on_invitation_preflight method found for {namespace!r}")
|
||||
else:
|
||||
await utils.asDeferred(
|
||||
await utils.as_deferred(
|
||||
preflight,
|
||||
client, namespace, name, extra, service, node, item_id, item_elt
|
||||
)
|
||||
|
|
@ -164,6 +164,6 @@ class PubsubInvitation:
|
|||
if not name:
|
||||
name = extra.pop("name", "")
|
||||
|
||||
return await self.host.plugins['LIST_INTEREST'].registerPubsub(
|
||||
return await self.host.plugins['LIST_INTEREST'].register_pubsub(
|
||||
client, namespace, service, node, item_id, creator,
|
||||
name, element, extra)
|
||||
|
|
|
|||
Loading…
Reference in a new issue