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

View File

@ -11,7 +11,7 @@ import json
import os import os
import subprocess 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: class Message:

View File

@ -6,21 +6,58 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
__all__ = [ __all__ = [
'pot', 'translations', 'get_translations', 'iso_data', 'iso639', 'iso3166', 'bootstrap',
'build', 'mathjax', 'man_pages', 'build',
'gui', 'build_dep',
'cacerts',
'check',
'develop',
'export_packages',
'extdev',
'get_translations',
'git_version', 'git_version',
'develop', 'install', 'gui',
'rapydscript', 'cacerts', 'recent_uas', 'resources', 'hyphenation',
'check', 'test', 'test_rs', 'upgrade_source_code', 'install',
'sdist', 'bootstrap', 'extdev', 'iso639',
'manual', 'tag_release', 'iso3166',
'upload_to_server', '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_installers',
'upload_user_manual', 'upload_demo', 'reupload', 'upload_to_server',
'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas', 'publish_preview', 'upload_user_manual',
'linux', 'linux64', 'linuxarm64', 'win', 'win64', 'osx', 'build_dep', 'win',
'export_packages', 'hyphenation', 'piper_voices', 'liberation_fonts', 'stylelint', 'xwin', 'win64',
'xwin',
] ]
from setup.installers import OSX, BuildDep, ExportPackages, ExtDev, Linux, Linux64, LinuxArm64, Win, Win64 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`. in :attr:`file_types`.
:return: A :class:`calibre.ebooks.metadata.book.Metadata` object :return: A :class:`calibre.ebooks.metadata.book.Metadata` object
''' '''
return None return
# }}} # }}}

View File

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

View File

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

View File

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