Reformatted code base using black.

This commit is contained in:
Goffi 2024-06-19 18:44:57 +02:00
commit 53fdaa9d09

View file

@ -120,10 +120,7 @@ class XEP_0465:
@utils.ensure_deferred
async def _subscriptions(
self,
service="",
nodeIdentifier="",
profile_key=C.PROF_KEY_NONE
self, service="", nodeIdentifier="", profile_key=C.PROF_KEY_NONE
) -> str:
client = self.host.get_client(profile_key)
service = None if not service else jid.JID(service)
@ -134,7 +131,7 @@ class XEP_0465:
self,
client: SatXMPPEntity,
service: Optional[jid.JID] = None,
node: Optional[str] = None
node: Optional[str] = None,
) -> List[Dict[str, Union[str, bool]]]:
"""Retrieve public subscriptions from a service
@ -170,9 +167,7 @@ class XEP_0465:
"state": subscription_elt.getAttribute("subscription", "subscribed"),
}
except KeyError:
log.warning(
f"invalid <subscription> element: {subscription_elt.toXml()}"
)
log.warning(f"invalid <subscription> element: {subscription_elt.toXml()}")
continue
if node is not None and sub_dict["node"] != node:
# if not is specified, we filter out any other node
@ -183,10 +178,7 @@ class XEP_0465:
@utils.ensure_deferred
async def _get_public_node_subscriptions(
self,
service: str,
node: str,
profile_key: str
self, service: str, node: str, profile_key: str
) -> Dict[str, str]:
client = self.host.get_client(profile_key)
subs = await self.get_public_node_subscriptions(
@ -199,10 +191,7 @@ class XEP_0465:
return f"{NS_PPS_SUBSCRIBERS}/{node}"
async def get_public_node_subscriptions(
self,
client: SatXMPPEntity,
service: Optional[jid.JID],
nodeIdentifier: str
self, client: SatXMPPEntity, service: Optional[jid.JID], nodeIdentifier: str
) -> Dict[jid.JID, str]:
"""Retrieve public subscriptions to a node
@ -237,9 +226,7 @@ class XEP_0465:
try:
ret[jid.JID(subscriber_elt["jid"])] = "subscribed"
except (KeyError, RuntimeError):
log.warning(
f"invalid <subscriber> element: {subscriber_elt.toXml()}"
)
log.warning(f"invalid <subscriber> element: {subscriber_elt.toXml()}")
continue
return ret
@ -253,7 +240,7 @@ class XEP_0465:
"""
if options is None:
options = {}
options[f'{{{NS_PPS}}}public'] = True
options[f"{{{NS_PPS}}}public"] = True
return options