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

@ -50,11 +50,11 @@ class Get(base.CommandBase):
async def start(self):
if self.args.category is None:
categories = await self.host.bridge.getParamsCategories()
categories = await self.host.bridge.params_categories_get()
print("\n".join(categories))
elif self.args.name is None:
try:
values_dict = await self.host.bridge.asyncGetParamsValuesFromCategory(
values_dict = await self.host.bridge.params_values_from_category_get_async(
self.args.category, self.args.security_limit, "", "", self.profile
)
except Exception as e:
@ -67,7 +67,7 @@ class Get(base.CommandBase):
print(f"{name}\t{value}")
else:
try:
value = await self.host.bridge.asyncGetParamA(
value = await self.host.bridge.param_get_a_async(
self.args.name,
self.args.category,
self.args.attribute,
@ -100,7 +100,7 @@ class Set(base.CommandBase):
async def start(self):
try:
await self.host.bridge.setParam(
await self.host.bridge.param_set(
self.args.name,
self.args.value,
self.args.category,
@ -131,7 +131,7 @@ class SaveTemplate(base.CommandBase):
async def start(self):
"""Save parameters template to XML file"""
try:
await self.host.bridge.saveParamsTemplate(self.args.filename)
await self.host.bridge.params_template_save(self.args.filename)
except Exception as e:
self.disp(_("can't save parameters to file: {e}").format(e=e), error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
@ -161,7 +161,7 @@ class LoadTemplate(base.CommandBase):
async def start(self):
"""Load parameters template from xml file"""
try:
self.host.bridge.loadParamsTemplate(self.args.filename)
self.host.bridge.params_template_load(self.args.filename)
except Exception as e:
self.disp(_("can't load parameters from file: {e}").format(e=e), error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)