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
|
|
@ -64,7 +64,7 @@ class Get(base.CommandBase):
|
|||
|
||||
async def start(self):
|
||||
try:
|
||||
contacts = await self.host.bridge.getContacts(profile_key=self.host.profile)
|
||||
contacts = await self.host.bridge.contacts_get(profile_key=self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"error while retrieving the contacts: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
|
@ -72,7 +72,7 @@ class Get(base.CommandBase):
|
|||
contacts_dict = {}
|
||||
for contact_jid_s, data, groups in contacts:
|
||||
# FIXME: we have to convert string to bool here for historical reason
|
||||
# getContacts format should be changed and serialised properly
|
||||
# contacts_get format should be changed and serialised properly
|
||||
for key in ('from', 'to', 'ask'):
|
||||
if key in data:
|
||||
data[key] = C.bool(data[key])
|
||||
|
|
@ -107,7 +107,7 @@ class Set(base.CommandBase):
|
|||
groups = self.args.groups
|
||||
else:
|
||||
try:
|
||||
entity_data = await self.host.bridge.contactGet(
|
||||
entity_data = await self.host.bridge.contact_get(
|
||||
self.args.jid, self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"error while retrieving the contact: {e}", error=True)
|
||||
|
|
@ -117,7 +117,7 @@ class Set(base.CommandBase):
|
|||
groups = list(groups.union(self.args.groups))
|
||||
|
||||
try:
|
||||
await self.host.bridge.updateContact(
|
||||
await self.host.bridge.contact_update(
|
||||
self.args.jid, name, groups, self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"error while updating the contact: {e}", error=True)
|
||||
|
|
@ -142,9 +142,9 @@ class Delete(base.CommandBase):
|
|||
message = _("Are you sure to delete {entity} from your roster?").format(
|
||||
entity=self.args.jid
|
||||
)
|
||||
await self.host.confirmOrQuit(message, _("entity deletion cancelled"))
|
||||
await self.host.confirm_or_quit(message, _("entity deletion cancelled"))
|
||||
try:
|
||||
await self.host.bridge.delContact(
|
||||
await self.host.bridge.contact_del(
|
||||
self.args.jid, self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"error while deleting the entity: {e}", error=True)
|
||||
|
|
@ -162,7 +162,7 @@ class Stats(base.CommandBase):
|
|||
|
||||
async def start(self):
|
||||
try:
|
||||
contacts = await self.host.bridge.getContacts(profile_key=self.host.profile)
|
||||
contacts = await self.host.bridge.contacts_get(profile_key=self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"error while retrieving the contacts: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
|
@ -235,7 +235,7 @@ class Purge(base.CommandBase):
|
|||
|
||||
async def start(self):
|
||||
try:
|
||||
contacts = await self.host.bridge.getContacts(self.host.profile)
|
||||
contacts = await self.host.bridge.contacts_get(self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"error while retrieving the contacts: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
|
@ -258,7 +258,7 @@ class Purge(base.CommandBase):
|
|||
elif await self.ask_confirmation(no_sub, no_from, no_to):
|
||||
for contact in no_sub + no_from + no_to:
|
||||
try:
|
||||
await self.host.bridge.delContact(
|
||||
await self.host.bridge.contact_del(
|
||||
contact, profile_key=self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"can't delete contact {contact!r}: {e}", error=True)
|
||||
|
|
@ -310,7 +310,7 @@ class Resync(base.CommandBase):
|
|||
|
||||
async def start(self):
|
||||
try:
|
||||
await self.host.bridge.rosterResync(profile_key=self.host.profile)
|
||||
await self.host.bridge.roster_resync(profile_key=self.host.profile)
|
||||
except Exception as e:
|
||||
self.disp(f"can't resynchronise roster: {e}", error=True)
|
||||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
|
|
|
|||
Loading…
Reference in a new issue