diff sat/plugins/plugin_misc_app_manager.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 402d31527af4
children
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_app_manager.py	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat/plugins/plugin_misc_app_manager.py	Sat Apr 08 13:54:42 2023 +0200
@@ -84,31 +84,31 @@
         self._started = {}
         # instance id to app data map
         self._instances = {}
-        host.bridge.addMethod(
-            "applicationsList",
+        host.bridge.add_method(
+            "applications_list",
             ".plugin",
             in_sign="as",
             out_sign="as",
             method=self.list_applications,
         )
-        host.bridge.addMethod(
-            "applicationStart",
+        host.bridge.add_method(
+            "application_start",
             ".plugin",
             in_sign="ss",
             out_sign="s",
             method=self._start,
             async_=True,
         )
-        host.bridge.addMethod(
-            "applicationStop",
+        host.bridge.add_method(
+            "application_stop",
             ".plugin",
             in_sign="sss",
             out_sign="",
             method=self._stop,
             async_=True,
         )
-        host.bridge.addMethod(
-            "applicationExposedGet",
+        host.bridge.add_method(
+            "application_exposed_get",
             ".plugin",
             in_sign="sss",
             out_sign="s",
@@ -117,12 +117,12 @@
         )
         # application has been started succeesfully,
         # args: name, instance_id, extra
-        host.bridge.addSignal(
+        host.bridge.add_signal(
             "application_started", ".plugin", signature="sss"
         )
         # application went wrong with the application
         # args: name, instance_id, extra
-        host.bridge.addSignal(
+        host.bridge.add_signal(
             "application_error", ".plugin", signature="sss"
         )
         yaml.add_constructor(
@@ -169,7 +169,7 @@
                 "expected"
             )
 
-        value = self.host.memory.getConfig(section, name, default)
+        value = self.host.memory.config_get(section, name, default)
         # FIXME: "public_url" is used only here and doesn't take multi-sites into account
         if name == "public_url" and (not value or value.startswith('http')):
             if not value:
@@ -408,7 +408,7 @@
                 log.info(f"{app_name!r} is already started or being started")
                 return ret_data
             else:
-                cache_path = self.host.memory.getCachePath(
+                cache_path = self.host.memory.get_cache_path(
                     PLUGIN_INFO[C.PI_IMPORT_NAME], app_name
                 )
                 cache_path.mkdir(0o700, parents=True, exist_ok=True)