Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable PyQt5 type checking #1611

Merged
merged 24 commits into from
Jan 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
64293d1
Add PyQt5 stub library for mypy
gonzalo-bulnes Dec 14, 2022
25ee35b
Fix type hint: pyqtBoundSignal
gonzalo-bulnes Dec 14, 2022
0a1181e
Refactor rely on default signal connection type
gonzalo-bulnes Dec 14, 2022
0c26f06
Fix incorrect assignation to built-in methods
gonzalo-bulnes Dec 15, 2022
0edd853
Fix type hint: QSize
gonzalo-bulnes Dec 15, 2022
c4248bb
Ignore missing type hint
gonzalo-bulnes Dec 15, 2022
c5df0f2
Fix missing QueueJob attribute
gonzalo-bulnes Dec 15, 2022
828c17c
Fix method signature incompatible with supertype's
gonzalo-bulnes Dec 15, 2022
9a9e343
Ignore undefined attribute in QApplication
gonzalo-bulnes Dec 15, 2022
54f61eb
Fix type hint: Optional[QWidget]
gonzalo-bulnes Dec 15, 2022
787b212
Fix method signature incompatible with supertype's
gonzalo-bulnes Dec 15, 2022
e0173f5
Fix missing type hints in comparison method
gonzalo-bulnes Dec 15, 2022
da14362
Fix method signature incompatible with supertype's
gonzalo-bulnes Dec 20, 2022
69f923a
Fix missing type hint: SourceWidget
gonzalo-bulnes Dec 20, 2022
6c49ad3
Fix missing type hint: SourceWidget
gonzalo-bulnes Dec 20, 2022
f2b09ff
Fix missing type hints: SourceWidget
gonzalo-bulnes Dec 20, 2022
00d11b5
Fix missing type hint: conversation widgets
gonzalo-bulnes Dec 20, 2022
874ff14
Fix missing type hint: converssation messages
gonzalo-bulnes Dec 20, 2022
df6ceb7
Fix missing type hints: QMouseEvent
gonzalo-bulnes Dec 20, 2022
64a2f3b
Fix incompatible type in assignment
gonzalo-bulnes Dec 20, 2022
51609f9
Fix method signature incompatible with supertype's
gonzalo-bulnes Dec 20, 2022
10a309d
Fix move misplaced import to top of module
gonzalo-bulnes Dec 21, 2022
30429af
Refactor use future annotations
gonzalo-bulnes Dec 22, 2022
fc3afca
Add semgrep rule for unsafe assertions
gonzalo-bulnes Dec 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,19 +1006,22 @@ def get_selected_source(self) -> Optional[Source]:
return source_widget.source
return None # pragma: nocover

def get_source_widget(self, source_uuid: str) -> Optional[QListWidget]:
def get_source_widget(self, source_uuid: str) -> Optional["SourceWidget"]:
cfm marked this conversation as resolved.
Show resolved Hide resolved
"""
First try to get the source widget from the cache, then look for it in the SourceList.
"""
try:
source_item = self.source_items[source_uuid]
return self.itemWidget(source_item)
source_widget = self.itemWidget(source_item)
assert isinstance(source_widget, SourceWidget)
return source_widget
except KeyError:
pass

for i in range(self.count()):
list_item = self.item(i)
source_widget = self.itemWidget(list_item)
assert isinstance(source_widget, SourceWidget)
if source_widget and source_widget.source_uuid == source_uuid:
return source_widget

Expand Down