Mercurial > libervia-backend
comparison sat_frontends/jp/cmd_application.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 | 267e4987b58b |
children | 4b842c1fb686 |
comparison
equal
deleted
inserted
replaced
4036:c4464d7ae97b | 4037:524856bd7b19 |
---|---|
53 self.args.filters = list(set(self.args.filters)) | 53 self.args.filters = list(set(self.args.filters)) |
54 else: | 54 else: |
55 self.args.filters = ['available'] | 55 self.args.filters = ['available'] |
56 | 56 |
57 try: | 57 try: |
58 found_apps = await self.host.bridge.applicationsList(self.args.filters) | 58 found_apps = await self.host.bridge.applications_list(self.args.filters) |
59 except Exception as e: | 59 except Exception as e: |
60 self.disp(f"can't get applications list: {e}", error=True) | 60 self.disp(f"can't get applications list: {e}", error=True) |
61 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | 61 self.host.quit(C.EXIT_BRIDGE_ERRBACK) |
62 else: | 62 else: |
63 await self.output(found_apps) | 63 await self.output(found_apps) |
78 help=_("name of the application to start"), | 78 help=_("name of the application to start"), |
79 ) | 79 ) |
80 | 80 |
81 async def start(self): | 81 async def start(self): |
82 try: | 82 try: |
83 await self.host.bridge.applicationStart( | 83 await self.host.bridge.application_start( |
84 self.args.name, | 84 self.args.name, |
85 "", | 85 "", |
86 ) | 86 ) |
87 except Exception as e: | 87 except Exception as e: |
88 self.disp(f"can't start {self.args.name}: {e}", error=True) | 88 self.disp(f"can't start {self.args.name}: {e}", error=True) |
115 try: | 115 try: |
116 if self.args.name is not None: | 116 if self.args.name is not None: |
117 args = [self.args.name, "name"] | 117 args = [self.args.name, "name"] |
118 else: | 118 else: |
119 args = [self.args.id, "instance"] | 119 args = [self.args.id, "instance"] |
120 await self.host.bridge.applicationStop( | 120 await self.host.bridge.application_stop( |
121 *args, | 121 *args, |
122 "", | 122 "", |
123 ) | 123 ) |
124 except Exception as e: | 124 except Exception as e: |
125 if self.args.name is not None: | 125 if self.args.name is not None: |
159 try: | 159 try: |
160 if self.args.name is not None: | 160 if self.args.name is not None: |
161 args = [self.args.name, "name"] | 161 args = [self.args.name, "name"] |
162 else: | 162 else: |
163 args = [self.args.id, "instance"] | 163 args = [self.args.id, "instance"] |
164 exposed_data_raw = await self.host.bridge.applicationExposedGet( | 164 exposed_data_raw = await self.host.bridge.application_exposed_get( |
165 *args, | 165 *args, |
166 "", | 166 "", |
167 ) | 167 ) |
168 except Exception as e: | 168 except Exception as e: |
169 if self.args.name is not None: | 169 if self.args.name is not None: |