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

@ -80,7 +80,7 @@ class AccountCreate(base.CommandBase):
async def start(self):
try:
await self.host.bridge.inBandAccountNew(
await self.host.bridge.in_band_account_new(
self.args.jid,
self.args.password,
self.args.email,
@ -112,7 +112,7 @@ class AccountCreate(base.CommandBase):
self.disp(_("creating profile"), 2)
try:
await self.host.bridge.profileCreate(
await self.host.bridge.profile_create(
self.args.profile,
self.args.password,
"",
@ -141,7 +141,7 @@ class AccountCreate(base.CommandBase):
self.disp(_("profile created"), 1)
try:
await self.host.bridge.profileStartSession(
await self.host.bridge.profile_start_session(
self.args.password,
self.args.profile,
)
@ -150,7 +150,7 @@ class AccountCreate(base.CommandBase):
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
try:
await self.host.bridge.setParam(
await self.host.bridge.param_set(
"JabberID",
self.args.jid,
"Connection",
@ -161,7 +161,7 @@ class AccountCreate(base.CommandBase):
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
try:
await self.host.bridge.setParam(
await self.host.bridge.param_set(
"Password",
self.args.password,
"Connection",
@ -190,7 +190,7 @@ class AccountModify(base.CommandBase):
async def start(self):
try:
await self.host.bridge.inBandPasswordChange(
await self.host.bridge.in_band_password_change(
self.args.password,
self.args.profile,
)
@ -217,7 +217,7 @@ class AccountDelete(base.CommandBase):
async def start(self):
try:
jid_str = await self.host.bridge.asyncGetParamA(
jid_str = await self.host.bridge.param_get_a_async(
"JabberID",
"Connection",
profile_key=self.profile,
@ -233,10 +233,10 @@ class AccountDelete(base.CommandBase):
f"This is the XMPP account of profile {self.profile!r}\n"
f"Are you sure that you want to delete this account?"
)
await self.host.confirmOrQuit(message, _("Account deletion cancelled"))
await self.host.confirm_or_quit(message, _("Account deletion cancelled"))
try:
await self.host.bridge.inBandUnregister(jid_.domain, self.args.profile)
await self.host.bridge.in_band_unregister(jid_.domain, self.args.profile)
except Exception as e:
self.disp(f"can't delete XMPP account with jid {jid_!r}: {e}", error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)