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
|
|
@ -55,10 +55,10 @@ class XEP_0095(object):
|
|||
self.host = host
|
||||
self.si_profiles = {} # key: SI profile, value: callback
|
||||
|
||||
def getHandler(self, client):
|
||||
def get_handler(self, client):
|
||||
return XEP_0095_handler(self)
|
||||
|
||||
def registerSIProfile(self, si_profile, callback):
|
||||
def register_si_profile(self, si_profile, callback):
|
||||
"""Add a callback for a SI Profile
|
||||
|
||||
@param si_profile(unicode): SI profile name (e.g. file-transfer)
|
||||
|
|
@ -66,7 +66,7 @@ class XEP_0095(object):
|
|||
"""
|
||||
self.si_profiles[si_profile] = callback
|
||||
|
||||
def unregisterSIProfile(self, si_profile):
|
||||
def unregister_si_profile(self, si_profile):
|
||||
try:
|
||||
del self.si_profiles[si_profile]
|
||||
except KeyError:
|
||||
|
|
@ -76,7 +76,7 @@ class XEP_0095(object):
|
|||
)
|
||||
)
|
||||
|
||||
def streamInit(self, iq_elt, client):
|
||||
def stream_init(self, iq_elt, client):
|
||||
"""This method is called on stream initiation (XEP-0095 #3.2)
|
||||
|
||||
@param iq_elt: IQ element
|
||||
|
|
@ -117,7 +117,7 @@ class XEP_0095(object):
|
|||
|
||||
client.send(iq_error_elt)
|
||||
|
||||
def acceptStream(self, client, iq_elt, feature_elt, misc_elts=None):
|
||||
def accept_stream(self, client, iq_elt, feature_elt, misc_elts=None):
|
||||
"""Send the accept stream initiation answer
|
||||
|
||||
@param iq_elt(domish.Element): initial SI request
|
||||
|
|
@ -134,7 +134,7 @@ class XEP_0095(object):
|
|||
si_elt.addChild(elt)
|
||||
client.send(result_elt)
|
||||
|
||||
def _parseOfferResult(self, iq_elt):
|
||||
def _parse_offer_result(self, iq_elt):
|
||||
try:
|
||||
si_elt = next(iq_elt.elements(NS_SI, "si"))
|
||||
except StopIteration:
|
||||
|
|
@ -142,7 +142,7 @@ class XEP_0095(object):
|
|||
raise exceptions.DataError
|
||||
return (iq_elt, si_elt)
|
||||
|
||||
def proposeStream(
|
||||
def propose_stream(
|
||||
self,
|
||||
client,
|
||||
to_jid,
|
||||
|
|
@ -178,7 +178,7 @@ class XEP_0095(object):
|
|||
si.addChild(feature_elt)
|
||||
|
||||
offer_d = offer.send()
|
||||
offer_d.addCallback(self._parseOfferResult)
|
||||
offer_d.addCallback(self._parse_offer_result)
|
||||
return sid, offer_d
|
||||
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ class XEP_0095_handler(xmlstream.XMPPHandler):
|
|||
|
||||
def connectionInitialized(self):
|
||||
self.xmlstream.addObserver(
|
||||
SI_REQUEST, self.plugin_parent.streamInit, client=self.parent
|
||||
SI_REQUEST, self.plugin_parent.stream_init, client=self.parent
|
||||
)
|
||||
|
||||
def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
|
||||
|
|
|
|||
Loading…
Reference in a new issue