diff --git a/recipes/bloomberg-business-week.recipe b/recipes/bloomberg-business-week.recipe index 2d68d60dcd..e13167ca14 100644 --- a/recipes/bloomberg-business-week.recipe +++ b/recipes/bloomberg-business-week.recipe @@ -125,7 +125,7 @@ class Bloomberg(BasicNewsRecipe): if 'abstract' in data and data['abstract'] and data['abstract'] is not None: subhead = '
' - elif 'summary' in data and data['summary']: + elif data.get('summary'): subhead = '

' + data['summary'] + '

' if 'byline' in data and data['byline'] is not None: diff --git a/recipes/bloomberg.recipe b/recipes/bloomberg.recipe index 8b2cb982ae..02f1a9ceb0 100644 --- a/recipes/bloomberg.recipe +++ b/recipes/bloomberg.recipe @@ -135,7 +135,7 @@ class Bloomberg(BasicNewsRecipe): if 'abstract' in data and data['abstract'] and data['abstract'] is not None: subhead = '
' - elif 'summary' in data and data['summary']: + elif data.get('summary'): subhead = '

' + data['summary'] + '

' if 'byline' in data and data['byline'] is not None: diff --git a/recipes/tls_mag.recipe b/recipes/tls_mag.recipe index 6bb1ef8765..8aa0b13e0a 100644 --- a/recipes/tls_mag.recipe +++ b/recipes/tls_mag.recipe @@ -120,7 +120,7 @@ class TLS(BasicNewsRecipe): if prim['byline']['text']: auth = '

'.format(prim['byline']['link']) + prim['byline']['text'] + '

\n' - if 'bookdetails' in prim and prim['bookdetails']: + if prim.get('bookdetails'): bks += '
' for a in prim['bookdetails']: for x, y in a.items(): @@ -135,7 +135,7 @@ class TLS(BasicNewsRecipe): if 'article_data_leadimage' in data: i = data['article_data_leadimage'] - if 'full_image' in i and i['full_image']: + if i.get('full_image'): lede = '
{}
'.format( i['full_image'] + '?w600', i['imagecaption'] + ' ' \ + i['imagecredit'] + '' diff --git a/ruff-strict-pep8.toml b/ruff-strict-pep8.toml index 90527ef705..4d78f5048e 100644 --- a/ruff-strict-pep8.toml +++ b/ruff-strict-pep8.toml @@ -20,7 +20,7 @@ quote-style = 'single' ignore = [ 'E402', 'E722', 'E741', 'UP012', 'UP030', 'UP032', 'UP038', 'C413', 'C420', - 'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF010', 'RUF012', 'RUF013', 'RUF015', 'RUF019', 'RUF021', 'RUF031', 'RUF034', 'RUF100', + 'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF010', 'RUF012', 'RUF013', 'RUF015', 'RUF021', 'RUF031', 'RUF034', 'RUF100', ] select = [ 'E', 'F', 'I', 'W', 'INT', diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index 87a3cc7ba3..cb1b405b2e 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -2734,7 +2734,7 @@ class CatalogBuilder: # Thumb _soup = BeautifulSoup('', selfClosingTags=['img']) thumb = _soup.new_tag('img') - if 'cover' in book and book['cover']: + if book.get('cover'): thumb['src'] = '../images/thumbnail_%d.jpg' % int(book['id']) else: thumb['src'] = '../images/thumbnail_default.jpg'