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
|
|
@ -28,7 +28,7 @@ __commands__ = ["Debug"]
|
|||
|
||||
|
||||
class BridgeCommon(object):
|
||||
def evalArgs(self):
|
||||
def eval_args(self):
|
||||
if self.args.arg:
|
||||
try:
|
||||
return eval("[{}]".format(",".join(self.args.arg)))
|
||||
|
|
@ -67,7 +67,7 @@ class Method(base.CommandBase, BridgeCommon):
|
|||
elif "profile" in argspec.args:
|
||||
kwargs["profile"] = self.profile
|
||||
|
||||
args = self.evalArgs()
|
||||
args = self.eval_args()
|
||||
|
||||
try:
|
||||
ret = await method(
|
||||
|
|
@ -100,12 +100,12 @@ class Signal(base.CommandBase, BridgeCommon):
|
|||
self.parser.add_argument("arg", nargs="*", help=_("argument of the signal"))
|
||||
|
||||
async def start(self):
|
||||
args = self.evalArgs()
|
||||
args = self.eval_args()
|
||||
json_args = json.dumps(args)
|
||||
# XXX: we use self.args.profile and not self.profile
|
||||
# because we want the raw profile_key (so plugin handle C.PROF_KEY_NONE)
|
||||
try:
|
||||
await self.host.bridge.debugFakeSignal(
|
||||
await self.host.bridge.debug_signal_fake(
|
||||
self.args.signal, json_args, self.args.profile
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
@ -115,11 +115,11 @@ class Signal(base.CommandBase, BridgeCommon):
|
|||
self.host.quit()
|
||||
|
||||
|
||||
class Bridge(base.CommandBase):
|
||||
class bridge(base.CommandBase):
|
||||
subcommands = (Method, Signal)
|
||||
|
||||
def __init__(self, host):
|
||||
super(Bridge, self).__init__(
|
||||
super(bridge, self).__init__(
|
||||
host, "bridge", use_profile=False, help=_("bridge s(t)imulation")
|
||||
)
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ class Monitor(base.CommandBase):
|
|||
help=_("stream direction filter"),
|
||||
)
|
||||
|
||||
async def printXML(self, direction, xml_data, profile):
|
||||
async def print_xml(self, direction, xml_data, profile):
|
||||
if self.args.direction == "in" and direction != "IN":
|
||||
return
|
||||
if self.args.direction == "out" and direction != "OUT":
|
||||
|
|
@ -186,7 +186,7 @@ class Monitor(base.CommandBase):
|
|||
self.disp("")
|
||||
|
||||
async def start(self):
|
||||
self.host.bridge.register_signal("xmlLog", self.printXML, "plugin")
|
||||
self.host.bridge.register_signal("xml_log", self.print_xml, "plugin")
|
||||
|
||||
|
||||
class Theme(base.CommandBase):
|
||||
|
|
@ -220,7 +220,7 @@ class Theme(base.CommandBase):
|
|||
|
||||
|
||||
class Debug(base.CommandBase):
|
||||
subcommands = (Bridge, Monitor, Theme)
|
||||
subcommands = (bridge, Monitor, Theme)
|
||||
|
||||
def __init__(self, host):
|
||||
super(Debug, self).__init__(
|
||||
|
|
|
|||
Loading…
Reference in a new issue