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.
This commit is contained in:
parent
d50412c7f7
commit
6a6f15707a
1 changed files with 9945 additions and 9945 deletions
|
|
@ -45,7 +45,7 @@ class PipeOut(base.CommandBase):
|
|||
async def start(self):
|
||||
""" Create named pipe, and send stdin to it """
|
||||
try:
|
||||
port = await self.host.bridge.streamOut(
|
||||
port = await self.host.bridge.stream_out(
|
||||
await self.host.get_full_jid(self.args.jid),
|
||||
self.profile,
|
||||
)
|
||||
|
|
@ -89,13 +89,13 @@ async def handle_stream_in(reader, writer, host):
|
|||
except IOError as e:
|
||||
sys.stderr.write(f"{e}\n")
|
||||
break
|
||||
host.quitFromSignal()
|
||||
host.quit_from_signal()
|
||||
|
||||
|
||||
class PipeIn(base.CommandAnswering):
|
||||
def __init__(self, host):
|
||||
super(PipeIn, self).__init__(host, "in", help=_("receive a pipe stream"))
|
||||
self.action_callbacks = {"STREAM": self.onStreamAction}
|
||||
self.action_callbacks = {"STREAM": self.on_stream_action}
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument(
|
||||
|
|
@ -104,7 +104,7 @@ class PipeIn(base.CommandAnswering):
|
|||
help=_('Jids accepted (none means "accept everything")'),
|
||||
)
|
||||
|
||||
def getXmluiId(self, action_data):
|
||||
def get_xmlui_id(self, action_data):
|
||||
try:
|
||||
xml_ui = action_data["xmlui"]
|
||||
except KeyError:
|
||||
|
|
@ -113,13 +113,13 @@ class PipeIn(base.CommandAnswering):
|
|||
ui = xmlui_manager.create(self.host, xml_ui)
|
||||
if not ui.submit_id:
|
||||
self.disp(_("Invalid XMLUI received"), error=True)
|
||||
self.quitFromSignal(C.EXIT_INTERNAL_ERROR)
|
||||
self.quit_from_signal(C.EXIT_INTERNAL_ERROR)
|
||||
return ui.submit_id
|
||||
|
||||
async def onStreamAction(self, action_data, action_id, security_limit, profile):
|
||||
xmlui_id = self.getXmluiId(action_data)
|
||||
async def on_stream_action(self, action_data, action_id, security_limit, profile):
|
||||
xmlui_id = self.get_xmlui_id(action_data)
|
||||
if xmlui_id is None:
|
||||
self.host.quitFromSignal(C.EXIT_ERROR)
|
||||
self.host.quit_from_signal(C.EXIT_ERROR)
|
||||
try:
|
||||
from_jid = jid.JID(action_data["meta_from_jid"])
|
||||
except KeyError:
|
||||
|
|
@ -140,11 +140,11 @@ class PipeIn(base.CommandAnswering):
|
|||
else:
|
||||
break
|
||||
xmlui_data = {"answer": C.BOOL_TRUE, "port": str(port)}
|
||||
await self.host.bridge.launchAction(
|
||||
await self.host.bridge.action_launch(
|
||||
xmlui_id, xmlui_data, profile_key=profile)
|
||||
async with server:
|
||||
await server.serve_forever()
|
||||
self.host.quitFromSignal()
|
||||
self.host.quit_from_signal()
|
||||
|
||||
async def start(self):
|
||||
self.bare_jids = [jid.JID(jid_).bare for jid_ in self.args.jids]
|
||||
|
|
|
|||
Loading…
Reference in a new issue