Remove more exclusions

This commit is contained in:
Kovid Goyal 2025-01-27 10:26:01 +05:30
parent 68f8d4925e
commit ddd580c85c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 87 additions and 55 deletions

View File

@ -49,10 +49,7 @@ unfixable = ['PIE794', 'ISC001']
"recipes/*" = ['UP']
"manual/plugin_examples/*" = ['UP']
"setup/changelog.py" = ['ISC001']
"setup/commands.py" = ['RUF022']
"src/calibre/*" = ['UP031']
"src/calibre/customize/__init__.py" = ['RET501']
"src/calibre/devices/interface.py" = ['RET501']
"src/calibre/devices/kobo/driver.py" = ['E116']
"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501']
"src/calibre/ebooks/metadata/sources/*" = ['UP']
@ -61,8 +58,6 @@ unfixable = ['PIE794', 'ISC001']
"src/calibre/gui2/store/stores/*" = ['UP']
"src/calibre/gui2/tts/manager.py" = ['UP037']
"src/calibre/utils/copy_files.py" = ['UP037']
"src/calibre/utils/smartypants.py" = ['RUF055']
"src/calibre/web/feeds/news.py" = ['RET501']
"src/qt/*.py" = ['I', 'E302']
"src/qt/*.pyi" = ['I']

View File

@ -11,7 +11,7 @@ import json
import os
import subprocess
from setup import Command, build_cache_dir, dump_json, edit_file, require_clean_git, require_git_master
from setup import Command, build_cache_dir, dump_json, edit_file
class Message:

View File

@ -6,21 +6,58 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
__all__ = [
'pot', 'translations', 'get_translations', 'iso_data', 'iso639', 'iso3166',
'build', 'mathjax', 'man_pages',
'gui',
'bootstrap',
'build',
'build_dep',
'cacerts',
'check',
'develop',
'export_packages',
'extdev',
'get_translations',
'git_version',
'develop', 'install',
'rapydscript', 'cacerts', 'recent_uas', 'resources',
'check', 'test', 'test_rs', 'upgrade_source_code',
'sdist', 'bootstrap', 'extdev',
'manual', 'tag_release',
'upload_to_server',
'gui',
'hyphenation',
'install',
'iso639',
'iso3166',
'iso_data',
'liberation_fonts',
'linux',
'linux64',
'linuxarm64',
'man_pages',
'manual',
'mathjax',
'osx',
'piper_voices',
'pot',
'publish',
'publish_betas',
'publish_preview',
'rapydscript',
'recent_uas',
'resources',
'reupload',
'sdist',
'stage1',
'stage2',
'stage3',
'stage4',
'stage5',
'stylelint',
'tag_release',
'test',
'test_rs',
'translations',
'upgrade_source_code',
'upload_demo',
'upload_installers',
'upload_user_manual', 'upload_demo', 'reupload',
'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas', 'publish_preview',
'linux', 'linux64', 'linuxarm64', 'win', 'win64', 'osx', 'build_dep',
'export_packages', 'hyphenation', 'piper_voices', 'liberation_fonts', 'stylelint', 'xwin',
'upload_to_server',
'upload_user_manual',
'win',
'win64',
'xwin',
]
from setup.installers import OSX, BuildDep, ExportPackages, ExtDev, Linux, Linux64, LinuxArm64, Win, Win64

View File

@ -474,7 +474,7 @@ class MetadataReaderPlugin(Plugin): # {{{
in :attr:`file_types`.
:return: A :class:`calibre.ebooks.metadata.book.Metadata` object
'''
return None
return
# }}}

View File

@ -138,7 +138,7 @@ class DevicePlugin(Plugin):
@classmethod
def get_open_popup_message(self):
' GUI displays this as a non-modal popup. Should be an instance of OpenPopupMessage '
return None
return
# Device detection {{{
def test_bcd(self, bcdDevice, bcd):
@ -631,7 +631,7 @@ class DevicePlugin(Plugin):
This method can be called on the GUI thread. A driver that implements
this method must be thread safe.
'''
return None
return
def start_plugin(self):
'''

View File

@ -493,7 +493,7 @@ def smartyPants(text, attr='1'):
if not in_pre:
t = processEscapes(t)
t = re.sub(r'&quot;', '"', t)
t = t.replace('&quot;', '"')
t = dashes_func(t)
t = ellipses_func(t)
# Note: backticks need to be processed before quotes.
@ -548,10 +548,10 @@ def educateQuotes(text):
text = re.sub(r''''"(?=\w)''', '''&#8216;&#8220;''', text)
text = re.sub(r'''""(?=\w)''', '''&#8220;&#8220;''', text)
text = re.sub(r'''''(?=\w)''', '''&#8216;&#8216;''', text)
text = re.sub(r'''\"\'''', '''&#8221;&#8217;''', text)
text = re.sub(r'''\'\"''', '''&#8217;&#8221;''', text)
text = re.sub(r'''""''', '''&#8221;&#8221;''', text)
text = re.sub(r"""''""", '''&#8217;&#8217;''', text)
text = text.replace('"\'', '&#8221;&#8217;')
text = text.replace('\'"', '''&#8217;&#8221;''')
text = text.replace('""', '&#8221;&#8221;')
text = text.replace(r"""''""", '''&#8217;&#8217;''')
# Special case for decade abbreviations (the '80s --> 80s):
# See http://practicaltypography.com/apostrophes.html
@ -612,7 +612,7 @@ def educateQuotes(text):
text = closing_single_quotes_regex.sub(r'''\1&#8217;\2''', text)
# Any remaining single quotes should be opening ones:
text = re.sub(r"""'""", r'''&#8216;''', text)
text = text.replace("'", '&#8216;')
# Get most opening double quotes:
opening_double_quotes_regex = re.compile(r'''
@ -648,7 +648,7 @@ def educateQuotes(text):
text = text[:-1] + '&#8221;'
# Any remaining quotes should be opening ones.
text = re.sub(r'"', r'''&#8220;''', text)
text = text.replace('"', '&#8220;')
return text
@ -662,8 +662,8 @@ def educateBackticks(text):
Example output: &#8220;Isn't this fun?&#8221;
'''
text = re.sub(r'''``''', r'''&#8220;''', text)
text = re.sub(r"""''""", r'''&#8221;''', text)
text = text.replace('``', '&#8220;')
text = text.replace("''", '&#8221;')
return text
@ -677,8 +677,8 @@ def educateSingleBackticks(text):
Example output: &#8216;Isn&#8217;t this fun?&#8217;
'''
text = re.sub(r'''`''', r'''&#8216;''', text)
text = re.sub(r"""'""", r'''&#8217;''', text)
text = text.replace('`', '&#8216;')
text = text.replace("'", '&#8217;')
return text
@ -690,8 +690,8 @@ def educateDashes(text):
an em-dash HTML entity.
'''
text = re.sub(r'''---''', r'''&#8211;''', text) # en (yes, backwards)
text = re.sub(r'''--''', r'''&#8212;''', text) # em (yes, backwards)
text = text.replace('---', '&#8211;') # en (yes, backwards)
text = text.replace('--', '&#8212;') # em (yes, backwards)
return text
@ -704,8 +704,8 @@ def educateDashesOldSchool(text):
an em-dash HTML entity.
'''
text = re.sub(r'''---''', r'''&#8212;''', text) # em (yes, backwards)
text = re.sub(r'''--''', r'''&#8211;''', text) # en (yes, backwards)
text = text.replace('---', '&#8212;') # em (yes, backwards)
text = text.replace('--', '&#8211;') # en (yes, backwards)
return text
@ -724,8 +724,8 @@ def educateDashesOldSchoolInverted(text):
the shortcut should be shorter to type. (Thanks to Aaron
Swartz for the idea.)
'''
text = re.sub(r'''---''', r'''&#8211;''', text) # em
text = re.sub(r'''--''', r'''&#8212;''', text) # en
text = text.replace('---', '&#8211;') # em
text = text.replace('--', '&#8212;') # en
return text
@ -739,8 +739,8 @@ def educateEllipses(text):
Example output: Huh&#8230;?
'''
text = re.sub(r'''\.\.\.''', r'''&#8230;''', text)
text = re.sub(r'''\. \. \.''', r'''&#8230;''', text)
text = text.replace('...', '&#8230;')
text = text.replace('. . .', '&#8230;')
return text
@ -754,16 +754,16 @@ def stupefyEntities(text):
Example output: "Hello -- world."
'''
text = re.sub(r'''&#8211;''', r'''-''', text) # en-dash
text = re.sub(r'''&#8212;''', r'''--''', text) # em-dash
text = text.replace('&#8211;', '-') # en-dash
text = text.replace('&#8212;', '--') # em-dash
text = re.sub(r'''&#8216;''', r"""'""", text) # open single quote
text = re.sub(r'''&#8217;''', r"""'""", text) # close single quote
text = text.replace('&#8216;', "'") # open single quote
text = text.replace('&#8217;', "'") # close single quote
text = re.sub(r'''&#8220;''', r'''"''', text) # open double quote
text = re.sub(r'''&#8221;''', r'''"''', text) # close double quote
text = text.replace('&#8220;', '"') # open double quote
text = text.replace('&#8221;', '"') # close double quote
text = re.sub(r'''&#8230;''', r'''...''', text) # ellipsis
text = text.replace('&#8230;', '...') # ellipsis
return text
@ -784,12 +784,12 @@ def processEscapes(text):
\- &#45;
\` &#96;
'''
text = re.sub(r'''\\\\''', r'''&#92;''', text)
text = re.sub(r'''\\"''', r'''&#34;''', text)
text = re.sub(r"""\\'""", r'''&#39;''', text)
text = re.sub(r'''\\\.''', r'''&#46;''', text)
text = re.sub(r'''\\-''', r'''&#45;''', text)
text = re.sub(r'''\\`''', r'''&#96;''', text)
text = text.replace(r'\\', '&#92;')
text = text.replace(r'\"', '&#34;')
text = text.replace(r"\'", '&#39;')
text = text.replace(r'\.', '&#46;')
text = text.replace(r'\-', '&#45;')
text = text.replace(r'\`', '&#96;')
return text

View File

@ -645,7 +645,7 @@ class BasicNewsRecipe(Recipe):
`soup`: A `BeautifulSoup <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`__
instance containing the downloaded :term:`HTML`.
'''
return None
return
def abort_article(self, msg=None):
''' Call this method inside any of the preprocess methods to abort the