From 8ba35b97b5708171f31a1faf1d61dd037e2d1a72 Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Fri, 24 Jan 2025 11:14:19 +0100 Subject: [PATCH] fix trailing comma (manual) ruff 'COM818' --- recipes/grani.recipe | 2 +- recipes/liberty_times.recipe | 2 +- recipes/zn_ru.recipe | 2 +- recipes/zn_ua.recipe | 2 +- ruff-strict-pep8.toml | 2 +- setup/installers.py | 2 +- setup/lc_data.py | 2 +- src/calibre/db/cli/cmd_fts_index.py | 2 +- src/calibre/gui2/bars.py | 6 +++--- src/calibre/gui2/jobs.py | 2 +- src/calibre/gui2/preferences/server.py | 2 +- src/calibre/gui2/viewer/toolbars.py | 4 ++-- src/calibre/gui2/viewer/ui.py | 4 ++-- src/calibre/utils/config.py | 2 +- src/calibre/utils/icu_test.py | 2 +- src/calibre/utils/run_tests.py | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/recipes/grani.recipe b/recipes/grani.recipe index 1cf98fcc8f..5509434320 100644 --- a/recipes/grani.recipe +++ b/recipes/grani.recipe @@ -21,7 +21,7 @@ class Grani(BasicNewsRecipe): remove_tags_before = dict(name='h3') - remove_tags_after = dict(name='div', attrs={'class': 'main-text clearfix'}), + remove_tags_after = dict(name='div', attrs={'class': 'main-text clearfix'}) # Original feeds # feeds = [ diff --git a/recipes/liberty_times.recipe b/recipes/liberty_times.recipe index e079ea0468..d83ab440d2 100644 --- a/recipes/liberty_times.recipe +++ b/recipes/liberty_times.recipe @@ -36,6 +36,6 @@ class AdvancedUserRecipe1277443634(BasicNewsRecipe): no_stylesheets = True encoding = 'utf-8' conversion_options = {'linearize_tables': True} - masthead_url = 'https://cache.ltn.com.tw/images/rwd_ltnlogo.png', + masthead_url = 'https://cache.ltn.com.tw/images/rwd_ltnlogo.png' cover_url = 'https://cache.ltn.com.tw/images/rwd_ltnlogo.png' auto_cleanup = True diff --git a/recipes/zn_ru.recipe b/recipes/zn_ru.recipe index aad3f4f184..5dbfe68f88 100644 --- a/recipes/zn_ru.recipe +++ b/recipes/zn_ru.recipe @@ -21,7 +21,7 @@ class Zerkalo(BasicNewsRecipe): remove_tags_before = dict(name='h1') - remove_tags_after = dict(name='div', attrs={'class': 'article_body'}), + remove_tags_after = dict(name='div', attrs={'class': 'article_body'}) remove_tags = [ dict(name='span', attrs={'class': 'print print-art-js'}), diff --git a/recipes/zn_ua.recipe b/recipes/zn_ua.recipe index e08c197257..39c06a1fce 100644 --- a/recipes/zn_ua.recipe +++ b/recipes/zn_ua.recipe @@ -21,7 +21,7 @@ class Zerkalo(BasicNewsRecipe): remove_tags_before = dict(name='h1') - remove_tags_after = dict(name='div', attrs={'class': 'article_body'}), + remove_tags_after = dict(name='div', attrs={'class': 'article_body'}) remove_tags = [ dict(name='span', attrs={'class': 'print print-art-js'}), diff --git a/ruff-strict-pep8.toml b/ruff-strict-pep8.toml index ff2c6e4b67..ca3a67040b 100644 --- a/ruff-strict-pep8.toml +++ b/ruff-strict-pep8.toml @@ -23,7 +23,7 @@ ignore = [ ] select = [ 'E', 'F', 'I', 'W', 'INT', - 'Q', 'UP', 'YTT', 'TID', 'C4', + 'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', ] [lint.per-file-ignores] diff --git a/setup/installers.py b/setup/installers.py index a45f689701..fa21a25605 100644 --- a/setup/installers.py +++ b/setup/installers.py @@ -163,7 +163,7 @@ class BuildInstaller(Command): class BuildInstallers(BuildInstaller): OS = '' - ALL_ARCHES = '64', + ALL_ARCHES = ('64',) def run(self, opts): for bitness in self.ALL_ARCHES: diff --git a/setup/lc_data.py b/setup/lc_data.py index 7aed799487..8756a9930c 100644 --- a/setup/lc_data.py +++ b/setup/lc_data.py @@ -20,7 +20,7 @@ def generate_data(): ans = [] for x, limit in (('day', 8), ('mon', 13)): for attr in ('ab' + x, x): - ans.append((attr, tuple(map(nl, (getattr(locale, f'{attr.upper()}_{i}') for i in range(1, limit)))))), + ans.append((attr, tuple(map(nl, (getattr(locale, f'{attr.upper()}_{i}') for i in range(1, limit)))))) for x in ('d_t_fmt', 'd_fmt', 't_fmt', 't_fmt_ampm', 'radixchar', 'thousep', 'yesexpr', 'noexpr'): ans.append((x, nl(getattr(locale, x.upper())))) return ans diff --git a/src/calibre/db/cli/cmd_fts_index.py b/src/calibre/db/cli/cmd_fts_index.py index baabbd8c10..f0f85d9311 100644 --- a/src/calibre/db/cli/cmd_fts_index.py +++ b/src/calibre/db/cli/cmd_fts_index.py @@ -179,7 +179,7 @@ def main(opts, args, dbctx): parts = x.split(':', 1) book_id = int(parts[0]) if len(parts) == 1: - return book_id, + return (book_id,) fmts = tuple(x.upper() for x in parts[1].split(',')) return (book_id,) + fmts diff --git a/src/calibre/gui2/bars.py b/src/calibre/gui2/bars.py index fc86b10b7e..b839ffb6da 100644 --- a/src/calibre/gui2/bars.py +++ b/src/calibre/gui2/bars.py @@ -482,9 +482,9 @@ if ismacos: self.edit_menu = QMenu() self.edit_action = QAction(_('Edit'), self) self.edit_action.setMenu(self.edit_menu) - ac(_('Copy'), QKeySequence.StandardKey.Copy), - ac(_('Paste'), QKeySequence.StandardKey.Paste), - ac(_('Select all'), QKeySequence.StandardKey.SelectAll), + ac(_('Copy'), QKeySequence.StandardKey.Copy) + ac(_('Paste'), QKeySequence.StandardKey.Paste) + ac(_('Select all'), QKeySequence.StandardKey.SelectAll) mb.addAction(self.edit_action) self.added_actions = [self.edit_action] else: diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index fa19779a48..e08be8ff45 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -74,7 +74,7 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{ job_done = pyqtSignal(int) def __init__(self): - self.header_titles = _('Job'), _('Status'), _('Progress'), _('Running time'), _('Start time'), + self.header_titles = _('Job'), _('Status'), _('Progress'), _('Running time'), _('Start time') QAbstractTableModel.__init__(self) SearchQueryParser.__init__(self, ['all']) diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py index 497b6c8a05..fef223e98c 100644 --- a/src/calibre/gui2/preferences/server.py +++ b/src/calibre/gui2/preferences/server.py @@ -789,7 +789,7 @@ class User(QWidget): else: m = _('{} is currently allowed access to all libraries') b = _('Restrict the &libraries {} can access').format(self.username) - self.restrict_button.setText(b), + self.restrict_button.setText(b) self.access_label.setText(m.format(username)) def show_user(self, username=None, user_data=None): diff --git a/src/calibre/gui2/viewer/toolbars.py b/src/calibre/gui2/viewer/toolbars.py index e5309462f0..75b6161fff 100644 --- a/src/calibre/gui2/viewer/toolbars.py +++ b/src/calibre/gui2/viewer/toolbars.py @@ -558,7 +558,7 @@ class ConfigureToolBar(Dialog): self.available_actions.add_names(names) def remove_item(self, item): - names = self.current_actions.remove_item(item), + names = (self.current_actions.remove_item(item),) self.available_actions.add_names(names) def add_actions(self): @@ -566,7 +566,7 @@ class ConfigureToolBar(Dialog): self.current_actions.add_names(names) def add_item(self, item): - names = self.available_actions.remove_item(item), + names = (self.available_actions.remove_item(item),) self.current_actions.add_names(names) def restore_defaults(self): diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index 0e08dc8ab0..1415f3625f 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -75,8 +75,8 @@ def dock_defs(): def d(title, name, area, allowed=Qt.DockWidgetArea.LeftDockWidgetArea | Qt.DockWidgetArea.RightDockWidgetArea): ans[name] = Dock(name + '-dock', title, area, allowed) - d(_('Table of Contents'), 'toc', Qt.DockWidgetArea.LeftDockWidgetArea), - d(_('Lookup'), 'lookup', Qt.DockWidgetArea.RightDockWidgetArea), + d(_('Table of Contents'), 'toc', Qt.DockWidgetArea.LeftDockWidgetArea) + d(_('Lookup'), 'lookup', Qt.DockWidgetArea.RightDockWidgetArea) d(_('Bookmarks'), 'bookmarks', Qt.DockWidgetArea.RightDockWidgetArea) d(_('Search'), 'search', Qt.DockWidgetArea.LeftDockWidgetArea) d(_('Inspector'), 'inspector', Qt.DockWidgetArea.RightDockWidgetArea, Qt.DockWidgetArea.AllDockWidgetAreas) diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 3f8e379db4..c917115a75 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -39,7 +39,7 @@ optparse._ = _ if False: # Make pyflakes happy - Config, ConfigProxy, Option, OptionValues, StringConfig, OptionSet, + Config, ConfigProxy, Option, OptionValues, StringConfig, OptionSet ConfigInterface, tweaks, plugin_dir, prefs, from_json, to_json, make_config_dir diff --git a/src/calibre/utils/icu_test.py b/src/calibre/utils/icu_test.py index f3da84f887..a48d627571 100644 --- a/src/calibre/utils/icu_test.py +++ b/src/calibre/utils/icu_test.py @@ -114,7 +114,7 @@ class TestICU(unittest.TestCase): self.assertFalse(icu.contains('xxx', 'xx')) self.assertTrue(icu.primary_contains('pena', 'peña')) x = icu.primary_collator() - self.ae(x.get_attribute(icu._icu.UCOL_STRENGTH), icu._icu.UCOL_PRIMARY), + self.ae(x.get_attribute(icu._icu.UCOL_STRENGTH), icu._icu.UCOL_PRIMARY) self.ae((0, 4), icu.primary_no_punc_find('pena"', 'peña')) self.ae((0, 13), icu.primary_no_punc_find('typographers', 'typographer’s')) self.ae((0, 7), icu.primary_no_punc_find('abcd', 'a\u00adb\u200cc\u200dd')) diff --git a/src/calibre/utils/run_tests.py b/src/calibre/utils/run_tests.py index 4fdde74e0c..56c49dda0a 100644 --- a/src/calibre/utils/run_tests.py +++ b/src/calibre/utils/run_tests.py @@ -324,7 +324,7 @@ def run_test(test_name, verbosity=4, buffer=False): # calibre-debug -t test_name which_tests = None if test_name.startswith('@'): - which_tests = test_name[1:], + which_tests = test_name[1:], None tests = find_tests(which_tests) if test_name != 'all': if test_name.startswith('.'):