refactor: Replace for with dictionary comprehension

This commit is contained in:
PapaTutuWawa 2021-07-09 17:23:40 +02:00
parent d2032a5ccb
commit e1b14bcf5a

View File

@ -80,15 +80,11 @@ class SubscriptionManager:
if not module in self._subscriptions:
return {}
tmp = {}
for jid in self._subscriptions[module]:
if not keyword in self._subscriptions[module][jid]:
continue
data = self._subscriptions[module][jid][keyword]["data"]
tmp[jid] = data
return tmp
return {
jid: self._subscriptions[module][jid][keyword]["data"]
for jid in self._subscriptions[module]
if keyword in self._subscriptions[module][jid]
}
def get_subscriptions_for_keywords(self, module, keywords):
"""