diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index c3b7436d7..6384605fc 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -488,8 +488,7 @@ class TabBar(QTabBar): def _pinned_statistics(self) -> (int, int): """Get the number of pinned tabs and the total width of pinned tabs.""" - pinned_list = [idx - for idx in range(self.count()) + pinned_list = [idx for idx in range(self.count()) if self._tab_pinned(idx)] pinned_count = len(pinned_list) pinned_width = sum(self.minimumTabSizeHint(idx, ellipsis=False).width() diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 07949b771..d52793669 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -185,8 +185,8 @@ def debug_cache_stats(): tabbed_browser = objreg.get('tabbed-browser', scope='window', window='last-focused') # pylint: disable=protected-access - tabbed_browser_info = tabbed_browser.tabBar(). \ - _minimum_tab_size_hint_helper.cache_info() + tab_bar = tabbed_browser.tabBar() + tabbed_browser_info = tab_bar._minimum_tab_size_hint_helper.cache_info() # pylint: enable=protected-access log.misc.debug('is_valid_prefix: {}'.format(prefix_info)) diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index 14b35bc03..dd87c7ce2 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -64,9 +64,4 @@ class TestTabWidget: with qtbot.waitExposed(widget): widget.show() - def bench(): - for _a in range(1000): - # pylint: disable=protected-access - widget._update_tab_titles() - # pylint: enable=protected-access - benchmark(bench) + benchmark(widget._update_tab_titles)