diff sat_frontends/jp/cmd_param.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_param.py	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat_frontends/jp/cmd_param.py	Sat Apr 08 13:54:42 2023 +0200
@@ -50,11 +50,11 @@
 
     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 @@
                     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 @@
 
     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 @@
     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 @@
     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)