diff --git a/Changelog.txt b/Changelog.txt index ba2bd2818a..a891eff46b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -496,7 +496,7 @@ :: improved recipes - Jot Down -- Various Russian and Ukranian news sources +- Various Russian and Ukrainian news sources - Nautilus Magazine - Süddeutsche Zeitung - The India Forum @@ -974,7 +974,7 @@ - Fix a regression in 7.0 caused by a regression in Qt that would result in calibre hanging rarely when using the cover browser view -- [2049992] Fix custom template functions not useable in save to disk templates +- [2049992] Fix custom template functions not usable in save to disk templates - Fix a regression in 7.2 that caused the popup used for editing fields in the book list to be mis-positioned on very wide monitors diff --git a/format_docs/compression/zip.txt b/format_docs/compression/zip.txt index 1565e775ba..a08202f1e0 100644 --- a/format_docs/compression/zip.txt +++ b/format_docs/compression/zip.txt @@ -402,7 +402,7 @@ V. General Format of a .ZIP file 13 - Acorn Risc 14 - VFAT 15 - alternate MVS 16 - BeOS 17 - Tandem 18 - OS/400 - 19 - OS/X (Darwin) 20 thru 255 - unused + 19 - OS/X (Darwin) 20 through 255 - unused The lower byte indicates the ZIP specification version (the version of this document) supported by the software @@ -719,7 +719,7 @@ V. General Format of a .ZIP file The Header ID field indicates the type of data that is in the following data block. - Header ID's of 0 thru 31 are reserved for use by PKWARE. + Header ID's of 0 through 31 are reserved for use by PKWARE. The remaining ID's can be used by third party vendors for proprietary usage. @@ -1769,7 +1769,7 @@ Example: 0x02, 0x42, 0x01, 0x13 This would generate the original bit length array of: (3, 3, 3, 3, 3, 2, 4, 4) - There are 8 codes in this table for the values 0 thru 7. Using + There are 8 codes in this table for the values 0 through 7. Using the algorithm to obtain the Shannon-Fano codes produces: Reversed Order Original @@ -1909,8 +1909,8 @@ The bit lengths for the literal tables are sent first with the number of entries sent described by the 5 bits sent earlier. There are up to 286 literal characters; the first 256 represent the respective 8 bit character, code 256 represents the End-Of-Block code, the remaining -29 codes represent copy lengths of 3 thru 258. There are up to 30 -distance codes representing distances from 1 thru 32k as described +29 codes represent copy lengths of 3 through 258. There are up to 30 +distance codes representing distances from 1 through 32k as described below. Length Codes @@ -2221,7 +2221,7 @@ keys, based on random data, to render a plaintext attack on the data ineffective. Read the 12-byte encryption header into Buffer, in locations -Buffer(0) thru Buffer(11). +Buffer(0) through Buffer(11). loop for i <- 0 to 11 C <- buffer(i) ^ decrypt_byte() diff --git a/pyproject.toml b/pyproject.toml index 0da1b81111..089ad4d098 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,93 @@ docstring-quotes = 'single' inline-quotes = 'single' multiline-quotes = 'single' +[tool.codespell] +# calibre will probably never fully compliant with codespell +# this setting is only to easily find common typo errors +# by filtring a great range of false-positives, but not all +# (if codespell could per-file-ignores words, its be nicer) +count = false +summary = false +quiet-level = 3 +regex = '''\b(? str: hashalg, digest = resource_hash.split(':', 1) prefix = digest[:2] - # Cant use colons in filenames on windows safely + # Can't use colons in filenames on windows safely return os.path.join(self.resources_dir, prefix, f'{hashalg}-{digest}') def remove_resources(self, conn, note_id, resources_to_potentially_remove, delete_from_link_table=True): diff --git a/src/calibre/devices/mtp/unix/upstream/music-players.h b/src/calibre/devices/mtp/unix/upstream/music-players.h index 1fe1a1fe58..dbe8adcf21 100644 --- a/src/calibre/devices/mtp/unix/upstream/music-players.h +++ b/src/calibre/devices/mtp/unix/upstream/music-players.h @@ -299,7 +299,7 @@ DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // YP-F3 is NOT MTP - USB mass storage - // From a rouge .INF file + // From a rogue .INF file // this device ID seems to have been recycled for: // the Samsung SGH-A707 Cingular cellphone // the Samsung L760-V cellphone @@ -1183,7 +1183,7 @@ DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // From: Willy Gardiol (web) // Spurious errors for getting all objects, lead me to believe - // this flag atleast is needed + // this flag at least is needed { "Nokia", 0x0421, "5800 XpressMusic v2", 0x0155, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Yet another version... I think diff --git a/src/calibre/ebooks/mobi/debug/index.py b/src/calibre/ebooks/mobi/debug/index.py index c122db4293..2ef2d8d416 100644 --- a/src/calibre/ebooks/mobi/debug/index.py +++ b/src/calibre/ebooks/mobi/debug/index.py @@ -51,7 +51,7 @@ def read_variable_len_data(data, header): header['tagx_block_size'] = 0 trailing_bytes = data[idxt_offset+idxt_size:] if trailing_bytes.rstrip(b'\0'): - raise ValueError('Traling bytes after last IDXT entry: {!r}'.format(trailing_bytes.rstrip(b'\0'))) + raise ValueError('Trailing bytes after last IDXT entry: {!r}'.format(trailing_bytes.rstrip(b'\0'))) header['indices'] = indices diff --git a/src/calibre/ebooks/oeb/polish/tests/kepubify.py b/src/calibre/ebooks/oeb/polish/tests/kepubify.py index e3c0bd1b1e..bca3e32d78 100644 --- a/src/calibre/ebooks/oeb/polish/tests/kepubify.py +++ b/src/calibre/ebooks/oeb/polish/tests/kepubify.py @@ -101,7 +101,7 @@ div#book-inner {{ margin-top: 0; margin-bottom: 0; }}': # escaping with cdata note that kepubify doesnt do this + '
': # escaping with cdata note that kepubify doesn't do this '
', # CSS filtering diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index 34b44afa25..96d267080d 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -732,21 +732,21 @@ class Region: class Page: def __init__(self, page, font_map, opts, log, idc): - def text_cmp(frst, secnd): + def text_cmp(first, second): # Compare 2 text objects. # Order by line (top/bottom) then left - if (frst.top <= secnd.top and frst.bottom >= secnd.bottom-BOTTOM_FACTOR) \ - or (secnd.top <= frst.top and secnd.bottom >= frst.bottom-BOTTOM_FACTOR): + if (first.top <= second.top and first.bottom >= second.bottom-BOTTOM_FACTOR) \ + or (second.top <= first.top and second.bottom >= first.bottom-BOTTOM_FACTOR): # Overlap = same line - if frst.left < secnd.left: + if first.left < second.left: return -1 - elif frst.left == secnd.left: + elif first.left == second.left: return 0 return 1 # Different line so sort into line number - if frst.bottom < secnd.bottom: + if first.bottom < second.bottom: return -1 - elif frst.bottom == secnd.bottom: + elif first.bottom == second.bottom: return 0 return 1 diff --git a/src/calibre/ebooks/rtf2xml/list_numbers.py b/src/calibre/ebooks/rtf2xml/list_numbers.py index 736e0155b8..0951868cfc 100644 --- a/src/calibre/ebooks/rtf2xml/list_numbers.py +++ b/src/calibre/ebooks/rtf2xml/list_numbers.py @@ -121,7 +121,7 @@ class ListNumbers: return 'ordered' # sys.stderr.write('module is list_numbers\n') # sys.stderr.write('method is __determine type\n') - # sys.stderr.write('Couldn\'t get type of list\n') + # sys.stderr.write("Couldn't get type of list\n") # must be some type of ordered list -- just a guess! return 'unordered' diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index e0aa43c22b..eda1cc0818 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1776,7 +1776,7 @@ def raise_and_focus(self: QWidget) -> None: def raise_without_focus(self: QWidget) -> None: if QApplication.instance().platformName() == 'wayland': - # On fucking Wayland, we cant raise a dialog without also giving it + # On fucking Wayland, we can't raise a dialog without also giving it # keyboard focus. What a joke. self.raise_and_focus() else: diff --git a/src/calibre/gui2/auto_add.py b/src/calibre/gui2/auto_add.py index d1cae5e22c..5bf5b7b8af 100644 --- a/src/calibre/gui2/auto_add.py +++ b/src/calibre/gui2/auto_add.py @@ -288,10 +288,10 @@ class AutoAdder(QObject): if duplicates: paths, formats, metadata = [], [], [] - for p, f, mis in duplicates: + for p, f, mi in duplicates: paths.extend(p) formats.extend(f) - metadata.extend(mis) + metadata.extend(mi) dups = [(mic, mic.cover, [p]) for mic, p in zip(metadata, paths)] d = DuplicatesQuestion(m.db, dups, parent=gui) dups = tuple(d.duplicates) diff --git a/src/calibre/gui2/central.py b/src/calibre/gui2/central.py index 54817cb14a..4af23199cf 100644 --- a/src/calibre/gui2/central.py +++ b/src/calibre/gui2/central.py @@ -485,7 +485,7 @@ class CentralContainer(QWidget): def read_settings(self): before = self.serialized_settings() - # sadly self.size() doesnt always return sensible values so look at + # sadly self.size() doesn't always return sensible values so look at # the size of the main window which works perfectly for width, not so # perfectly for height sz = self.size() diff --git a/src/calibre/gui2/dialogs/edit_category_notes.py b/src/calibre/gui2/dialogs/edit_category_notes.py index 697d2b62f1..ae6948d05a 100644 --- a/src/calibre/gui2/dialogs/edit_category_notes.py +++ b/src/calibre/gui2/dialogs/edit_category_notes.py @@ -287,7 +287,7 @@ class NoteEditorWidget(EditorWidget): def do_insert_image(self): # See https://bugreports.qt.io/browse/QTBUG-118537 - # for why we cant have a nice margin for floating images + # for why we can't have a nice margin for floating images d = AskImage(self.images, self.db) if d.exec() == QDialog.DialogCode.Accepted and d.current_digest: ir = self.images[d.current_digest] diff --git a/src/calibre/gui2/email.py b/src/calibre/gui2/email.py index 30f6650552..225656b99d 100644 --- a/src/calibre/gui2/email.py +++ b/src/calibre/gui2/email.py @@ -153,14 +153,14 @@ def send_mails(jobnames, callback, attachments, to_s, subjects, attachments, to_s, subjects, texts, attachment_names): description = _('Email %(name)s to %(to)s') % dict(name=name, to=to) if isinstance(to, str) and (is_for_kindle(to) or '@pbsync.com' in to): - # The PocketBook service is a total joke. It cant handle + # The PocketBook service is a total joke. It can't handle # non-ascii, filenames that are long enough to be split up, commas, and # the good lord alone knows what else. So use a random filename # containing only 22 English letters and numbers # # And since this email is only going to be processed by automated # services, make the subject+text random too as at least the amazon - # service cant handle non-ascii text. I dont know what baboons + # service can't handle non-ascii text. I dont know what baboons # these companies employ to write their code. It's the height of # irony that they are called "tech" companies. # https://bugs.launchpad.net/calibre/+bug/1989282 diff --git a/src/calibre/gui2/fts/dialog.py b/src/calibre/gui2/fts/dialog.py index 357a04c855..18905ba0c1 100644 --- a/src/calibre/gui2/fts/dialog.py +++ b/src/calibre/gui2/fts/dialog.py @@ -36,7 +36,7 @@ class FTSDialog(Dialog): l = QVBoxLayout(self) self.fat_warning = fw = QLabel( f'{_("WARNING")}: ' + - _('The calibre library is on a FAT drive, indexing more than a few hundred books wont work.') + + _("The calibre library is on a FAT drive, indexing more than a few hundred books won't work.") + f' {_("Learn more")}') # fw.setVisible(False) fw.linkActivated.connect(self.show_fat_details) diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index 9a44c2f7ff..dae64169b7 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -359,7 +359,7 @@ class VLTabs(QTabBar): # {{{ def lock_tab(self): gprefs['vl_tabs_closable'] = False self.setTabsClosable(False) - # Workaround for Qt bug where it doesnt recalculate the tab size after locking + # Workaround for Qt bug where it doesn't recalculate the tab size after locking for idx in range(self.count()): self.setTabButton(idx, QTabBar.ButtonPosition.RightSide, None) self.setTabButton(idx, QTabBar.ButtonPosition.LeftSide, None) diff --git a/src/calibre/gui2/markdown_syntax_highlighter.py b/src/calibre/gui2/markdown_syntax_highlighter.py index f26c0f23aa..353a36eb1d 100644 --- a/src/calibre/gui2/markdown_syntax_highlighter.py +++ b/src/calibre/gui2/markdown_syntax_highlighter.py @@ -268,7 +268,7 @@ class MarkdownHighlighter(QSyntaxHighlighter): elif emphasis: self.setFormat(self.offset+offset+ match.start(), match.end() - match.start(), self.MARKDOWN_KWS_FORMAT['Italic']) - def recusive(match, extra_offset, bold, emphasis): + def recursive(match, extra_offset, bold, emphasis): apply(match, bold, emphasis) if bold and emphasis: return # max deep => return, do not process extra Bold/Italic @@ -278,17 +278,17 @@ class MarkdownHighlighter(QSyntaxHighlighter): self._highlightBoldEmphasis(sub_txt, cursor, bf, sub_offset, bold, emphasis) for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['Italic'],text): - recusive(mo, 1, bold, True) + recursive(mo, 1, bold, True) found = True for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['uItalic'],text): - recusive(mo, 1, bold, True) + recursive(mo, 1, bold, True) found = True for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['Bold'],text): - recusive(mo, 2, True, emphasis) + recursive(mo, 2, True, emphasis) found = True for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['uBold'],text): - recusive(mo, 2, True, emphasis) + recursive(mo, 2, True, emphasis) found = True for mo in re.finditer(self.MARKDOWN_KEYS_REGEX['BoldItalic'],text): diff --git a/src/calibre/gui2/tweak_book/editor/syntax/javascript.py b/src/calibre/gui2/tweak_book/editor/syntax/javascript.py index 3cc1605e80..2b0de9a9e8 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/javascript.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/javascript.py @@ -25,7 +25,7 @@ JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*' class JavascriptLexer(RegexLexer): ''' For JavaScript source code. This is based on the pygments JS highlighter, - bu that does not handle multi-line comments in streaming mode, so we had to + but that does not handle multi-line comments in streaming mode, so we had to modify it. ''' diff --git a/src/calibre/srv/http_request.py b/src/calibre/srv/http_request.py index 384a0613f1..ba5d3b33cf 100644 --- a/src/calibre/srv/http_request.py +++ b/src/calibre/srv/http_request.py @@ -83,7 +83,7 @@ def parse_uri(uri, parse_query=True, unquote_func=unquote): try: query = MultiDict.create_from_query_string(qs) except Exception: - raise HTTPSimpleResponse(http_client.BAD_REQUEST, 'Unparseable query string') + raise HTTPSimpleResponse(http_client.BAD_REQUEST, 'Unparsable query string') else: query = None diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py index fc31f35fbe..6dfeb7819c 100644 --- a/src/calibre/utils/formatter.py +++ b/src/calibre/utils/formatter.py @@ -192,7 +192,7 @@ class SetGlobalsNode(Node): class StringCompareNode(Node): def __init__(self, line_number, operator, left, right): - Node.__init__(self, line_number, 'comparision: ' + operator) + Node.__init__(self, line_number, 'comparison: ' + operator) self.node_type = self.NODE_COMPARE_STRING self.operator = operator self.left = left diff --git a/src/calibre/utils/smtplib.py b/src/calibre/utils/smtplib.py index 1964ab6a87..61be1e905d 100644 --- a/src/calibre/utils/smtplib.py +++ b/src/calibre/utils/smtplib.py @@ -743,7 +743,7 @@ class SMTP: >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"] >>> msg = '''\\ ... From: Me@my.org - ... Subject: testin'... + ... Subject: testing... ... ... This is a test ''' >>> s.sendmail("me@my.org",tolist,msg) diff --git a/src/pyj/read_book/paged_mode.pyj b/src/pyj/read_book/paged_mode.pyj index 0cf8f0de1b..c4ca24855a 100644 --- a/src/pyj/read_book/paged_mode.pyj +++ b/src/pyj/read_book/paged_mode.pyj @@ -446,7 +446,7 @@ def next_screen_location(): current_pos = Math.ceil(current_scroll_offset()) ans = limit if current_pos < limit else -1 if cols_per_screen is 1 and ans is not -1 and ans - current_pos < col_size: - ans = -1 # cant scroll partial columns + ans = -1 # can't scroll partial columns return ans diff --git a/src/pyj/read_book/ui.pyj b/src/pyj/read_book/ui.pyj index 82f80b390c..1db4f1eddb 100644 --- a/src/pyj/read_book/ui.pyj +++ b/src/pyj/read_book/ui.pyj @@ -145,7 +145,7 @@ class ReadUI: try: result = JSON.parse(xhr.responseText) except Exception: - return self.show_error(_('Failed to parse profiles'), _('Unparseable data received for profiles')) + return self.show_error(_('Failed to parse profiles'), _('Unparsable data received for profiles')) proceed(result) ).send() diff --git a/src/pyj/select.pyj b/src/pyj/select.pyj index 7ed3d9275a..ef0aa7c8eb 100644 --- a/src/pyj/select.pyj +++ b/src/pyj/select.pyj @@ -134,7 +134,7 @@ def range_extents(q, in_flow_mode): rect = boundary_node.getBoundingClientRect() if not is_start: ans.selected_prev = True - # we cant use getBoundingClientRect as the node might be split + # we can't use getBoundingClientRect as the node might be split # among multiple columns else if node.getClientRects: rects = node.getClientRects()