diff --git a/.ci/deploy.py b/.ci/deploy.py index 429fca6..2259fff 100644 --- a/.ci/deploy.py +++ b/.ci/deploy.py @@ -106,7 +106,6 @@ def get_dir_list(ftp: FTP_TLS) -> set[str]: def upload_file(ftp: FTP_TLS, filepath: Path) -> None: - name = filepath.name console.print("Upload file", name) with open(filepath, "rb") as f: @@ -114,7 +113,6 @@ def upload_file(ftp: FTP_TLS, filepath: Path) -> None: def create_release_folder(ftp: FTP_TLS, packages_to_publish: list[PackageT]) -> None: - folders = {manifest["short_name"] for manifest, _ in packages_to_publish} dir_list = get_dir_list(ftp) missing_folders = folders - dir_list diff --git a/acronyms_expander/acronyms_expander.py b/acronyms_expander/acronyms_expander.py index 2ce5922..2b3f76a 100644 --- a/acronyms_expander/acronyms_expander.py +++ b/acronyms_expander/acronyms_expander.py @@ -95,7 +95,6 @@ class AcronymsExpanderPlugin(GajimPlugin): self._save_acronyms(acronyms) def _on_buffer_changed(self, message_input: MessageInputTextView) -> None: - if self._contact is None: # If no chat has been activated yet return @@ -160,7 +159,6 @@ class AcronymsExpanderPlugin(GajimPlugin): end: Gtk.TextIter, substitute: str, ) -> None: - self._replace_in_progress = True buffer_.delete(start, end) buffer_.insert(start, substitute) diff --git a/acronyms_expander/gtk/config.py b/acronyms_expander/gtk/config.py index 6b5b70a..532ea53 100644 --- a/acronyms_expander/gtk/config.py +++ b/acronyms_expander/gtk/config.py @@ -44,7 +44,6 @@ class ConfigBuilder(Gtk.Builder): class ConfigDialog(GajimAppWindow): def __init__(self, plugin: AcronymsExpanderPlugin, transient: Gtk.Window) -> None: - GajimAppWindow.__init__( self, name="AcronymsConfigDialog", @@ -84,14 +83,12 @@ class ConfigDialog(GajimAppWindow): def _on_acronym_edited( self, _renderer: Gtk.CellRendererText, path: str, new_text: str ) -> None: - iter_ = self._ui.acronyms_store.get_iter(path) self._ui.acronyms_store.set_value(iter_, 0, new_text) def _on_substitute_edited( self, _renderer: Gtk.CellRendererText, path: str, new_text: str ) -> None: - iter_ = self._ui.acronyms_store.get_iter(path) self._ui.acronyms_store.set_value(iter_, 1, new_text) diff --git a/anti_spam/modules/anti_spam.py b/anti_spam/modules/anti_spam.py index 686ddb7..163eb07 100644 --- a/anti_spam/modules/anti_spam.py +++ b/anti_spam/modules/anti_spam.py @@ -70,7 +70,6 @@ class AntiSpam(BaseModule): def _message_received( self, _con: Client, _stanza: Message, properties: MessageProperties ) -> None: - if properties.is_sent_carbon: # Another device already sent a message assert properties.jid @@ -155,7 +154,6 @@ class AntiSpam(BaseModule): def _subscribe_received( self, _con: Client, _stanza: Presence, properties: PresenceProperties ) -> None: - msg_from = properties.jid assert msg_from is not None block_sub = self._config["block_subscription_requests"] diff --git a/clients_icons/clients_icons.py b/clients_icons/clients_icons.py index 0181341..63c5865 100644 --- a/clients_icons/clients_icons.py +++ b/clients_icons/clients_icons.py @@ -66,7 +66,6 @@ class ClientsIconsPlugin(GajimPlugin): def _get_image_and_client_name( self, contact: GroupchatParticipant | ResourceContact, _widget: Gtk.Widget ) -> tuple[Gtk.Image, str] | None: - disco_info = app.storage.cache.get_last_disco_info(contact.jid) if disco_info is None: return None @@ -86,7 +85,6 @@ class ClientsIconsPlugin(GajimPlugin): def _contact_tooltip_resource_populate( self, resource_box: Gtk.Box, resource: ResourceContact ) -> None: - result = self._get_image_and_client_name(resource, resource_box) if result is None: return diff --git a/clients_icons/config_dialog.py b/clients_icons/config_dialog.py index e19b11d..c5827c0 100644 --- a/clients_icons/config_dialog.py +++ b/clients_icons/config_dialog.py @@ -32,7 +32,6 @@ if TYPE_CHECKING: class ClientsIconsConfigDialog(SettingsDialog): def __init__(self, plugin: ClientsIconsPlugin, parent: Gtk.Window) -> None: - self.plugin = plugin settings = [ Setting( diff --git a/length_notifier/config_dialog.py b/length_notifier/config_dialog.py index 6be8b0a..3038f29 100644 --- a/length_notifier/config_dialog.py +++ b/length_notifier/config_dialog.py @@ -32,7 +32,6 @@ if TYPE_CHECKING: class LengthNotifierConfigDialog(SettingsDialog): def __init__(self, plugin: LengthNotifierPlugin, parent: Gtk.Window) -> None: - self.plugin = plugin jids = self.plugin.config["JIDS"] or "" if isinstance(jids, list): diff --git a/length_notifier/length_notifier.py b/length_notifier/length_notifier.py index 1356fed..38a1720 100644 --- a/length_notifier/length_notifier.py +++ b/length_notifier/length_notifier.py @@ -20,6 +20,7 @@ Message length notifier plugin. :copyright: Copyright (2008) Mateusz BiliƄski :license: GPL """ + from __future__ import annotations from typing import Any @@ -71,8 +72,7 @@ class LengthNotifierPlugin(GajimPlugin): ), "JIDS": ( "", - "Enable the plugin for selected XMPP addresses " - "only (comma separated)", + "Enable the plugin for selected XMPP addresses only (comma separated)", ), } @@ -101,7 +101,6 @@ class LengthNotifierPlugin(GajimPlugin): def _message_actions_box_created( self, message_actions_box: MessageActionsBox, gtk_box: Gtk.Box ) -> None: - self._message_action_box = message_actions_box self._actions_box_widget = gtk_box self._create_counter() @@ -121,7 +120,6 @@ class Counter(Gtk.Label): def __init__( self, message_input: MessageInputTextView, config: GajimPluginConfig ) -> None: - Gtk.Label.__init__(self) self.set_tooltip_text(_("Number of typed characters")) self.add_css_class("dim-label") @@ -168,7 +166,6 @@ class Counter(Gtk.Label): self._inverted_color = f"rgb({red}, {green}, {blue})" def _set_css(self) -> None: - css = """ .length-warning { color: %s; diff --git a/message_box_size/config_dialog.py b/message_box_size/config_dialog.py index e3692c3..206fc0f 100644 --- a/message_box_size/config_dialog.py +++ b/message_box_size/config_dialog.py @@ -33,7 +33,6 @@ if TYPE_CHECKING: class MessageBoxSizeConfigDialog(SettingsDialog): def __init__(self, plugin: MsgBoxSizePlugin, parent: Gtk.Window) -> None: - self.plugin = plugin settings = [ Setting( diff --git a/now_listen/gtk/config.py b/now_listen/gtk/config.py index 7951808..0941a8f 100644 --- a/now_listen/gtk/config.py +++ b/now_listen/gtk/config.py @@ -32,7 +32,6 @@ if TYPE_CHECKING: class NowListenConfigDialog(SettingsDialog): def __init__(self, plugin: NowListenPlugin, parent: Gtk.Window) -> None: - self.plugin = plugin settings = [ Setting( diff --git a/now_listen/now_listen.py b/now_listen/now_listen.py index 2fbe446..2cf3291 100644 --- a/now_listen/now_listen.py +++ b/now_listen/now_listen.py @@ -80,7 +80,6 @@ class NowListenPlugin(GajimPlugin): _keycode: int, state: Gdk.ModifierType, ) -> bool: - if keyval != Gdk.KEY_n: return Gdk.EVENT_PROPAGATE diff --git a/openpgp/backend/sql.py b/openpgp/backend/sql.py index 91387fc..43ad1b0 100644 --- a/openpgp/backend/sql.py +++ b/openpgp/backend/sql.py @@ -82,9 +82,7 @@ class Storage: %s PRAGMA user_version=1; END TRANSACTION; - """ % ( - query - ) + """ % (query) self._con.executescript(transaction) def _migrate_database(self) -> None: diff --git a/openpgp/gtk/key.py b/openpgp/gtk/key.py index 4be80c4..8168a84 100644 --- a/openpgp/gtk/key.py +++ b/openpgp/gtk/key.py @@ -46,7 +46,6 @@ TRUST_DATA = { class KeyDialog(GajimAppWindow): def __init__(self, account: str, jid: JID, transient: Gtk.Window) -> None: - GajimAppWindow.__init__( self, name="PGPKeyDialog", @@ -201,7 +200,6 @@ class TrustPopver(Gtk.Popover): class MenuOption(Gtk.ListBoxRow): - type_: Trust | None icon: str label: str @@ -223,7 +221,6 @@ class MenuOption(Gtk.ListBoxRow): class VerifiedOption(MenuOption): - type_ = Trust.VERIFIED icon = "security-high-symbolic" label = _("Verified") @@ -234,7 +231,6 @@ class VerifiedOption(MenuOption): class NotTrustedOption(MenuOption): - type_ = Trust.NOT_TRUSTED icon = "dialog-error-symbolic" label = _("Not Trusted") @@ -245,7 +241,6 @@ class NotTrustedOption(MenuOption): class DeleteOption(MenuOption): - type_ = None icon = "user-trash-symbolic" label = _("Delete") diff --git a/openpgp/gtk/wizard.py b/openpgp/gtk/wizard.py index 7071d54..e819429 100644 --- a/openpgp/gtk/wizard.py +++ b/openpgp/gtk/wizard.py @@ -103,7 +103,6 @@ class KeyWizard(Gtk.Assistant): class WelcomePage(Gtk.Box): - type_ = Gtk.AssistantPageType.INTRO title = _("Welcome") complete = True @@ -118,7 +117,6 @@ class WelcomePage(Gtk.Box): class RequestPage(Gtk.Box): - type_ = Gtk.AssistantPageType.INTRO title = _("Request OpenPGP Key") complete = False @@ -150,7 +148,6 @@ class RequestPage(Gtk.Box): class NewKeyPage(RequestPage): - type_ = Gtk.AssistantPageType.PROGRESS title = _("Generating new Key") complete = False @@ -203,7 +200,6 @@ class NewKeyPage(RequestPage): class SuccessfulPage(Gtk.Box): - type_ = Gtk.AssistantPageType.SUMMARY title = _("Setup successful") complete = True @@ -225,7 +221,6 @@ class SuccessfulPage(Gtk.Box): class ErrorPage(Gtk.Box): - type_ = Gtk.AssistantPageType.SUMMARY title = _("Setup failed") complete = True diff --git a/openpgp/modules/openpgp.py b/openpgp/modules/openpgp.py index 70efdf4..3c7df63 100644 --- a/openpgp/modules/openpgp.py +++ b/openpgp/modules/openpgp.py @@ -73,7 +73,6 @@ name = ENCRYPTION_NAME class OpenPGP(BaseModule): - _nbxmpp_extends = "OpenPGP" _nbxmpp_methods = [ "set_keylist", diff --git a/openpgp/pgpplugin.py b/openpgp/pgpplugin.py index 1e3c426..712d09d 100644 --- a/openpgp/pgpplugin.py +++ b/openpgp/pgpplugin.py @@ -75,10 +75,14 @@ class OpenPGPPlugin(GajimPlugin): self.gui_extension_points = { "encrypt" + self.encryption_name: (self._encrypt_message, None), "send_message" + self.encryption_name: (self._before_sendmessage, None), - "encryption_dialog" - + self.encryption_name: (self._on_encryption_button_clicked, None), - "encryption_state" - + self.encryption_name: (self._get_encryption_state, None), + "encryption_dialog" + self.encryption_name: ( + self._on_encryption_button_clicked, + None, + ), + "encryption_state" + self.encryption_name: ( + self._get_encryption_state, + None, + ), "update_caps": (self._update_caps, None), } @@ -133,8 +137,7 @@ class OpenPGPPlugin(GajimPlugin): openpgp = self.get_openpgp_module(account) if openpgp.secret_key_available: log.info( - "%s => Publish keylist and public key " - "after plugin activation", + "%s => Publish keylist and public key after plugin activation", account, ) openpgp.request_keylist() diff --git a/pgp/gtk/config.py b/pgp/gtk/config.py index f6bc82e..e954662 100644 --- a/pgp/gtk/config.py +++ b/pgp/gtk/config.py @@ -45,7 +45,6 @@ class ConfigBuilder(Gtk.Builder): class PGPConfigDialog(GajimAppWindow): def __init__(self, plugin: PGPPlugin, transient: Gtk.Window) -> None: - GajimAppWindow.__init__( self, name="PGPConfigDialog", diff --git a/pgp/gtk/key.py b/pgp/gtk/key.py index e6ac384..7b2a728 100644 --- a/pgp/gtk/key.py +++ b/pgp/gtk/key.py @@ -50,7 +50,6 @@ class KeyDialog(GajimAppWindow): def __init__( self, plugin: PGPPlugin, account: str, jid: JID, transient: Gtk.Window ) -> None: - GajimAppWindow.__init__( self, name="PGPKeyDialog", @@ -128,7 +127,6 @@ class ChooseGPGKeyDialog(GajimAppWindow): transient: Gtk.Window, callback: Callable[[tuple[str, str] | None], None], ) -> None: - GajimAppWindow.__init__( self, name="PGPChooseKeyDialog", diff --git a/pgp/modules/pgp_legacy.py b/pgp/modules/pgp_legacy.py index cc27c39..f8dd46b 100644 --- a/pgp/modules/pgp_legacy.py +++ b/pgp/modules/pgp_legacy.py @@ -213,7 +213,6 @@ class PGPLegacy(BaseModule): callback: Callable[[OutgoingMessage], None], always_trust: bool, ) -> None: - text = message.get_text() assert text is not None @@ -263,7 +262,6 @@ class PGPLegacy(BaseModule): def _raise_message_not_sent( client: Client, message: OutgoingMessage, error: str ) -> None: - text = message.get_text() assert text is not None diff --git a/pgp/plugin.py b/pgp/plugin.py index 2aebc10..02ec4ae 100644 --- a/pgp/plugin.py +++ b/pgp/plugin.py @@ -83,7 +83,6 @@ if BINARY is None or error: class PGPPlugin(GajimPlugin): - def init(self): self.description = _("PGP encryption as per XEP-0027") if error_msg: @@ -140,7 +139,6 @@ class PGPPlugin(GajimPlugin): @staticmethod def _on_not_trusted(event: PGPNotTrusted) -> None: - def _on_response(response_id: str, do_not_ask_again: bool) -> None: if response_id == "accept": event.on_yes(do_not_ask_again) diff --git a/quick_replies/gtk/config.py b/quick_replies/gtk/config.py index 32383e9..ee921d6 100644 --- a/quick_replies/gtk/config.py +++ b/quick_replies/gtk/config.py @@ -43,7 +43,6 @@ class ConfigBuilder(Gtk.Builder): class ConfigDialog(GajimAppWindow): def __init__(self, plugin: QuickRepliesPlugin, transient: Gtk.Window) -> None: - GajimAppWindow.__init__( self, name="QuickRepliesConfigDialog", @@ -90,7 +89,6 @@ class ConfigDialog(GajimAppWindow): def _on_reply_edited( self, _renderer: Gtk.CellRendererText, path: str, new_text: str ) -> None: - iter_ = self._ui.replies_store.get_iter(path) self._ui.replies_store.set_value(iter_, 0, new_text) diff --git a/quick_replies/plugin.py b/quick_replies/plugin.py index 94e20f8..543fa3b 100644 --- a/quick_replies/plugin.py +++ b/quick_replies/plugin.py @@ -82,7 +82,6 @@ class QuickRepliesPlugin(GajimPlugin): def _message_actions_box_created( self, message_actions_box: MessageActionsBox, gtk_box: Gtk.Box ) -> None: - for action in self._actions: app.window.add_action(action) diff --git a/scripts/generate_ui_types.py b/scripts/generate_ui_types.py index 45001d5..244cb62 100755 --- a/scripts/generate_ui_types.py +++ b/scripts/generate_ui_types.py @@ -43,11 +43,11 @@ def parse(path: Path) -> tuple[str, str]: continue klass = node.attrib["class"] if klass.startswith("GtkSource"): - klass = f'GtkSource.{klass.removeprefix("GtkSource")}' + klass = f"GtkSource.{klass.removeprefix('GtkSource')}" elif klass.startswith("Atk"): - klass = f'Atk.{klass.removeprefix("Atk")}' + klass = f"Atk.{klass.removeprefix('Atk')}" else: - klass = f'Gtk.{klass.removeprefix("Gtk")}' + klass = f"Gtk.{klass.removeprefix('Gtk')}" lines.append(ATTR % (id_.replace("-", "_"), klass)) diff --git a/triggers/gtk/config.py b/triggers/gtk/config.py index 3c28d84..78f04b5 100644 --- a/triggers/gtk/config.py +++ b/triggers/gtk/config.py @@ -79,7 +79,6 @@ class ConfigBuilder(Gtk.Builder): class ConfigDialog(GajimAppWindow): def __init__(self, plugin: Triggers, transient: Gtk.Window) -> None: - GajimAppWindow.__init__( self, name="TriggersConfigDialog", @@ -467,7 +466,6 @@ class ConfigDialog(GajimAppWindow): self._set_treeview_string() def _on_recipient_type_combobox_changed(self, widget: Gtk.ComboBox) -> None: - if self._active_num < 0: return recipient_type = RECIPIENT_TYPES[widget.get_active()] @@ -578,7 +576,6 @@ class ConfigDialog(GajimAppWindow): def _on_use_it_toggled( self, widget: Gtk.CheckButton, opposite_widget: Gtk.CheckButton, option: str ) -> None: - if widget.get_active(): if opposite_widget.get_active(): opposite_widget.set_active(False) @@ -591,7 +588,6 @@ class ConfigDialog(GajimAppWindow): def _on_disable_it_toggled( self, widget: Gtk.CheckButton, opposite_widget: Gtk.CheckButton, option: str ) -> None: - if widget.get_active(): if opposite_widget.get_active(): opposite_widget.set_active(False) diff --git a/triggers/triggers.py b/triggers/triggers.py index 9985068..2dc93d3 100644 --- a/triggers/triggers.py +++ b/triggers/triggers.py @@ -103,7 +103,6 @@ class Triggers(GajimPlugin): check_func: Callable[..., bool], apply_func: Callable[..., Any], ) -> RuleResult: - result = RuleResult() rules_num = [int(item) for item in self.config] @@ -290,7 +289,6 @@ class Triggers(GajimPlugin): def _excecute_notification_rules( self, result: RuleResult, event: Notification ) -> bool: - if result.sound is False: event.sound = None diff --git a/typings/gnupg/__init__.pyi b/typings/gnupg/__init__.pyi index 9d8b2e0..3263acf 100644 --- a/typings/gnupg/__init__.pyi +++ b/typings/gnupg/__init__.pyi @@ -29,13 +29,11 @@ class _ReadableFile(Protocol): def read(self, size: int) -> bytes: ... class StatusHandler: - on_data_failure: Exception | None = ... def __init__(self, gpg: GPG) -> None: ... def handle_status(self, key: str, value: str) -> None: ... class Verify(StatusHandler): - TRUST_EXPIRED: int = ... TRUST_UNDEFINED: int = ... TRUST_NEVER: int = ... @@ -74,7 +72,6 @@ class ImportResultDict(TypedDict): text: str class ImportResult(StatusHandler): - counts: list[str] = ... returncode: int | None = ... results: list[ImportResultDict] @@ -92,12 +89,10 @@ ESCAPE_PATTERN: re.Pattern[Any] = ... BASIC_ESCAPES: dict[str, str] = ... class SendResult(StatusHandler): - returncode: int | None = ... def handle_status(self, key: str, value: str) -> None: ... class SearchKeys(StatusHandler, list[dict[Any, Any]]): - UID_INDEX: int = ... FIELDS: list[str] = ... returncode: int | None = ... @@ -108,7 +103,6 @@ class SearchKeys(StatusHandler, list[dict[Any, Any]]): def handle_status(self, key: str, value: str) -> None: ... class ListKeys(SearchKeys): - UID_INDEX: int = ... FIELDS: list[str] = ... def __init__(self, gpg: GPG) -> None: ... @@ -126,7 +120,6 @@ class ScanKeys(ListKeys): class TextHandler: ... class Crypt(Verify, TextHandler): - data: bytes ok: bool status_detail: str @@ -137,7 +130,6 @@ class Crypt(Verify, TextHandler): def handle_status(self, key: str, value: str) -> None: ... class GenKey(StatusHandler): - returncode: int | None = ... def __init__(self, gpg: GPG) -> None: ... def __nonzero__(self) -> bool: ... @@ -145,7 +137,6 @@ class GenKey(StatusHandler): def handle_status(self, key: str, value: str) -> None: ... class AddSubkey(StatusHandler): - returncode: int | None = ... def __init__(self, gpg: GPG) -> None: ... def __nonzero__(self) -> bool: ... @@ -156,7 +147,6 @@ class ExportResult(GenKey): def handle_status(self, key: str, value: str) -> None: ... class DeleteResult(StatusHandler): - returncode: int | None = ... def __init__(self, gpg: GPG) -> None: ... @@ -168,7 +158,6 @@ class DeleteResult(StatusHandler): class TrustResult(DeleteResult): ... class Sign(StatusHandler, TextHandler): - returncode: int | None = ... def __init__(self, gpg: GPG) -> None: ... def __nonzero__(self) -> bool: ... @@ -188,7 +177,6 @@ HEX_DIGITS_RE: re.Pattern[Any] = ... PUBLIC_KEY_RE: re.Pattern[Any] = ... class GPG: - error_map: None = ... decode_errors: str = ... buffer_size: int = ... diff --git a/typings/gpg/errors.pyi b/typings/gpg/errors.pyi index a5fcf89..06be515 100644 --- a/typings/gpg/errors.pyi +++ b/typings/gpg/errors.pyi @@ -1,7 +1,6 @@ from typing import Any class GpgError(Exception): - error: Any | None context: str | None result: Any | None