mypy: Fix int-issues in commands.py

This commit is contained in:
Florian Bruhin 2018-11-22 14:48:30 +01:00
parent 08bd47bc16
commit 923fd89323

View File

@ -75,7 +75,7 @@ class CommandDispatcher:
new_window.show() new_window.show()
return new_window.tabbed_browser return new_window.tabbed_browser
def _count(self): def _count(self) -> int:
"""Convenience method to get the widget count.""" """Convenience method to get the widget count."""
return self._tabbed_browser.widget.count() return self._tabbed_browser.widget.count()
@ -1143,6 +1143,8 @@ class CommandDispatcher:
self.tab_next() self.tab_next()
return return
assert isinstance(index, int)
if index < 0: if index < 0:
index = self._count() + index + 1 index = self._count() + index + 1
@ -1184,6 +1186,7 @@ class CommandDispatcher:
if config.val.tabs.wrap: if config.val.tabs.wrap:
new_idx %= self._count() new_idx %= self._count()
else: else:
assert isinstance(index, int)
# absolute moving # absolute moving
if count is not None: if count is not None:
new_idx = count - 1 new_idx = count - 1