diff --git a/pgp/gtk/key.py b/pgp/gtk/key.py index 0758077..e6ac384 100644 --- a/pgp/gtk/key.py +++ b/pgp/gtk/key.py @@ -158,8 +158,8 @@ class ChooseGPGKeyDialog(GajimAppWindow): model = cast(Gtk.ListStore, self._ui.keys_treeview.get_model()) model.set_sort_func(1, self._sort) - for key_id in secret_keys: - model.append((key_id, secret_keys[key_id])) + for key_id, key_label in secret_keys.items(): + model.append((key_id, key_label)) self.set_child(self._ui.box) self.show() diff --git a/pgp/modules/util.py b/pgp/modules/util.py index a876b0c..14f738e 100644 --- a/pgp/modules/util.py +++ b/pgp/modules/util.py @@ -39,7 +39,7 @@ def find_gpg(): gpg_cmd = binary + " -h >nul 2>&1" else: gpg_cmd = binary + " -h >/dev/null 2>&1" - if subprocess.call(gpg_cmd, shell=True): # noqa: S602 + if subprocess.call(gpg_cmd, shell=True): # noqa: S602, SIM103 return False return True diff --git a/triggers/triggers.py b/triggers/triggers.py index 196459f..9985068 100644 --- a/triggers/triggers.py +++ b/triggers/triggers.py @@ -193,7 +193,7 @@ class Triggers(GajimPlugin): return False # tab_opened is ok. Now check opened chat window - if not self._check_rule_has_focus(event, rule): + if not self._check_rule_has_focus(event, rule): # noqa: SIM103 return False # All is ok @@ -204,9 +204,8 @@ class Triggers(GajimPlugin): assert event.jid is not None rule_recipients = [t.strip() for t in rule["recipients"].split(",")] if rule["recipient_type"] == "groupchat": - if event.jid in rule_recipients: - return True - return False + return event.jid in rule_recipients + if rule["recipient_type"] == "contact" and event.jid not in rule_recipients: return False client = app.get_client(event.account) @@ -224,7 +223,7 @@ class Triggers(GajimPlugin): if group in rule_recipients: group_found = True break - if rule["recipient_type"] == "group" and not group_found: + if rule["recipient_type"] == "group" and not group_found: # noqa: SIM103 return False return True @@ -233,7 +232,9 @@ class Triggers(GajimPlugin): def _check_rule_status(self, event: ProcessableEventsT, rule: RuleT) -> bool: rule_statuses = rule["status"].split() client = app.get_client(event.account) - if rule["status"] != "all" and client.status not in rule_statuses: + if ( # noqa: SIM103 + rule["status"] != "all" and client.status not in rule_statuses + ): return False return True