Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-05-28 22:23:36 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-05-28 22:23:36 +0300
commit5a9362fd275e36ca931d4936eb7c40209741759b (patch)
tree770e102631a010ede1b6acc5b047f8f7460cc1d6
parent6e9eab1107ccf10356d4557441e846ac30af0fe2 (diff)
cq: Use union operator in ininstance() calls
-rw-r--r--gajim/common/dbus/remote_control.py2
-rw-r--r--gajim/common/modules/vcard_avatars.py2
-rw-r--r--gajim/common/storage/base.py2
-rw-r--r--gajim/gtk/certificate_dialog.py2
-rw-r--r--gajim/gtk/chat_list.py4
-rw-r--r--gajim/gtk/conversation/rows/file_transfer_jingle.py2
-rw-r--r--gajim/gtk/conversation/rows/message.py2
-rw-r--r--gajim/gtk/conversation/view.py4
-rw-r--r--pyproject.toml1
9 files changed, 10 insertions, 11 deletions
diff --git a/gajim/common/dbus/remote_control.py b/gajim/common/dbus/remote_control.py
index d7a254bdb..d80cce7bb 100644
--- a/gajim/common/dbus/remote_control.py
+++ b/gajim/common/dbus/remote_control.py
@@ -112,7 +112,7 @@ def get_dbus_struct(obj: Any) -> GLib.Variant:
return GLib.Variant('d', obj)
if isinstance(obj, bool):
return GLib.Variant('b', obj)
- if isinstance(obj, (list, tuple)):
+ if isinstance(obj, list | tuple):
lst = [get_dbus_struct(i) for i in obj # pyright: ignore
if i is not None]
result = GLib.Variant('av', lst)
diff --git a/gajim/common/modules/vcard_avatars.py b/gajim/common/modules/vcard_avatars.py
index 7a8f66a11..95c360477 100644
--- a/gajim/common/modules/vcard_avatars.py
+++ b/gajim/common/modules/vcard_avatars.py
@@ -96,7 +96,7 @@ class VCardAvatars(BaseModule):
self._log.info('Received: %s %s', contact.jid, avatar_sha)
app.app.avatar_storage.save_avatar(avatar)
- if isinstance(contact, (BareContact, GroupchatContact)):
+ if isinstance(contact, BareContact | GroupchatContact):
contact.set_avatar_sha(avatar_sha)
else:
diff --git a/gajim/common/storage/base.py b/gajim/common/storage/base.py
index 9b60bb1ba..107c1b65d 100644
--- a/gajim/common/storage/base.py
+++ b/gajim/common/storage/base.py
@@ -119,7 +119,7 @@ class Encoder(json.JSONEncoder):
dct['__type'] = 'RosterItem'
return dct
- if isinstance(o, (Affiliation, Role, StatusCode)):
+ if isinstance(o, Affiliation | Role | StatusCode):
return {'value': o.value,
'__type': o.__class__.__name__}
diff --git a/gajim/gtk/certificate_dialog.py b/gajim/gtk/certificate_dialog.py
index ae46a16c3..2f451f61e 100644
--- a/gajim/gtk/certificate_dialog.py
+++ b/gajim/gtk/certificate_dialog.py
@@ -130,7 +130,7 @@ class CertificateBox(Gtk.Box):
self._pk_size = _('Unknown')
if isinstance(public_key,
- (RSAPublicKey, DSAPublicKey, EllipticCurvePublicKey)):
+ RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey):
self._pk_size = f'{public_key.key_size} Bit'
self._ui.public_key_algorithm.set_text(self._pk_algorithm)
diff --git a/gajim/gtk/chat_list.py b/gajim/gtk/chat_list.py
index 815b65aa7..144bd491b 100644
--- a/gajim/gtk/chat_list.py
+++ b/gajim/gtk/chat_list.py
@@ -314,8 +314,8 @@ class ChatList(Gtk.ListBox, EventHelper):
return self._chats.get((account, jid)) is not None
def process_event(self, event: events.ChatListEventT) -> None:
- if isinstance(event, (events.MessageReceived,
- events.MamMessageReceived,
+ if isinstance(event, (events.MessageReceived |
+ events.MamMessageReceived |
events.GcMessageReceived)):
self._on_message_received(event)
elif isinstance(event, events.MessageUpdated):
diff --git a/gajim/gtk/conversation/rows/file_transfer_jingle.py b/gajim/gtk/conversation/rows/file_transfer_jingle.py
index 23f16dd0a..a3fc586fe 100644
--- a/gajim/gtk/conversation/rows/file_transfer_jingle.py
+++ b/gajim/gtk/conversation/rows/file_transfer_jingle.py
@@ -258,7 +258,7 @@ class FileTransferJingleRow(BaseRow):
elif isinstance(event, FileHashError):
self._ui.action_stack.set_visible_child_name('hash-error')
self._ui.transfer_action.set_text(_('File Verification Failed'))
- elif isinstance(event, (FileRequestError, FileSendError)):
+ elif isinstance(event, FileRequestError | FileSendError):
self._ui.action_stack.set_visible_child_name('error')
self._ui.transfer_action.set_text(_('File Transfer Cancelled'))
error_text = _('Connection with %s could not be '
diff --git a/gajim/gtk/conversation/rows/message.py b/gajim/gtk/conversation/rows/message.py
index 7da97009a..6544ba422 100644
--- a/gajim/gtk/conversation/rows/message.py
+++ b/gajim/gtk/conversation/rows/message.py
@@ -115,7 +115,7 @@ class MessageRow(BaseRow):
if is_previewable:
muc_context = None
if isinstance(self._contact,
- (GroupchatContact, GroupchatParticipant)):
+ GroupchatContact | GroupchatParticipant):
muc_context = self._contact.muc_context
self._message_widget = PreviewWidget(account)
app.preview_manager.create_preview(
diff --git a/gajim/gtk/conversation/view.py b/gajim/gtk/conversation/view.py
index 63b1f3ea1..9c804b865 100644
--- a/gajim/gtk/conversation/view.py
+++ b/gajim/gtk/conversation/view.py
@@ -390,7 +390,7 @@ class ConversationView(Gtk.ScrolledWindow):
def get_first_event_row(self) -> InfoMessage | MUCJoinLeft | None:
for row in self._list_box.get_children():
- if isinstance(row, (InfoMessage, MUCJoinLeft)):
+ if isinstance(row, InfoMessage | MUCJoinLeft):
return row
return None
@@ -398,7 +398,7 @@ class ConversationView(Gtk.ScrolledWindow):
children = self._list_box.get_children()
children.reverse()
for row in children:
- if isinstance(row, (InfoMessage, MUCJoinLeft)):
+ if isinstance(row, InfoMessage | MUCJoinLeft):
return row
return None
diff --git a/pyproject.toml b/pyproject.toml
index 5196ff53a..5444ed27c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -234,7 +234,6 @@ ignore = [
"SIM212", # Use `value if value else ''` instead of `'' if not value else value`
"SIM300", # Yoda conditions are discouraged use x instead
"UP032", # Use f-string instead of `format` call
- "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
"UP037", # Remove quotes from type annotation
]