Philipp Hörist pushed to branch master at gajim / gajim


Commits:
854cee83 by lovetox at 2022-01-23T22:09:16+01:00
FileTransferJingle: Add asserts to help pyright

- - - - -
9241befa by lovetox at 2022-01-23T22:09:32+01:00
Update pyrightconfig.json

- - - - -


2 changed files:

- gajim/gtk/conversation/rows/file_transfer_jingle.py
- pyrightconfig.json


Changes:

=====================================
gajim/gtk/conversation/rows/file_transfer_jingle.py
=====================================
@@ -210,10 +210,13 @@ def _show_file_infos(self) -> None:
         else:
             self._ui.file_description.hide()
 
+        assert self._file_props.size is not None
         self._ui.file_size.set_text(
             GLib.format_size_full(self._file_props.size, self._units))
 
     def process_event(self, event: TransferEventT) -> None:
+        assert self._file_props is not None
+
         if isinstance(event, JingleErrorReceived):
             if event.sid != self._file_props.sid:
                 return
@@ -261,6 +264,7 @@ def _update_progress(self, file_props: FileProp) -> None:
 
         time_now = time.time()
         full_size = file_props.size
+        assert full_size is not None
 
         if file_props.type_ == 's':
             # We're sending a file
@@ -273,6 +277,7 @@ def _update_progress(self, file_props: FileProp) -> None:
         else:
             # We're receiving a file
             transferred_size = file_props.received_len
+            assert transferred_size is not None
 
         if full_size == 0:
             return
@@ -321,15 +326,20 @@ def _on_accept_file_request(self, _button: Gtk.Button) -> 
None:
     def _on_reject_file_request(self, _button: Gtk.Button) -> None:
         self._client.get_module('Bytestream').send_file_rejection(
             self._file_props)
+        assert self._file_props is not None
         self._file_props.stopped = True
         self._ui.action_stack.set_visible_child_name('rejected')
         self._ui.transfer_action.set_text(_('File Transfer Cancelled'))
 
     def _on_open_file(self, _button: Gtk.Button) -> None:
+        assert self._file_props is not None
+        assert self._file_props.file_name is not None
         if os.path.exists(self._file_props.file_name):
             open_file(self._file_props.file_name)
 
     def _on_open_folder(self, _button: Gtk.Button) -> None:
+        assert self._file_props is not None
+        assert self._file_props.file_name is not None
         path = os.path.split(self._file_props.file_name)[0]
         if os.path.exists(path) and os.path.isdir(path):
             open_file(path)


=====================================
pyrightconfig.json
=====================================
@@ -2,6 +2,7 @@
     "pythonPlatform": "All",
     "pythonVersion": "3.9",
     "typeCheckingMode": "strict",
+    "reportImportCycles": "none",
     "include": [
         "gajim/gajim.py",
         "gajim/common/application.py",
@@ -36,25 +37,7 @@
         "gajim/gtk/const.py",
         "gajim/gtk/contact_info.py",
         "gajim/gtk/contacts_flowbox.py",
-        "gajim/gtk/conversation/code_widget.py",
-        "gajim/gtk/conversation/jump_to_end_button.py",
-        "gajim/gtk/conversation/plain_widget.py",
-        "gajim/gtk/conversation/quote_widget.py",
-        "gajim/gtk/conversation/rows/base.py",
-        "gajim/gtk/conversation/rows/call.py",
-        "gajim/gtk/conversation/rows/command_output.py",
-        "gajim/gtk/conversation/rows/date.py",
-        "gajim/gtk/conversation/rows/file_transfer.py",
-        "gajim/gtk/conversation/rows/info.py",
-        "gajim/gtk/conversation/rows/message.py",
-        "gajim/gtk/conversation/rows/muc_join_left.py",
-        "gajim/gtk/conversation/rows/muc_subject.py",
-        "gajim/gtk/conversation/rows/user_status.py",
-        "gajim/gtk/conversation/rows/read_marker.py",
-        "gajim/gtk/conversation/rows/scroll_hint.py",
-        "gajim/gtk/conversation/rows/widgets.py",
-        "gajim/gtk/conversation/scrolled.py",
-        "gajim/gtk/conversation/view.py",
+        "gajim/gtk/conversation",
         "gajim/gtk/features.py",
         "gajim/gtk/file_transfer_send.py",
         "gajim/gtk/groupchat_details.py",



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/4f76a5b17927963925571dc1f9f56d3f9b7759b0...9241befa2f64e5e5d59b6a2443b596eef547ae00

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/4f76a5b17927963925571dc1f9f56d3f9b7759b0...9241befa2f64e5e5d59b6a2443b596eef547ae00
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to