Mercurial > libervia-backend
diff sat_frontends/jp/cmd_event.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 | d8baf92cb921 |
children | 4b842c1fb686 |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_event.py Fri Apr 07 15:18:39 2023 +0200 +++ b/sat_frontends/jp/cmd_event.py Sat Apr 08 13:54:42 2023 +0200 @@ -62,11 +62,11 @@ async def start(self): try: - events_data_s = await self.host.bridge.eventsGet( + events_data_s = await self.host.bridge.events_get( self.args.service, self.args.node, self.args.items, - self.getPubsubExtra(), + self.get_pubsub_extra(), self.profile, ) except Exception as e: @@ -325,7 +325,7 @@ if self.args.end is None: self.parser.error("--end or --duration must be set") try: - await self.host.bridge.eventCreate( + await self.host.bridge.event_create( data_format.serialise(event_data), self.args.id, self.args.node, @@ -359,7 +359,7 @@ async def start(self): event_data = self.get_event_data() try: - await self.host.bridge.eventModify( + await self.host.bridge.event_modify( data_format.serialise(event_data), self.args.item, self.args.service, @@ -394,7 +394,7 @@ async def start(self): try: - event_data_s = await self.host.bridge.eventInviteeGet( + event_data_s = await self.host.bridge.event_invitee_get( self.args.service, self.args.node, self.args.item, @@ -436,7 +436,7 @@ # TODO: handle RSVP with XMLUI in a similar way as for `ad-hoc run` fields = dict(self.args.fields) if self.args.fields else {} try: - self.host.bridge.eventInviteeSet( + self.host.bridge.event_invitee_set( self.args.service, self.args.node, self.args.item, @@ -522,7 +522,7 @@ show_table = OUTPUT_OPT_TABLE in self.args.output_opts - table = common.Table.fromListDict( + table = common.Table.from_list_dict( self.host, data, ("nick",) + (("jid",) if self.host.verbosity else ()) + ("attend", "guests"), @@ -596,7 +596,7 @@ else: # we get prefilled data with all people try: - affiliations = await self.host.bridge.psNodeAffiliationsGet( + affiliations = await self.host.bridge.ps_node_affiliations_get( self.args.service, self.args.node, self.profile, @@ -615,7 +615,7 @@ } try: - event_data = await self.host.bridge.eventInviteesList( + event_data = await self.host.bridge.event_invitees_list( self.args.service, self.args.node, self.profile, @@ -647,7 +647,7 @@ # we get nicknames for everybody, make it easier for organisers for jid_, data in prefilled.items(): - id_data = await self.host.bridge.identityGet(jid_, [], True, self.profile) + id_data = await self.host.bridge.identity_get(jid_, [], True, self.profile) id_data = data_format.deserialise(id_data) data["nick"] = id_data["nicknames"][0] @@ -716,7 +716,7 @@ emails_extra = self.args.email[1:] try: - await self.host.bridge.eventInviteByEmail( + await self.host.bridge.event_invite_by_email( self.args.service, self.args.node, self.args.item,