diff sat_frontends/jp/cmd_account.py @ 4037:524856bd7b19

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.
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:54:42 +0200
parents 04283582966f
children 4b842c1fb686
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_account.py	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat_frontends/jp/cmd_account.py	Sat Apr 08 13:54:42 2023 +0200
@@ -80,7 +80,7 @@
 
     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 @@
 
         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 @@
 
         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 @@
             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 @@
             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 @@
 
     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 @@
 
     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 @@
                 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)