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

@ -91,7 +91,7 @@ class Send(base.CommandBase):
"jid", help=_("the destination jid")
)
async def sendStdin(self, dest_jid):
async def send_stdin(self, dest_jid):
"""Send incomming data on stdin to jabber contact
@param dest_jid: destination jid
@ -123,7 +123,7 @@ class Send(base.CommandBase):
if header:
# first we sent the header
try:
await self.host.bridge.messageSend(
await self.host.bridge.message_send(
dest_jid,
{self.args.lang: header},
subject,
@ -160,7 +160,7 @@ class Send(base.CommandBase):
# first one
del extra[C.KEY_ATTACHMENTS]
try:
await self.host.bridge.messageSend(
await self.host.bridge.message_send(
dest_jid,
msg,
subject,
@ -193,21 +193,21 @@ class Send(base.CommandBase):
if self.args.encrypt is not None:
try:
namespace = await self.host.bridge.encryptionNamespaceGet(
namespace = await self.host.bridge.encryption_namespace_get(
self.args.encrypt)
except Exception as e:
self.disp(f"can't get encryption namespace: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
try:
await self.host.bridge.messageEncryptionStart(
await self.host.bridge.message_encryption_start(
jid_, namespace, not self.args.encrypt_noreplace, self.profile
)
except Exception as e:
self.disp(f"can't start encryption session: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
await self.sendStdin(jid_)
await self.send_stdin(jid_)
class Retract(base.CommandBase):
@ -223,7 +223,7 @@ class Retract(base.CommandBase):
async def start(self):
try:
await self.host.bridge.messageRetract(
await self.host.bridge.message_retract(
self.args.message_id,
self.profile
)
@ -286,7 +286,7 @@ class MAM(base.CommandBase):
if value is not None:
extra[key] = str(value)
try:
data, metadata_s, profile = await self.host.bridge.MAMGet(
data, metadata_s, profile = await self.host.bridge.mam_get(
self.args.service, data_format.serialise(extra), self.profile)
except Exception as e:
self.disp(f"can't retrieve MAM archives: {e}", error=True)
@ -295,7 +295,7 @@ class MAM(base.CommandBase):
metadata = data_format.deserialise(metadata_s)
try:
session_info = await self.host.bridge.sessionInfosGet(self.profile)
session_info = await self.host.bridge.session_infos_get(self.profile)
except Exception as e:
self.disp(f"can't get session infos: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)