Mercurial > libervia-backend
comparison sat_frontends/jp/cmd_info.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 | 9c76678a39e2 |
children | 4b842c1fb686 |
comparison
equal
deleted
inserted
replaced
4036:c4464d7ae97b | 4037:524856bd7b19 |
---|---|
228 data = {} | 228 data = {} |
229 | 229 |
230 # infos | 230 # infos |
231 if infos_requested: | 231 if infos_requested: |
232 try: | 232 try: |
233 infos = await self.host.bridge.discoInfos( | 233 infos = await self.host.bridge.disco_infos( |
234 jid, | 234 jid, |
235 node=self.args.node, | 235 node=self.args.node, |
236 use_cache=self.args.use_cache, | 236 use_cache=self.args.use_cache, |
237 profile_key=self.host.profile, | 237 profile_key=self.host.profile, |
238 ) | 238 ) |
249 ) | 249 ) |
250 | 250 |
251 # items | 251 # items |
252 if items_requested: | 252 if items_requested: |
253 try: | 253 try: |
254 items = await self.host.bridge.discoItems( | 254 items = await self.host.bridge.disco_items( |
255 jid, | 255 jid, |
256 node=self.args.node, | 256 node=self.args.node, |
257 use_cache=self.args.use_cache, | 257 use_cache=self.args.use_cache, |
258 profile_key=self.host.profile, | 258 profile_key=self.host.profile, |
259 ) | 259 ) |
296 | 296 |
297 async def start(self): | 297 async def start(self): |
298 jids = await self.host.check_jids([self.args.jid]) | 298 jids = await self.host.check_jids([self.args.jid]) |
299 jid = jids[0] | 299 jid = jids[0] |
300 try: | 300 try: |
301 data = await self.host.bridge.getSoftwareVersion(jid, self.host.profile) | 301 data = await self.host.bridge.software_version_get(jid, self.host.profile) |
302 except Exception as e: | 302 except Exception as e: |
303 self.disp(_("error while trying to get version: {e}").format(e=e), error=True) | 303 self.disp(_("error while trying to get version: {e}").format(e=e), error=True) |
304 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | 304 self.host.quit(C.EXIT_BRIDGE_ERRBACK) |
305 else: | 305 else: |
306 infos = [] | 306 infos = [] |
338 ) | 338 ) |
339 await self.host.output(C.OUTPUT_DICT, "simple", {}, data) | 339 await self.host.output(C.OUTPUT_DICT, "simple", {}, data) |
340 | 340 |
341 async def start(self): | 341 async def start(self): |
342 try: | 342 try: |
343 data = await self.host.bridge.sessionInfosGet(self.host.profile) | 343 data = await self.host.bridge.session_infos_get(self.host.profile) |
344 except Exception as e: | 344 except Exception as e: |
345 self.disp(_("Error getting session infos: {e}").format(e=e), error=True) | 345 self.disp(_("Error getting session infos: {e}").format(e=e), error=True) |
346 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | 346 self.host.quit(C.EXIT_BRIDGE_ERRBACK) |
347 else: | 347 else: |
348 await self.output(data) | 348 await self.output(data) |
360 "jid", type=str, nargs="?", default="", help=_("Entity to request") | 360 "jid", type=str, nargs="?", default="", help=_("Entity to request") |
361 ) | 361 ) |
362 | 362 |
363 async def start(self): | 363 async def start(self): |
364 try: | 364 try: |
365 data = await self.host.bridge.devicesInfosGet( | 365 data = await self.host.bridge.devices_infos_get( |
366 self.args.jid, self.host.profile | 366 self.args.jid, self.host.profile |
367 ) | 367 ) |
368 except Exception as e: | 368 except Exception as e: |
369 self.disp(_("Error getting devices infos: {e}").format(e=e), error=True) | 369 self.disp(_("Error getting devices infos: {e}").format(e=e), error=True) |
370 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | 370 self.host.quit(C.EXIT_BRIDGE_ERRBACK) |