diff --git a/manual/conf.py b/manual/conf.py index ad61dcbde0..3702a507c1 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -47,11 +47,11 @@ templates_path = ['templates'] source_suffix = {'.rst': 'restructuredtext'} # The master toctree document. -master_doc = 'index' if tags.has('online') else 'simple_index' +master_doc = 'index' if tags.has('online') else 'simple_index' # noqa: F821 # kill the warning about index/simple_index not being in a toctree exclude_patterns = ['simple_index.rst'] if master_doc == 'index' else ['index.rst'] exclude_patterns.append('cli-options-header.rst') -if tags.has('gettext'): +if tags.has('gettext'): # noqa: F821 # Do not exclude anything as the strings must be translated. This will # generate a warning about the documents not being in a toctree, just ignore # it. diff --git a/manual/plugin_examples/editor_demo/main.py b/manual/plugin_examples/editor_demo/main.py index 3cb48e147a..3da2fb442d 100644 --- a/manual/plugin_examples/editor_demo/main.py +++ b/manual/plugin_examples/editor_demo/main.py @@ -32,7 +32,7 @@ class DemoTool(Tool): def create_action(self, for_toolbar=True): # Create an action, this will be added to the plugins toolbar and # the plugins menu - ac = QAction(get_icons('images/icon.png'), 'Magnify fonts', self.gui) + ac = QAction(get_icons('images/icon.png'), 'Magnify fonts', self.gui) # noqa: F821 if not for_toolbar: # Register a keyboard shortcut for this toolbar action. We only # register it for the action created for the menu, not the toolbar, diff --git a/recipes/daum_net.recipe b/recipes/daum_net.recipe index 7c72996b56..f840c15254 100644 --- a/recipes/daum_net.recipe +++ b/recipes/daum_net.recipe @@ -61,7 +61,7 @@ class MediaDaumRecipe(BasicNewsRecipe): lambda match: ''), (re.compile(r'(]*>[ \t\r\n]*)*', re.DOTALL | re.IGNORECASE), lambda match: ''), - (re.compile(u'(]*>[ \t\r\n]*)*(\u25B6|\u25CF|\u261E|\u24D2|\(c\))*\[[^\]]*(\u24D2|\(c\)|\uAE30\uC0AC|\uC778\uAE30[^\]]*\uB274\uC2A4)[^\]]*\].*', re.DOTALL | re.IGNORECASE), # noqa: E501 + (re.compile(u'(]*>[ \t\r\n]*)*(\u25B6|\u25CF|\u261E|\u24D2|\(c\))*\[[^\]]*(\u24D2|\(c\)|\uAE30\uC0AC|\uC778\uAE30[^\]]*\uB274\uC2A4)[^\]]*\].*', re.DOTALL | re.IGNORECASE), # noqa: E501, W605 lambda match: ''), ] diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 4dd1f033c1..0ab2454b53 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera import datetime import json import re -from pprint import pprint +from pprint import pprint # noqa: F401 from calibre import strftime from calibre.ebooks.BeautifulSoup import Tag diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index d0566257ec..cbed02b28b 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera import datetime import json import re -from pprint import pprint +from pprint import pprint # noqa: F401 from calibre import strftime from calibre.ebooks.BeautifulSoup import Tag diff --git a/src/calibre/db/tests/main.py b/src/calibre/db/tests/main.py index eb5093a175..19c2d80689 100644 --- a/src/calibre/db/tests/main.py +++ b/src/calibre/db/tests/main.py @@ -14,7 +14,7 @@ def find_tests(): if __name__ == '__main__': try: - import init_calibre + import init_calibre # noqa: F401 except ImportError: pass run_tests(find_tests) diff --git a/src/calibre/ebooks/BeautifulSoup.py b/src/calibre/ebooks/BeautifulSoup.py index 857911185f..0306314cfe 100644 --- a/src/calibre/ebooks/BeautifulSoup.py +++ b/src/calibre/ebooks/BeautifulSoup.py @@ -3,7 +3,7 @@ import bs4 -from bs4 import CData, Comment, Declaration, NavigableString, ProcessingInstruction, SoupStrainer, Tag, __version__ +from bs4 import CData, Comment, Declaration, NavigableString, ProcessingInstruction, SoupStrainer, Tag, __version__ # noqa: F401 def parse_html(markup): diff --git a/src/calibre/ebooks/conversion/plugins/pdf_output.py b/src/calibre/ebooks/conversion/plugins/pdf_output.py index e8e1657e95..a1dcee7f18 100644 --- a/src/calibre/ebooks/conversion/plugins/pdf_output.py +++ b/src/calibre/ebooks/conversion/plugins/pdf_output.py @@ -151,7 +151,7 @@ class PDFOutput(OutputFormatPlugin): # Ensure Qt is setup to be used with WebEngine # specialize_options is called early enough in the pipeline # that hopefully no Qt application has been constructed as yet - from qt.webengine import QWebEnginePage + from qt.webengine import QWebEnginePage # noqa: I001, F401 from calibre.gui2 import must_use_qt from calibre.utils.webengine import setup_fake_protocol, setup_default_profile setup_fake_protocol() diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index a0b2ad17a3..69dcdcf9ec 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -1073,7 +1073,7 @@ OptionRecommendation(name='search_replace', self.flush() if self.opts.embed_all_fonts or self.opts.embed_font_family: # Start the threaded font scanner now, for performance - from calibre.utils.fonts.scanner import font_scanner + from calibre.utils.fonts.scanner import font_scanner # noqa: F401 import logging import css_parser diff --git a/src/calibre/ebooks/metadata/opf3_test.py b/src/calibre/ebooks/metadata/opf3_test.py index 81651cfca0..ebb265027c 100644 --- a/src/calibre/ebooks/metadata/opf3_test.py +++ b/src/calibre/ebooks/metadata/opf3_test.py @@ -58,7 +58,7 @@ from calibre.ebooks.metadata.opf3 import ( ) # This import is needed to prevent a test from running slowly -from calibre.ebooks.oeb.polish.pretty import pretty_opf, pretty_xml_tree +from calibre.ebooks.oeb.polish.pretty import pretty_opf, pretty_xml_tree # noqa: F401 from calibre.utils.xml_parse import safe_xml_fromstring read_user_categories, set_user_categories, read_link_maps, set_link_maps diff --git a/src/calibre/ebooks/oeb/polish/tests/main.py b/src/calibre/ebooks/oeb/polish/tests/main.py index 67c21f61ec..91540bc232 100644 --- a/src/calibre/ebooks/oeb/polish/tests/main.py +++ b/src/calibre/ebooks/oeb/polish/tests/main.py @@ -13,7 +13,7 @@ def find_tests(): if __name__ == '__main__': try: - import init_calibre + import init_calibre # noqa: F401 except ImportError: pass run_tests(find_tests) diff --git a/src/calibre/ebooks/oeb/transforms/subset.py b/src/calibre/ebooks/oeb/transforms/subset.py index 7985786743..01f1a1bd92 100644 --- a/src/calibre/ebooks/oeb/transforms/subset.py +++ b/src/calibre/ebooks/oeb/transforms/subset.py @@ -302,7 +302,7 @@ class SubsetFonts: def find_chars(self, elem, style): ans = set() - transform = lambda x: x + transform = lambda x: x # noqa: E731 tt = style.get('text-transform') if tt: if tt in ('uppercase', 'capitalize'): diff --git a/src/calibre/ebooks/txt/markdownml.py b/src/calibre/ebooks/txt/markdownml.py index c91326bec7..9b418f6e5e 100644 --- a/src/calibre/ebooks/txt/markdownml.py +++ b/src/calibre/ebooks/txt/markdownml.py @@ -86,7 +86,7 @@ class MarkdownMLizer(OEB2HTML): # Condense redundant spaces created by replacing newlines with spaces. text = re.sub(r'[ ]{2,}', ' ', text) text = re.sub(r'\t+', '', text) - if self.remove_space_after_newline == True: + if self.remove_space_after_newline == True: # noqa: E712 text = re.sub(r'^ +', '', text) self.remove_space_after_newline = False return text @@ -148,13 +148,13 @@ class MarkdownMLizer(OEB2HTML): if style['font-style'] == 'italic' or tag in ('i', 'em'): if tag not in ('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'cite'): - if self.style_italic == False: + if self.style_italic == False: # noqa: E712 text.append('*') tags.append('*') self.style_italic = True if style['font-weight'] in ('bold', 'bolder') or tag in ('b', 'strong'): if tag not in ('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'th'): - if self.style_bold == False: + if self.style_bold == False: # noqa: E712 text.append('**') tags.append('**') self.style_bold = True diff --git a/src/calibre/ebooks/txt/textileml.py b/src/calibre/ebooks/txt/textileml.py index d1dc782e40..09b7ecfaf3 100644 --- a/src/calibre/ebooks/txt/textileml.py +++ b/src/calibre/ebooks/txt/textileml.py @@ -138,7 +138,7 @@ class TextileMLizer(OEB2HTML): # Condense redundant spaces created by replacing newlines with spaces. text = re.sub(r'[ ]{2,}', ' ', text) text = re.sub(r'\t+', '', text) - if self.remove_space_after_newline == True: + if self.remove_space_after_newline == True: # noqa: E712 text = re.sub(r'^ +', '', text) self.remove_space_after_newline = False return text @@ -268,7 +268,7 @@ class TextileMLizer(OEB2HTML): if style['font-style'] == 'italic' or tag in ('i', 'em'): if tag not in ('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'cite'): - if self.style_italic == False: + if self.style_italic == False: # noqa: E712 if self.in_a_link: text.append('_') tags.append('_') @@ -279,7 +279,7 @@ class TextileMLizer(OEB2HTML): self.style_italic = True if style['font-weight'] in ('bold', 'bolder') or tag in ('b', 'strong'): if tag not in ('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'th'): - if self.style_bold == False: + if self.style_bold == False: # noqa: E712 if self.in_a_link: text.append('*') tags.append('*') @@ -290,13 +290,13 @@ class TextileMLizer(OEB2HTML): self.style_bold = True if style['text-decoration'] == 'underline' or tag in ('u', 'ins'): if tag != 'a': - if self.style_under == False: + if self.style_under == False: # noqa: E712 text.append('[+') tags.append('+]') self.style_embed.append('+') self.style_under = True if style['text-decoration'] == 'line-through' or tag in ('strike', 'del', 's'): - if self.style_strike == False: + if self.style_strike == False: # noqa: E712 text.append('[-') tags.append('-]') self.style_embed.append('-') @@ -423,12 +423,12 @@ class TextileMLizer(OEB2HTML): tags.append('') elif tag == 'span': if style['font-variant'] == 'small-caps': - if self.style_smallcap == False: + if self.style_smallcap == False: # noqa: E712 text.append('&') tags.append('&') self.style_smallcap = True else: - if self.in_a_link == False: + if self.in_a_link == False: # noqa: E712 txt = '%' if self.opts.keep_links: txt += self.check_id_tag(attribs) diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py index b6f1ed736c..c4dd83dd18 100644 --- a/src/calibre/gui2/store/config/chooser/models.py +++ b/src/calibre/gui2/store/config/chooser/models.py @@ -266,14 +266,14 @@ class SearchFilter(SearchQueryParser): accessor = q[locvalue] if query == 'true': if locvalue in ('affiliate', 'drm', 'enabled'): - if accessor(sr) == True: + if accessor(sr) == True: # noqa: E712 matches.add(sr) elif accessor(sr) is not None: matches.add(sr) continue if query == 'false': if locvalue in ('affiliate', 'drm', 'enabled'): - if accessor(sr) == False: + if accessor(sr) == False: # noqa: E712 matches.add(sr) elif accessor(sr) is None: matches.add(sr) diff --git a/src/calibre/gui2/tweak_book/editor/syntax/xml.py b/src/calibre/gui2/tweak_book/editor/syntax/xml.py index 98b0954cc3..dd5a6fa598 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/xml.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/xml.py @@ -4,4 +4,4 @@ __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal ' -from calibre.gui2.tweak_book.editor.syntax.html import XMLHighlighter as Highlighter +from calibre.gui2.tweak_book.editor.syntax.html import XMLHighlighter as Highlighter # noqa: F401 diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index 1c64a7554e..d7b50e9a57 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -650,7 +650,7 @@ def launch_editor(path_to_edit, path_is_raw=False, syntax='html', callback=None) opts = option_parser().parse_args([]) app = Application([]) # Create the actions that are placed into the editors toolbars - main = Main(opts) + main = Main(opts) # noqa: F841 if path_is_raw: raw = path_to_edit else: diff --git a/src/calibre/srv/tests/main.py b/src/calibre/srv/tests/main.py index 829ba97cd0..e6f8ae5ec2 100644 --- a/src/calibre/srv/tests/main.py +++ b/src/calibre/srv/tests/main.py @@ -13,7 +13,7 @@ def find_tests(): if __name__ == '__main__': try: - import init_calibre + import init_calibre # noqa: F401 except ImportError: pass run_tests(find_tests) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index b7162c0209..082310ca7a 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -106,8 +106,8 @@ class BuildTest(unittest.TestCase): self.assertEqual(data, decompress(cdata)) def test_html5lib(self): - import html5lib.html5parser - from html5lib import parse + import html5lib.html5parser # noqa: F401 + from html5lib import parse # noqa: F401 def test_html5_parser(self): from html5_parser import parse diff --git a/src/calibre/utils/ipython.py b/src/calibre/utils/ipython.py index f66bcbbc4b..5e18af640e 100644 --- a/src/calibre/utils/ipython.py +++ b/src/calibre/utils/ipython.py @@ -172,14 +172,14 @@ def simple_repl(user_ns={}): setup_pyreadline() else: try: - import rlcompleter + import rlcompleter # noqa: I001, F401 import readline readline.parse_and_bind("tab: complete") except ImportError: pass user_ns = user_ns or {} - import sys, re + import sys, re # noqa: I001, E401, F401 for x in ('os', 'sys', 're'): user_ns[x] = user_ns.get(x, globals().get(x, locals().get(x))) user_ns['exit'] = Exit()