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,7 +49,7 @@ class EncryptionAlgorithms(base.CommandBase):
async def start(self):
try:
plugins_ser = await self.host.bridge.encryptionPluginsGet()
plugins_ser = await self.host.bridge.encryption_plugins_get()
plugins = data_format.deserialise(plugins_ser, type_check=list)
except Exception as e:
self.disp(f"can't retrieve plugins: {e}", error=True)
@ -77,7 +77,7 @@ class EncryptionGet(base.CommandBase):
jids = await self.host.check_jids([self.args.jid])
jid = jids[0]
try:
serialised = await self.host.bridge.messageEncryptionGet(jid, self.profile)
serialised = await self.host.bridge.message_encryption_get(jid, self.profile)
except Exception as e:
self.disp(f"can't get session: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -117,7 +117,7 @@ class EncryptionStart(base.CommandBase):
async def start(self):
if self.args.name is not None:
try:
namespace = await self.host.bridge.encryptionNamespaceGet(self.args.name)
namespace = await self.host.bridge.encryption_namespace_get(self.args.name)
except Exception as e:
self.disp(f"can't get encryption namespace: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -130,7 +130,7 @@ class EncryptionStart(base.CommandBase):
jid = jids[0]
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:
@ -157,7 +157,7 @@ class EncryptionStop(base.CommandBase):
jids = await self.host.check_jids([self.args.jid])
jid = jids[0]
try:
await self.host.bridge.messageEncryptionStop(jid, self.profile)
await self.host.bridge.message_encryption_stop(jid, self.profile)
except Exception as e:
self.disp(f"can't end encrypted session: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -187,7 +187,7 @@ class TrustUI(base.CommandBase):
async def start(self):
if self.args.name is not None:
try:
namespace = await self.host.bridge.encryptionNamespaceGet(self.args.name)
namespace = await self.host.bridge.encryption_namespace_get(self.args.name)
except Exception as e:
self.disp(f"can't get encryption namespace: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -200,7 +200,7 @@ class TrustUI(base.CommandBase):
jid = jids[0]
try:
xmlui_raw = await self.host.bridge.encryptionTrustUIGet(
xmlui_raw = await self.host.bridge.encryption_trust_ui_get(
jid, namespace, self.profile)
except Exception as e:
self.disp(f"can't get encryption session trust UI: {e}", error=True)
@ -209,7 +209,7 @@ class TrustUI(base.CommandBase):
xmlui = xmlui_manager.create(self.host, xmlui_raw)
await xmlui.show()
if xmlui.type != C.XMLUI_DIALOG:
await xmlui.submitForm()
await xmlui.submit_form()
self.host.quit()
class EncryptionTrust(base.CommandBase):