comparison sat_frontends/jp/cmd_adhoc.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
comparison
equal deleted inserted replaced
4036:c4464d7ae97b 4037:524856bd7b19
73 magics.add(MAGIC_BAREJID) 73 magics.add(MAGIC_BAREJID)
74 jids = set(self.args.jids).difference(magics) 74 jids = set(self.args.jids).difference(magics)
75 if self.args.loop: 75 if self.args.loop:
76 flags.append(FLAG_LOOP) 76 flags.append(FLAG_LOOP)
77 try: 77 try:
78 bus_name, methods = await self.host.bridge.adHocDBusAddAuto( 78 bus_name, methods = await self.host.bridge.ad_hoc_dbus_add_auto(
79 name, 79 name,
80 list(jids), 80 list(jids),
81 self.args.groups, 81 self.args.groups,
82 magics, 82 magics,
83 self.args.forbidden_jids, 83 self.args.forbidden_jids,
143 help=_("node of the command (default: list commands)"), 143 help=_("node of the command (default: list commands)"),
144 ) 144 )
145 145
146 async def start(self): 146 async def start(self):
147 try: 147 try:
148 xmlui_raw = await self.host.bridge.adHocRun( 148 xmlui_raw = await self.host.bridge.ad_hoc_run(
149 self.args.jid, 149 self.args.jid,
150 self.args.node, 150 self.args.node,
151 self.profile, 151 self.profile,
152 ) 152 )
153 except Exception as e: 153 except Exception as e:
157 xmlui = xmlui_manager.create(self.host, xmlui_raw) 157 xmlui = xmlui_manager.create(self.host, xmlui_raw)
158 workflow = self.args.workflow 158 workflow = self.args.workflow
159 await xmlui.show(workflow) 159 await xmlui.show(workflow)
160 if not workflow: 160 if not workflow:
161 if xmlui.type == "form": 161 if xmlui.type == "form":
162 await xmlui.submitForm() 162 await xmlui.submit_form()
163 self.host.quit() 163 self.host.quit()
164 164
165 165
166 class List(base.CommandBase): 166 class List(base.CommandBase):
167 """List Ad-Hoc commands available on a service""" 167 """List Ad-Hoc commands available on a service"""
179 help=_("jid of the service (default: profile's server)"), 179 help=_("jid of the service (default: profile's server)"),
180 ) 180 )
181 181
182 async def start(self): 182 async def start(self):
183 try: 183 try:
184 xmlui_raw = await self.host.bridge.adHocList( 184 xmlui_raw = await self.host.bridge.ad_hoc_list(
185 self.args.jid, 185 self.args.jid,
186 self.profile, 186 self.profile,
187 ) 187 )
188 except Exception as e: 188 except Exception as e:
189 self.disp(f"can't get ad-hoc commands list: {e}", error=True) 189 self.disp(f"can't get ad-hoc commands list: {e}", error=True)