cq: Fix/ignore ruff errors

This commit is contained in:
wurstsalat
2025-02-27 21:28:13 +01:00
parent 71f9292ea0
commit b4facf0287
3 changed files with 10 additions and 9 deletions

View File

@@ -158,8 +158,8 @@ class ChooseGPGKeyDialog(GajimAppWindow):
model = cast(Gtk.ListStore, self._ui.keys_treeview.get_model()) model = cast(Gtk.ListStore, self._ui.keys_treeview.get_model())
model.set_sort_func(1, self._sort) model.set_sort_func(1, self._sort)
for key_id in secret_keys: for key_id, key_label in secret_keys.items():
model.append((key_id, secret_keys[key_id])) model.append((key_id, key_label))
self.set_child(self._ui.box) self.set_child(self._ui.box)
self.show() self.show()

View File

@@ -39,7 +39,7 @@ def find_gpg():
gpg_cmd = binary + " -h >nul 2>&1" gpg_cmd = binary + " -h >nul 2>&1"
else: else:
gpg_cmd = binary + " -h >/dev/null 2>&1" 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 False
return True return True

View File

@@ -193,7 +193,7 @@ class Triggers(GajimPlugin):
return False return False
# tab_opened is ok. Now check opened chat window # 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 return False
# All is ok # All is ok
@@ -204,9 +204,8 @@ class Triggers(GajimPlugin):
assert event.jid is not None assert event.jid is not None
rule_recipients = [t.strip() for t in rule["recipients"].split(",")] rule_recipients = [t.strip() for t in rule["recipients"].split(",")]
if rule["recipient_type"] == "groupchat": if rule["recipient_type"] == "groupchat":
if event.jid in rule_recipients: return event.jid in rule_recipients
return True
return False
if rule["recipient_type"] == "contact" and event.jid not in rule_recipients: if rule["recipient_type"] == "contact" and event.jid not in rule_recipients:
return False return False
client = app.get_client(event.account) client = app.get_client(event.account)
@@ -224,7 +223,7 @@ class Triggers(GajimPlugin):
if group in rule_recipients: if group in rule_recipients:
group_found = True group_found = True
break break
if rule["recipient_type"] == "group" and not group_found: if rule["recipient_type"] == "group" and not group_found: # noqa: SIM103
return False return False
return True return True
@@ -233,7 +232,9 @@ class Triggers(GajimPlugin):
def _check_rule_status(self, event: ProcessableEventsT, rule: RuleT) -> bool: def _check_rule_status(self, event: ProcessableEventsT, rule: RuleT) -> bool:
rule_statuses = rule["status"].split() rule_statuses = rule["status"].split()
client = app.get_client(event.account) 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 False
return True return True