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
|
|
@ -98,33 +98,33 @@ class ProfileCreate(base.CommandBase):
|
|||
|
||||
async def start(self):
|
||||
"""Create a new profile"""
|
||||
if self.args.profile in await self.host.bridge.profilesListGet():
|
||||
if self.args.profile in await self.host.bridge.profiles_list_get():
|
||||
self.disp(f"Profile {self.args.profile} already exists.", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERROR)
|
||||
try:
|
||||
await self.host.bridge.profileCreate(
|
||||
await self.host.bridge.profile_create(
|
||||
self.args.profile, self.args.password, self.args.component)
|
||||
except Exception as e:
|
||||
self.disp(f"can't create profile: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
||||
try:
|
||||
await self.host.bridge.profileStartSession(
|
||||
await self.host.bridge.profile_start_session(
|
||||
self.args.password, self.args.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"can't start profile session: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
||||
if self.args.jid:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"JabberID", self.args.jid, "Connection", profile_key=self.args.profile)
|
||||
xmpp_pwd = self.args.password or self.args.xmpp_password
|
||||
if xmpp_pwd:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"Password", xmpp_pwd, "Connection", profile_key=self.args.profile)
|
||||
|
||||
if self.args.autoconnect is not None:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"autoconnect_backend", self.args.autoconnect, "Connection",
|
||||
profile_key=self.args.profile)
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class ProfileDefault(base.CommandBase):
|
|||
pass
|
||||
|
||||
async def start(self):
|
||||
print(await self.host.bridge.profileNameGet('@DEFAULT@'))
|
||||
print(await self.host.bridge.profile_name_get('@DEFAULT@'))
|
||||
self.host.quit()
|
||||
|
||||
|
||||
|
|
@ -154,15 +154,15 @@ class ProfileDelete(base.CommandBase):
|
|||
self.parser.add_argument('-f', '--force', action='store_true', help=_('delete profile without confirmation'))
|
||||
|
||||
async def start(self):
|
||||
if self.args.profile not in await self.host.bridge.profilesListGet():
|
||||
if self.args.profile not in await self.host.bridge.profiles_list_get():
|
||||
log.error(f"Profile {self.args.profile} doesn't exist.")
|
||||
self.host.quit(C.EXIT_NOT_FOUND)
|
||||
if not self.args.force:
|
||||
message = f"Are you sure to delete profile [{self.args.profile}] ?"
|
||||
cancel_message = "Profile deletion cancelled"
|
||||
await self.host.confirmOrQuit(message, cancel_message)
|
||||
await self.host.confirm_or_quit(message, cancel_message)
|
||||
|
||||
await self.host.bridge.asyncDeleteProfile(self.args.profile)
|
||||
await self.host.bridge.profile_delete_async(self.args.profile)
|
||||
self.host.quit()
|
||||
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ class ProfileInfo(base.CommandBase):
|
|||
data = {}
|
||||
for label, category, name in self.to_show:
|
||||
try:
|
||||
value = await self.host.bridge.asyncGetParamA(
|
||||
value = await self.host.bridge.param_get_a_async(
|
||||
name, category, profile_key=self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"can't get {name}/{category} param: {e}", error=True)
|
||||
|
|
@ -218,7 +218,7 @@ class ProfileList(base.CommandBase):
|
|||
clients, components = False, True
|
||||
else:
|
||||
clients, components = True, True
|
||||
await self.output(await self.host.bridge.profilesListGet(clients, components))
|
||||
await self.output(await self.host.bridge.profiles_list_get(clients, components))
|
||||
self.host.quit()
|
||||
|
||||
|
||||
|
|
@ -251,19 +251,19 @@ class ProfileModify(base.CommandBase):
|
|||
if self.args.disable_password:
|
||||
self.args.password = ''
|
||||
if self.args.password is not None:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"Password", self.args.password, "General", profile_key=self.host.profile)
|
||||
if self.args.jid is not None:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"JabberID", self.args.jid, "Connection", profile_key=self.host.profile)
|
||||
if self.args.xmpp_password is not None:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"Password", self.args.xmpp_password, "Connection",
|
||||
profile_key=self.host.profile)
|
||||
if self.args.default:
|
||||
await self.host.bridge.profileSetDefault(self.host.profile)
|
||||
await self.host.bridge.profile_set_default(self.host.profile)
|
||||
if self.args.autoconnect is not None:
|
||||
await self.host.bridge.setParam(
|
||||
await self.host.bridge.param_set(
|
||||
"autoconnect_backend", self.args.autoconnect, "Connection",
|
||||
profile_key=self.host.profile)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue