From e1b14bcf5a268b1d16a6e544f0b610bb9139ceae Mon Sep 17 00:00:00 2001 From: Alexander PapaTutuWawa Date: Fri, 9 Jul 2021 17:23:40 +0200 Subject: [PATCH] refactor: Replace for with dictionary comprehension --- mira/subscription.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mira/subscription.py b/mira/subscription.py index a11e772..1dc1c5d 100644 --- a/mira/subscription.py +++ b/mira/subscription.py @@ -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): """