fix: from_tab returns an optional, remove types

This commit is contained in:
thenightmail 2025-07-13 12:53:32 -04:00
parent 5b13962083
commit 176006c65b
2 changed files with 3 additions and 4 deletions

View File

@ -1060,11 +1060,10 @@ class AbstractTab(QWidget):
self, parent=self)
self.backend: Optional[usertypes.Backend] = None
# TODO fix this type error
if parent is not None and isinstance(parent, TreeTabWidget):
self.node: AbstractTab = Node(self, parent=parent.tree_root)
self.node = Node(self, parent=parent.tree_root)
else:
self.node: AbstractTab = Node(self, parent=None)
self.node = Node(self, parent=None)
# If true, this tab has been requested to be removed (or is removed).
self.pending_removal = False

View File

@ -49,7 +49,7 @@ class _UndoEntry:
@classmethod
def from_tab(
cls, tab: browsertab.AbstractTab, idx: int
) -> Union["_UndoEntry", list["_UndoEntry"]]:
) -> Optional[Union["_UndoEntry", list["_UndoEntry"]]]:
"""Generate an undo entry from `tab`."""
try:
history_data = tab.history.private_api.serialize()