diff sat_frontends/jp/cmd_list.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_list.py	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat_frontends/jp/cmd_list.py	Sat Apr 08 13:54:42 2023 +0200
@@ -52,13 +52,13 @@
         await common.fill_well_known_uri(self, os.getcwd(), "tickets", meta_map={})
         try:
             lists_data = data_format.deserialise(
-                await self.host.bridge.listGet(
+                await self.host.bridge.list_get(
                     self.args.service,
                     self.args.node,
                     self.args.max,
                     self.args.items,
                     "",
-                    self.getPubsubExtra(),
+                    self.get_pubsub_extra(),
                     self.profile,
                 ),
                 type_check=list,
@@ -123,7 +123,7 @@
         extra = {"update": update}
 
         try:
-            item_id = await self.host.bridge.listSet(
+            item_id = await self.host.bridge.list_set(
                 self.args.service,
                 self.args.node,
                 values,
@@ -171,9 +171,9 @@
             message = _("Are you sure to delete list item {item_id} ?").format(
                 item_id=self.args.item
             )
-            await self.host.confirmOrQuit(message, _("item deletion cancelled"))
+            await self.host.confirm_or_quit(message, _("item deletion cancelled"))
         try:
-            await self.host.bridge.listDeleteItem(
+            await self.host.bridge.list_delete_item(
                 self.args.service,
                 self.args.node,
                 self.args.item,
@@ -192,7 +192,7 @@
     # TODO: factorize with blog/import
 
     def __init__(self, host):
-        super(Import, self).__init__(
+        super().__init__(
             host,
             "import",
             use_progress=True,
@@ -253,13 +253,13 @@
             ),
         )
 
-    async def onProgressStarted(self, metadata):
+    async def on_progress_started(self, metadata):
         self.disp(_("Tickets upload started"), 2)
 
-    async def onProgressFinished(self, metadata):
+    async def on_progress_finished(self, metadata):
         self.disp(_("Tickets uploaded successfully"), 2)
 
-    async def onProgressError(self, error_msg):
+    async def on_progress_error(self, error_msg):
         self.disp(
             _("Error while uploading tickets: {error_msg}").format(error_msg=error_msg),
             error=True,