add 'code' dictionary to codespell setting

This commit is contained in:
un-pogaz 2025-03-23 16:02:05 +01:00
parent d176b3a7cf
commit b0d58ade70
104 changed files with 168 additions and 136 deletions

View File

@ -55,10 +55,10 @@ def binary_includes():
get_dll_path('bz2', 2), j(PREFIX, 'lib', 'libunrar.so'), get_dll_path('bz2', 2), j(PREFIX, 'lib', 'libunrar.so'),
get_dll_path('python' + py_ver, 2), get_dll_path('jbig', 2), get_dll_path('python' + py_ver, 2), get_dll_path('jbig', 2),
# We dont include libstdc++.so as the OpenGL dlls on the target # We don't include libstdc++.so as the OpenGL dlls on the target
# computer fail to load in the QPA xcb plugin if they were compiled # computer fail to load in the QPA xcb plugin if they were compiled
# with a newer version of gcc than the one on the build computer. # with a newer version of gcc than the one on the build computer.
# libstdc++, like glibc is forward compatible and I dont think any # libstdc++, like glibc is forward compatible and I don't think any
# distros do not have libstdc++.so.6, so it should be safe to leave it out. # distros do not have libstdc++.so.6, so it should be safe to leave it out.
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html (The current # https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html (The current
# debian stable libstdc++ is libstdc++.so.6.0.17) # debian stable libstdc++ is libstdc++.so.6.0.17)

View File

@ -13,10 +13,10 @@ entitlements = {
# MAP_JIT is used by libpcre which is bundled with Qt # MAP_JIT is used by libpcre which is bundled with Qt
'com.apple.security.cs.allow-jit': True, 'com.apple.security.cs.allow-jit': True,
# v8 and therefore WebEngine need this as they dont use MAP_JIT # v8 and therefore WebEngine need this as they don't use MAP_JIT
'com.apple.security.cs.allow-unsigned-executable-memory': True, 'com.apple.security.cs.allow-unsigned-executable-memory': True,
# calibre itself does not use DYLD env vars, but dont know about its # calibre itself does not use DYLD env vars, but don't know about its
# dependencies. # dependencies.
'com.apple.security.cs.allow-dyld-environment-variables': True, 'com.apple.security.cs.allow-dyld-environment-variables': True,

View File

@ -346,7 +346,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
return write_bytes(pipe, echo_sz, echo_buf) ? 0 : 1; return write_bytes(pipe, echo_sz, echo_buf) ? 0 : 1;
} }
if (app_uid != NULL) { if (app_uid != NULL) {
// dont check return status as failure is not critical // don't check return status as failure is not critical
set_app_uid(app_uid); set_app_uid(app_uid);
} }

View File

@ -5,16 +5,16 @@
<SummaryInformation Keywords="Installer" Description="{app} Installer" Manufacturer="Kovid Goyal" /> <SummaryInformation Keywords="Installer" Description="{app} Installer" Manufacturer="Kovid Goyal" />
<!-- Disable creation of system restore points on calibre installs. Speeds <!-- Disable creation of system restore points on calibre installs. Speeds
up the install. We dont need system restore since we dont install any up the install. We don't need system restore since we don't install any
system DLLs/components anyway (apart from start menu entries) --> system DLLs/components anyway (apart from start menu entries) -->
<Property Id="MSIFASTINSTALL" Value="3" /> <Property Id="MSIFASTINSTALL" Value="3" />
<Media Id="1" Cabinet="{app}.cab" CompressionLevel="{compression}" EmbedCab="yes" /> <Media Id="1" Cabinet="{app}.cab" CompressionLevel="{compression}" EmbedCab="yes" />
<!-- The following line ensures that DLLs are replaced even if <!-- The following line ensures that DLLs are replaced even if
their version is the same as before or they dont have versions. their version is the same as before or they don't have versions.
Microsoft's brain dead installer will otherwise use file dates to Microsoft's brain dead installer will otherwise use file dates to
determine whether to install a file or not. Simply not robust. And determine whether to install a file or not. Simply not robust. And
since we dont install any system files whatsoever, we can never replace since we don't install any system files whatsoever, we can never replace
a system file with an older version. This way the calibre install a system file with an older version. This way the calibre install
should always result in a consistent set of files being present in the should always result in a consistent set of files being present in the
installation folder, though of course, with Microsoft there are no installation folder, though of course, with Microsoft there are no

View File

@ -118,7 +118,7 @@ Normally, calibre will automatically choose a base font size appropriate to the
have chosen (see :ref:`page-setup`). However, you can override this here in case the default is have chosen (see :ref:`page-setup`). However, you can override this here in case the default is
not suitable for you. not suitable for you.
The :guilabel:`Font size key` option lets you control how non-base font sizes are rescaled. The :guilabel:`Font size key` option let's you control how non-base font sizes are rescaled.
The font rescaling algorithm works using a font size key, which is simply a comma-separated The font rescaling algorithm works using a font size key, which is simply a comma-separated
list of font sizes. The font size key tells calibre how many "steps" bigger or smaller a given font list of font sizes. The font size key tells calibre how many "steps" bigger or smaller a given font
size should be compared to the base font size. The idea is that there should be a limited number size should be compared to the base font size. The idea is that there should be a limited number

View File

@ -43,7 +43,7 @@ You can download the Hello World plugin from
:download_file:`helloworld_plugin.zip`. :download_file:`helloworld_plugin.zip`.
Every time you use calibre to convert a book, the plugin's :meth:`run` method will be called and the Every time you use calibre to convert a book, the plugin's :meth:`run` method will be called and the
converted book will have its publisher set to "Hello World". This is a trivial plugin, lets move on to converted book will have its publisher set to "Hello World". This is a trivial plugin, let's move on to
a more complex example that actually adds a component to the user interface. a more complex example that actually adds a component to the user interface.
A User Interface plugin A User Interface plugin

View File

@ -101,7 +101,7 @@ want to rename all the HTML files to have names Chapter-1.html, Chapter-2.html
and so on. Select the files you want bulk renamed by holding down the :kbd:`Shift` or and so on. Select the files you want bulk renamed by holding down the :kbd:`Shift` or
:kbd:`Ctrl` key and clicking the files. Then right click and select :guilabel:`Bulk :kbd:`Ctrl` key and clicking the files. Then right click and select :guilabel:`Bulk
rename`. Enter a prefix and what number you would like the automatic numbering rename`. Enter a prefix and what number you would like the automatic numbering
to start at, click OK and you are done. The bulk rename dialog also lets you to start at, click OK and you are done. The bulk rename dialog also let's you
rename files by the order they appear in the book instead of the order you rename files by the order they appear in the book instead of the order you
selected them in, useful, for instance to rename all images by the order selected them in, useful, for instance to rename all images by the order
they appear. they appear.
@ -191,7 +191,7 @@ Adding new images/fonts/etc. or creating new blank files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can add a new image, font, stylesheet, etc. from your computer into the You can add a new image, font, stylesheet, etc. from your computer into the
book by clicking :guilabel:`File->New file`. This lets you either import a file book by clicking :guilabel:`File->New file`. This let's you either import a file
by clicking the :guilabel:`Import resource file` button or create a new blank HTML file by clicking the :guilabel:`Import resource file` button or create a new blank HTML file
or stylesheet by simply entering the file name into the box for the new file. or stylesheet by simply entering the file name into the box for the new file.

View File

@ -602,7 +602,7 @@ In calibre, you would instead use tags to mark genre and read status and then ju
To those of you that claim that you need access to the filesystem, so that you can have access to your books over the network, calibre has an excellent Content server that gives you access to your calibre library over the net. To those of you that claim that you need access to the filesystem, so that you can have access to your books over the network, calibre has an excellent Content server that gives you access to your calibre library over the net.
If you are worried that someday calibre will cease to be developed, leaving all your books marooned in its folder structure, explore the powerful :guilabel:`Save to disk` feature in calibre that lets you export all your files into a folder structure of arbitrary complexity based on their metadata. If you are worried that someday calibre will cease to be developed, leaving all your books marooned in its folder structure, explore the powerful :guilabel:`Save to disk` feature in calibre that let's you export all your files into a folder structure of arbitrary complexity based on their metadata.
Finally, the reason there are numbers at the end of every title folder, is for *robustness*. That number is the id number of the book record in the calibre database. The presence of the number allows you to have multiple records with the same title and author names. It is also part of what allows calibre to magically regenerate the database with all metadata if the database file gets corrupted. Given that calibre's mission is to get you to stop storing metadata in filenames and stop using the filesystem to find things, the increased robustness afforded by the id numbers is well worth the uglier folder names. Finally, the reason there are numbers at the end of every title folder, is for *robustness*. That number is the id number of the book record in the calibre database. The presence of the number allows you to have multiple records with the same title and author names. It is also part of what allows calibre to magically regenerate the database with all metadata if the database file gets corrupted. Given that calibre's mission is to get you to stop storing metadata in filenames and stop using the filesystem to find things, the increased robustness afforded by the id numbers is well worth the uglier folder names.

View File

@ -153,7 +153,7 @@ are processed in the order in which they appear in the book. See
Auto create a Table of Contents Auto create a Table of Contents
------------------------------- -------------------------------
Finally, lets try something a little more ambitious. Suppose your book has Finally, let's try something a little more ambitious. Suppose your book has
headings in ``h1`` and ``h2`` tags that look like headings in ``h1`` and ``h2`` tags that look like
``<h1 id="someid">Some Text</h1>``. We will auto-generate an HTML Table of ``<h1 id="someid">Some Text</h1>``. We will auto-generate an HTML Table of
Contents based on these headings. Create the custom function below: Contents based on these headings. Create the custom function below:

View File

@ -72,7 +72,7 @@ Regular expression mode has some differences from character mode, beyond (of cou
The third and most important is that the replace string can make reference to parts of the search string by using backreferences. A backreference is ``\\n`` where n is an integer that refers to the n'th parenthesized group in the search expression. For example, given the same example as above, `a bad cat`, a search expression `a (...) (...)`, and a replace expression `a \\2 \\1`, the result will be `a cat bad`. Please see the :ref:`regexptutorial` for more information on backreferences. The third and most important is that the replace string can make reference to parts of the search string by using backreferences. A backreference is ``\\n`` where n is an integer that refers to the n'th parenthesized group in the search expression. For example, given the same example as above, `a bad cat`, a search expression `a (...) (...)`, and a replace expression `a \\2 \\1`, the result will be `a cat bad`. Please see the :ref:`regexptutorial` for more information on backreferences.
One useful pattern: assume you want to change the case of an entire field. The easiest way to do this is to use character mode, but lets further assume you want to use regular expression mode. The search expression should be `(^.*$)`, the replace expression should be `\\1`, and the desired case change function should be selected. One useful pattern: assume you want to change the case of an entire field. The easiest way to do this is to use character mode, but let's further assume you want to use regular expression mode. The search expression should be `(^.*$)`, the replace expression should be `\\1`, and the desired case change function should be selected.
Finally, in regular expression mode you can copy values from one field to another. Simply make the source and destination field different. The copy can replace the destination field, prepend to the field (add to the front), or append to the field (add at the end). The 'use comma' checkbox tells calibre to (or not to) add a comma between the text and the destination field in prepend and append modes. If the destination is multiple (e.g., tags), then you cannot uncheck this box. Finally, in regular expression mode you can copy values from one field to another. Simply make the source and destination field different. The copy can replace the destination field, prepend to the field (add to the front), or append to the field (add at the end). The 'use comma' checkbox tells calibre to (or not to) add a comma between the text and the destination field in prepend and append modes. If the destination is multiple (e.g., tags), then you cannot uncheck this box.

View File

@ -138,7 +138,7 @@ This can be removed by adding::
remove_tags = [dict(name='div', attrs={'class':'footer'})] remove_tags = [dict(name='div', attrs={'class':'footer'})]
to the recipe. Finally, lets replace some of the :term:`CSS` that we disabled earlier, with our own :term:`CSS` that is suitable for conversion to an e-book:: to the recipe. Finally, let's replace some of the :term:`CSS` that we disabled earlier, with our own :term:`CSS` that is suitable for conversion to an e-book::
extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }' extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }'

View File

@ -14,7 +14,7 @@ from calibre.utils.config import JSONConfig
# Remember that this name (i.e. plugins/interface_demo) is also # Remember that this name (i.e. plugins/interface_demo) is also
# in a global namespace, so make it as unique as possible. # in a global namespace, so make it as unique as possible.
# You should always prefix your config file name with plugins/, # You should always prefix your config file name with plugins/,
# so as to ensure you dont accidentally clobber a calibre config file # so as to ensure you don't accidentally clobber a calibre config file
prefs = JSONConfig('plugins/interface_demo') prefs = JSONConfig('plugins/interface_demo')
# Set defaults # Set defaults

View File

@ -140,7 +140,7 @@ class DemoDialog(QDialog):
set_metadata(ffile, mi, fmt) set_metadata(ffile, mi, fmt)
ffile.seek(0) ffile.seek(0)
# Now replace the file in the calibre library with the updated # Now replace the file in the calibre library with the updated
# file. We dont use add_format_with_hooks as the hooks were # file. We don't use add_format_with_hooks as the hooks were
# already run when the file was first added to calibre. # already run when the file was first added to calibre.
db.add_format(book_id, fmt, ffile, run_hooks=False) db.add_format(book_id, fmt, ffile, run_hooks=False)

View File

@ -22,7 +22,7 @@ class InterfacePlugin(InterfaceAction):
name = 'Interface Plugin Demo' name = 'Interface Plugin Demo'
# Declare the main action associated with this plugin # Declare the main action associated with this plugin
# The keyboard shortcut can be None if you dont want to use a keyboard # The keyboard shortcut can be None if you don't want to use a keyboard
# shortcut. Remember that currently calibre has no central management for # shortcut. Remember that currently calibre has no central management for
# keyboard shortcuts, so try to use an unusual/unused shortcut. # keyboard shortcuts, so try to use an unusual/unused shortcut.
action_spec = ('Interface Plugin Demo', None, action_spec = ('Interface Plugin Demo', None,

View File

@ -108,7 +108,7 @@ In the beginning, you said there was a way to make a regular expression case ins
Yes, I did, thanks for paying attention and reminding me. You can tell calibre how you want certain things handled by using something called flags. You include flags in your expression by using the special construct ``(?flags go here)`` where, obviously, you'd replace "flags go here" with the specific flags you want. For ignoring case, the flag is ``i``, thus you include ``(?i)`` in your expression. Thus, ``(?i)test`` would match "Test", "tEst", "TEst" and any case variation you could think of. Yes, I did, thanks for paying attention and reminding me. You can tell calibre how you want certain things handled by using something called flags. You include flags in your expression by using the special construct ``(?flags go here)`` where, obviously, you'd replace "flags go here" with the specific flags you want. For ignoring case, the flag is ``i``, thus you include ``(?i)`` in your expression. Thus, ``(?i)test`` would match "Test", "tEst", "TEst" and any case variation you could think of.
Another useful flag lets the dot match any character at all, *including* the newline, the flag ``s``. If you want to use multiple flags in an expression, just put them in the same statement: ``(?is)`` would ignore case and make the dot match all. It doesn't matter which flag you state first, ``(?si)`` would be equivalent to the above. Another useful flag let's the dot match any character at all, *including* the newline, the flag ``s``. If you want to use multiple flags in an expression, just put them in the same statement: ``(?is)`` would ignore case and make the dot match all. It doesn't matter which flag you state first, ``(?si)`` would be equivalent to the above.
I think I'm beginning to understand these regular expressions now... how do I use them in calibre? I think I'm beginning to understand these regular expressions now... how do I use them in calibre?
----------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------

View File

@ -474,7 +474,7 @@ In `TPM`, using ``{`` and ``}`` characters in string literals can lead to errors
Python Template Mode Python Template Mode
----------------------------------- -----------------------------------
Python Template Mode (PTM) lets you write templates using native Python and the `calibre API <https://manual.calibre-ebook.com/develop.html#api-documentation-for-various-parts-of-calibre>`_. The database API will be of most use; further discussion is beyond the scope of this manual. PTM templates are faster and can do more complicated operations but you must know how to write code in Python using the calibre API. Python Template Mode (PTM) let's you write templates using native Python and the `calibre API <https://manual.calibre-ebook.com/develop.html#api-documentation-for-various-parts-of-calibre>`_. The database API will be of most use; further discussion is beyond the scope of this manual. PTM templates are faster and can do more complicated operations but you must know how to write code in Python using the calibre API.
A PTM template begins with: A PTM template begins with:
@ -797,7 +797,7 @@ For example, assume we want the folder structure `series/series_index - title`,
The slash and the hyphen appear only if series is not empty. The slash and the hyphen appear only if series is not empty.
The lookup function lets us do even fancier processing. For example, assume that if a book has a series, then we want the folder structure `series/series index - title.fmt`. If the book does not have a series then we want the folder structure `genre/author_sort/title.fmt`. If the book has no genre then we want to use 'Unknown'. We want two completely different paths, depending on the value of series. The lookup function let's us do even fancier processing. For example, assume that if a book has a series, then we want the folder structure `series/series index - title.fmt`. If the book does not have a series then we want the folder structure `genre/author_sort/title.fmt`. If the book has no genre then we want to use 'Unknown'. We want two completely different paths, depending on the value of series.
To accomplish this, we: To accomplish this, we:

View File

@ -87,6 +87,7 @@ builtin = [
'clear', 'clear',
'rare', 'rare',
'informal', 'informal',
'code',
] ]
ignore-words-list = [ ignore-words-list = [
"alo", "alo",
@ -108,6 +109,37 @@ ignore-words-list = [
"re-used", "re-used",
"re-using", "re-using",
"succeded", "succeded",
# code
"ws",
"ws",
"ws",
"ws",
"dur",
"ro",
"snd",
"ws",
"deque",
"assertIn",
"atEnd",
"endcode",
"errorString",
"FocusIn",
"iff",
"lite",
"NMAKE",
"nmake",
"uDate",
"UINT",
"uInt",
"uint",
"KeyPair",
"Keypair",
"keypair",
"Referer",
"seeked",
"sinc",
"stdio",
"thead",
] ]
uri-ignore-words-list = '*' uri-ignore-words-list = '*'
skip = [ skip = [

View File

@ -81,7 +81,7 @@ class BaltimoreSun(BasicNewsRecipe):
(u'Maryland Weather', u'http://www.baltimoresun.com/news/weather/weather-blog/rss2.0.xml'), (u'Maryland Weather', u'http://www.baltimoresun.com/news/weather/weather-blog/rss2.0.xml'),
(u'Second Opinion', u'http://www.baltimoresun.com/news/opinion/second-opinion-blog/rss2.0.xml'), (u'Second Opinion', u'http://www.baltimoresun.com/news/opinion/second-opinion-blog/rss2.0.xml'),
(u'Sun Investigates', u'http://www.baltimoresun.com/news/maryland/sun-investigates/rss2.0.xml'), (u'Sun Investigates', u'http://www.baltimoresun.com/news/maryland/sun-investigates/rss2.0.xml'),
(u'You Dont Say', u'http://www.baltimoresun.com/news/language-blog/rss2.0.xml'), (u"You Don't Say", u'http://www.baltimoresun.com/news/language-blog/rss2.0.xml'),
# Business Blogs ## # Business Blogs ##
(u'BaltTech', u'http://www.baltimoresun.com/business/technology/blog/rss2.0.xml'), (u'BaltTech', u'http://www.baltimoresun.com/business/technology/blog/rss2.0.xml'),

View File

@ -45,7 +45,7 @@ class epw(BasicNewsRecipe):
'/styles/freeissue/public', '' '/styles/freeissue/public', ''
) )
except Exception: except Exception:
# sometimes they dont add img src # sometimes they don't add img src
self.cover_url = 'https://www.epw.in/sites/default/files/cache/cover_images/2022/Cover_4June2022_Big.gif' self.cover_url = 'https://www.epw.in/sites/default/files/cache/cover_images/2022/Cover_4June2022_Big.gif'
feeds = OrderedDict() feeds = OrderedDict()

View File

@ -56,7 +56,7 @@ class TheMiamiHerald(BasicNewsRecipe):
] ]
def get_browser(self, *a, **kw): def get_browser(self, *a, **kw):
# MyClatchy servers dont like the user-agent header, they hang forever # MyClatchy servers don't like the user-agent header, they hang forever
# when it is present # when it is present
br = BasicNewsRecipe.get_browser(self, *a, **kw) br = BasicNewsRecipe.get_browser(self, *a, **kw)
br.addheaders = [x for x in br.addheaders if x[0].lower() != 'user-agent'] br.addheaders = [x for x in br.addheaders if x[0].lower() != 'user-agent']

View File

@ -285,7 +285,7 @@ auto_connect_to_folder = ''
# category. If two books have fields that generate the same collection name, # category. If two books have fields that generate the same collection name,
# then both books will be in that collection. # then both books will be in that collection.
# #
# This set of tweaks lets you specify for a standard or custom field how # This set of tweaks let's you specify for a standard or custom field how
# the collections are to be named. You can use it to add a description to a # the collections are to be named. You can use it to add a description to a
# standard field, for example 'Foo (Tag)' instead of the 'Foo'. You can also use # standard field, for example 'Foo (Tag)' instead of the 'Foo'. You can also use
# it to force multiple fields to end up in the same collection. # it to force multiple fields to end up in the same collection.

View File

@ -8,7 +8,7 @@
(function() { (function() {
"use strict"; "use strict";
// wrap up long words that dont fit in the page // wrap up long words that don't fit in the page
document.body.style.overflowWrap = 'break-word'; document.body.style.overflowWrap = 'break-word';
var break_avoid_block_styles = { var break_avoid_block_styles = {

View File

@ -12,7 +12,7 @@
var settings = SETTINGS; var settings = SETTINGS;
function onclick(event) { function onclick(event) {
// We dont want this event to trigger onclick on this element's parent // We don't want this event to trigger onclick on this element's parent
// block, if any. // block, if any.
event.stopPropagation(); event.stopPropagation();
var frac = window.pageYOffset/document.body.scrollHeight; var frac = window.pageYOffset/document.body.scrollHeight;

View File

@ -580,7 +580,7 @@ class Build(Command):
if iswindows or env is self.windows_cross_env: if iswindows or env is self.windows_cross_env:
pre_ld_flags = [] pre_ld_flags = []
if ext.uses_icu: if ext.uses_icu:
# windows has its own ICU libs that dont work # windows has its own ICU libs that don't work
pre_ld_flags = elib pre_ld_flags = elib
cmd += pre_ld_flags + env.ldflags + ext.ldflags + elib + xlib + \ cmd += pre_ld_flags + env.ldflags + ext.ldflags + elib + xlib + \
['/EXPORT:' + init_symbol_name(ext.name)] + all_objects + ['/OUT:'+dest] ['/EXPORT:' + init_symbol_name(ext.name)] + all_objects + ['/OUT:'+dest]
@ -623,7 +623,7 @@ class Build(Command):
def build_headless(self): def build_headless(self):
from setup.parallel_build import cpu_count from setup.parallel_build import cpu_count
if iswindows or ishaiku: if iswindows or ishaiku:
return # Dont have headless operation on these platforms return # Don't have headless operation on these platforms
from setup.build_environment import CMAKE, sw from setup.build_environment import CMAKE, sw
self.info('\n####### Building headless QPA plugin', '#'*7) self.info('\n####### Building headless QPA plugin', '#'*7)
a = absolutize a = absolutize

View File

@ -57,7 +57,7 @@ def get_dist(base, which, bitness):
def shutdown_allowed(which, bitness): def shutdown_allowed(which, bitness):
# The ARM64 VM is extremely flakey often booting up to a non-functional # The ARM64 VM is extremely flakey often booting up to a non-functional
# state so dont shut it down as it seems to be more stable once boot-up is # state so don't shut it down as it seems to be more stable once boot-up is
# done. # done.
return bitness != 'arm64' return bitness != 'arm64'

View File

@ -286,7 +286,7 @@ class Translations(POT): # {{{
def is_po_file_ok(self, x): def is_po_file_ok(self, x):
bname = os.path.splitext(os.path.basename(x))[0] bname = os.path.splitext(os.path.basename(x))[0]
# sr@latin.po is identical to sr.po. And we dont support country # sr@latin.po is identical to sr.po. And we don't support country
# specific variants except for a few. # specific variants except for a few.
if '_' in bname: if '_' in bname:
return bname.partition('_')[0] in ('pt', 'zh', 'bn') return bname.partition('_')[0] in ('pt', 'zh', 'bn')

View File

@ -45,7 +45,7 @@ class InputProfile(Plugin):
type = _('Input profile') type = _('Input profile')
name = 'Default Input Profile' name = 'Default Input Profile'
short_name = 'default' # Used in the CLI so dont use spaces etc. in it short_name = 'default' # Used in the CLI so don't use spaces etc. in it
description = _('This profile tries to provide sane defaults and is useful ' description = _('This profile tries to provide sane defaults and is useful '
'if you know nothing about the input document.') 'if you know nothing about the input document.')
@ -243,7 +243,7 @@ class OutputProfile(Plugin):
type = _('Output profile') type = _('Output profile')
name = 'Default Output Profile' name = 'Default Output Profile'
short_name = 'default' # Used in the CLI so dont use spaces etc. in it short_name = 'default' # Used in the CLI so don't use spaces etc. in it
description = _('This profile tries to provide sane defaults and is useful ' description = _('This profile tries to provide sane defaults and is useful '
'if you want to produce a document intended to be read at a ' 'if you want to produce a document intended to be read at a '
'computer or on a range of devices.') 'computer or on a range of devices.')

View File

@ -715,7 +715,7 @@ def patch_metadata_plugins(possibly_updated_plugins):
if pup is not None: if pup is not None:
if pup.version > plugin.version and pup.minimum_calibre_version <= numeric_version: if pup.version > plugin.version and pup.minimum_calibre_version <= numeric_version:
patches[i] = pup(None) patches[i] = pup(None)
# Metadata source plugins dont use initialize() but that # Metadata source plugins don't use initialize() but that
# might change in the future, so be safe. # might change in the future, so be safe.
patches[i].initialize() patches[i].initialize()
for i, pup in iteritems(patches): for i, pup in iteritems(patches):

View File

@ -2283,7 +2283,7 @@ class DB:
def remove_trash_formats_dir_if_empty(self, book_id): def remove_trash_formats_dir_if_empty(self, book_id):
bdir = os.path.join(self.trash_dir, 'f', str(book_id)) bdir = os.path.join(self.trash_dir, 'f', str(book_id))
if os.path.isdir(bdir) and len(os.listdir(bdir)) <= 1: # dont count metadata.json if os.path.isdir(bdir) and len(os.listdir(bdir)) <= 1: # don't count metadata.json
self.rmtree(bdir) self.rmtree(bdir)
def list_trash_entries(self): def list_trash_entries(self):

View File

@ -373,7 +373,7 @@ class Cache:
mi.format_metadata = FormatMetadata(self, book_id, formats) mi.format_metadata = FormatMetadata(self, book_id, formats)
good_formats = FormatsList(sorted(formats), mi.format_metadata) good_formats = FormatsList(sorted(formats), mi.format_metadata)
# These three attributes are returned by the db2 get_metadata(), # These three attributes are returned by the db2 get_metadata(),
# however, we dont actually use them anywhere other than templates, so # however, we don't actually use them anywhere other than templates, so
# they have been removed, to avoid unnecessary overhead. The templates # they have been removed, to avoid unnecessary overhead. The templates
# all use _proxy_metadata. # all use _proxy_metadata.
# mi.book_size = self._field_for('size', book_id, default_value=0) # mi.book_size = self._field_for('size', book_id, default_value=0)
@ -2287,7 +2287,7 @@ class Cache:
# We must preserve order. # We must preserve order.
vals = list(vals) vals = list(vals)
# Don't need to worry about case here because we # Don't need to worry about case here because we
# are fetching its one-true spelling. But lets be # are fetching its one-true spelling. But let's be
# careful anyway # careful anyway
try: try:
dex = vals.index(self._get_item_name(field, old_id)) dex = vals.index(self._get_item_name(field, old_id))

View File

@ -135,7 +135,7 @@ class Restore(Thread):
tdir = TemporaryDirectory('_rlib', dir=basedir) tdir = TemporaryDirectory('_rlib', dir=basedir)
tdir.__enter__() tdir.__enter__()
except OSError: except OSError:
# In case we dont have permissions to create directories in the # In case we don't have permissions to create directories in the
# parent folder of the src library # parent folder of the src library
tdir = TemporaryDirectory('_rlib') tdir = TemporaryDirectory('_rlib')

View File

@ -707,7 +707,7 @@ class Parser(SearchQueryParser): # {{{
continue continue
if fm['search_terms'] and x not in {'series_sort', 'id'}: if fm['search_terms'] and x not in {'series_sort', 'id'}:
if x not in self.virtual_fields and x != 'uuid': if x not in self.virtual_fields and x != 'uuid':
# We dont search virtual fields because if we do, search # We don't search virtual fields because if we do, search
# caching will not be used # caching will not be used
all_locs.add(x) all_locs.add(x)
field_metadata[x] = fm field_metadata[x] = fm

View File

@ -46,8 +46,8 @@ def get_defaults(spec):
def compare_argspecs(old, new, attr): def compare_argspecs(old, new, attr):
# We dont compare the names of the non-keyword arguments as they are often # We don't compare the names of the non-keyword arguments as they are often
# different and they dont affect the usage of the API. # different and they don't affect the usage of the API.
ok = len(old.args) == len(new.args) and get_defaults(old) == get_defaults(new) ok = len(old.args) == len(new.args) and get_defaults(old) == get_defaults(new)
if not ok: if not ok:

View File

@ -188,7 +188,7 @@ def debug(ioreg_to_tmp=False, buf=None, plugins=None,
out(' ') out(' ')
if ioreg_to_tmp: if ioreg_to_tmp:
open('/tmp/ioreg.txt', 'w').write(ioreg) open('/tmp/ioreg.txt', 'w').write(ioreg)
out('Dont forget to send the contents of /tmp/ioreg.txt') out("Don't forget to send the contents of /tmp/ioreg.txt")
out('You can open it with the command: open /tmp/ioreg.txt') out('You can open it with the command: open /tmp/ioreg.txt')
else: else:
out(ioreg) out(ioreg)

View File

@ -29,7 +29,7 @@
* These flags are used to indicate if some or other * These flags are used to indicate if some or other
* device need special treatment. These should be possible * device need special treatment. These should be possible
* to concatenate using logical OR so please use one bit per * to concatenate using logical OR so please use one bit per
* feature and lets pray we don't need more than 32 bits... * feature and let's pray we don't need more than 32 bits...
*/ */
#define DEVICE_FLAG_NONE 0x00000000 #define DEVICE_FLAG_NONE 0x00000000
/** /**

View File

@ -620,7 +620,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
if e.args[0] != EAGAIN and e.args[0] != EINTR: if e.args[0] != EAGAIN and e.args[0] != EINTR:
self._close_device_socket() self._close_device_socket()
raise raise
time.sleep(0.1) # lets not hammer the OS too hard time.sleep(0.1) # let's not hammer the OS too hard
except: except:
self._close_device_socket() self._close_device_socket()
raise raise

View File

@ -922,7 +922,7 @@ def get_usb_info(usbdev, debug=False): # {{{
try: try:
buf, dd = get_device_descriptor(handle, device_port) buf, dd = get_device_descriptor(handle, device_port)
if dd.idVendor == usbdev.vendor_id and dd.idProduct == usbdev.product_id and dd.bcdDevice == usbdev.bcd: if dd.idVendor == usbdev.vendor_id and dd.idProduct == usbdev.product_id and dd.bcdDevice == usbdev.bcd:
# Dont need to read language since we only care about english names # Don't need to read language since we only care about english names
# buf, langs = get_device_languages(handle, device_port) # buf, langs = get_device_languages(handle, device_port)
# print(111, langs) # print(111, langs)
for index, name in ((dd.iManufacturer, 'manufacturer'), (dd.iProduct, 'product'), (dd.iSerialNumber, 'serial_number')): for index, name in ((dd.iManufacturer, 'manufacturer'), (dd.iProduct, 'product'), (dd.iSerialNumber, 'serial_number')):

View File

@ -117,7 +117,7 @@ class HTMLZInput(InputFormatPlugin):
if opf: if opf:
opf_parsed = OPF(opf, basedir=os.getcwd()) opf_parsed = OPF(opf, basedir=os.getcwd())
cover_path = opf_parsed.raster_cover or opf_parsed.cover cover_path = opf_parsed.raster_cover or opf_parsed.cover
os.remove(opf) # dont confuse code that searches for OPF files later on the oeb object will create its own OPF os.remove(opf) # don't confuse code that searches for OPF files later on the oeb object will create its own OPF
# Set the cover. # Set the cover.
if cover_path: if cover_path:
cdata = None cdata = None

View File

@ -123,7 +123,7 @@ def read_single_border(parent, edge, XPath, get):
pass pass
sz = get(elem, 'w:sz') sz = get(elem, 'w:sz')
if sz is not None: if sz is not None:
# we dont care about art borders (they are only used for page borders) # we don't care about art borders (they are only used for page borders)
try: try:
width = min(96, max(2, float(sz))) / 8 width = min(96, max(2, float(sz))) / 8
except (ValueError, TypeError): except (ValueError, TypeError):

View File

@ -33,7 +33,7 @@ def read_text_border(parent, dest, XPath, get):
pass pass
sz = get(elem, 'w:sz') sz = get(elem, 'w:sz')
if sz is not None: if sz is not None:
# we dont care about art borders (they are only used for page borders) # we don't care about art borders (they are only used for page borders)
try: try:
# A border of less than 1pt is not rendered by WebKit # A border of less than 1pt is not rendered by WebKit
border_width = min(96, max(8, float(sz))) / 8 border_width = min(96, max(8, float(sz))) / 8

View File

@ -520,7 +520,7 @@ class Convert:
if float_spec is None and is_float: if float_spec is None and is_float:
float_spec = FloatSpec(self.docx.namespace, html_tag, tag_style) float_spec = FloatSpec(self.docx.namespace, html_tag, tag_style)
if display in {'inline', 'inline-block'} or tagname == 'br': # <br> has display:block but we dont want to start a new paragraph if display in {'inline', 'inline-block'} or tagname == 'br': # <br> has display:block but we don't want to start a new paragraph
if is_float and float_spec.is_dropcaps: if is_float and float_spec.is_dropcaps:
self.add_block_tag(tagname, html_tag, tag_style, stylizer, float_spec=float_spec) self.add_block_tag(tagname, html_tag, tag_style, stylizer, float_spec=float_spec)
float_spec = None float_spec = None
@ -539,7 +539,7 @@ class Convert:
self.blocks.start_new_table(html_tag, tag_style) self.blocks.start_new_table(html_tag, tag_style)
else: else:
if tagname == 'img' and is_float: if tagname == 'img' and is_float:
# Image is floating so dont start a new paragraph for it # Image is floating so don't start a new paragraph for it
self.add_inline_tag(tagname, html_tag, tag_style, stylizer) self.add_inline_tag(tagname, html_tag, tag_style, stylizer)
else: else:
if tagname == 'hr': if tagname == 'hr':

View File

@ -9,7 +9,7 @@ import regex
class Parser: class Parser:
''' See epubcfi.ebnf for the specification that this parser tries to ''' See epubcfi.ebnf for the specification that this parser tries to
follow. I have implemented it manually, since I dont want to depend on follow. I have implemented it manually, since I don't want to depend on
grako, and the grammar is pretty simple. This parser is thread-safe, i.e. grako, and the grammar is pretty simple. This parser is thread-safe, i.e.
it can be used from multiple threads simultaneously. ''' it can be used from multiple threads simultaneously. '''

View File

@ -580,7 +580,7 @@ class LitFile:
offset, size = u32(piece), int32(piece[8:]) offset, size = u32(piece), int32(piece[8:])
piece = self.read_raw(offset, size) piece = self.read_raw(offset, size)
if i == 0: if i == 0:
continue # Dont need this piece continue # Don't need this piece
elif i == 1: elif i == 1:
if u32(piece[8:]) != self.entry_chunklen or \ if u32(piece[8:]) != self.entry_chunklen or \
u32(piece[12:]) != self.entry_unknown: u32(piece[12:]) != self.entry_unknown:

View File

@ -814,7 +814,7 @@ class HTMLConverter:
collapse_whitespace = 'white-space' not in css or css['white-space'] != 'pre' collapse_whitespace = 'white-space' not in css or css['white-space'] != 'pre'
if self.process_alignment(css) and collapse_whitespace: if self.process_alignment(css) and collapse_whitespace:
# Dont want leading blanks in a new paragraph # Don't want leading blanks in a new paragraph
src = src.lstrip() src = src.lstrip()
def append_text(src): def append_text(src):

View File

@ -637,11 +637,11 @@ class TBSIndexing: # {{{
ai, extra, consumed = decode_tbs(byts) ai, extra, consumed = decode_tbs(byts)
byts = byts[consumed:] byts = byts[consumed:]
if extra.get(0b0010, None) is not None: if extra.get(0b0010, None) is not None:
raise ValueError('Dont know how to interpret flag 0b0010' raise ValueError("Don't know how to interpret flag 0b0010"
' while reading section transitions') ' while reading section transitions')
if extra.get(0b1000, None) is not None: if extra.get(0b1000, None) is not None:
if len(extra) > 1: if len(extra) > 1:
raise ValueError('Dont know how to interpret flags' raise ValueError("Don't know how to interpret flags"
f' {extra!r} while reading section transitions') f' {extra!r} while reading section transitions')
nsi = self.get_index(psi.index+1) nsi = self.get_index(psi.index+1)
ans.append( ans.append(
@ -675,7 +675,7 @@ class TBSIndexing: # {{{
si, extra, consumed = decode_tbs(byts) si, extra, consumed = decode_tbs(byts)
byts = byts[consumed:] byts = byts[consumed:]
if len(extra) > 1 or 0b0010 in extra or 0b1000 in extra: if len(extra) > 1 or 0b0010 in extra or 0b1000 in extra:
raise ValueError(f'Dont know how to interpret flags {extra!r}' raise ValueError(f"Don't know how to interpret flags {extra!r}"
' when reading starting section') ' when reading starting section')
si = self.get_index(si) si = self.get_index(si)
ans.append('The section at the start of this record is:' ans.append('The section at the start of this record is:'

View File

@ -55,7 +55,7 @@ def parse_indx_header(data):
ans['ordt_map'] = '' ans['ordt_map'] = ''
if ordt1 > 0 and data[ordt1:ordt1+4] == b'ORDT': if ordt1 > 0 and data[ordt1:ordt1+4] == b'ORDT':
# I dont know what this is, but using it seems to be unnecessary, so # I don't know what this is, but using it seems to be unnecessary, so
# just leave it as the raw bytestring # just leave it as the raw bytestring
ans['ordt1_raw'] = data[ordt1+4:ordt1+4+ans['oentries']] ans['ordt1_raw'] = data[ordt1+4:ordt1+4+ans['oentries']]
if ordt2 > 0 and data[ordt2:ordt2+4] == b'ORDT': if ordt2 > 0 and data[ordt2:ordt2+4] == b'ORDT':

View File

@ -221,7 +221,7 @@ class SecondaryIndexEntry(IndexEntry):
tag = self.INDEX_MAP[index] tag = self.INDEX_MAP[index]
# The values for this index entry # The values for this index entry
# I dont know what the 5 means, it is not the number of entries # I don't know what the 5 means, it is not the number of entries
self.secondary = [5 if tag == min( self.secondary = [5 if tag == min(
itervalues(self.INDEX_MAP)) else 0, 0, tag] itervalues(self.INDEX_MAP)) else 0, 0, tag]

View File

@ -20,7 +20,7 @@ from calibre.ebooks.mobi.writer2.serializer import Serializer
from calibre.utils.filenames import ascii_filename from calibre.utils.filenames import ascii_filename
from polyglot.builtins import iteritems from polyglot.builtins import iteritems
# Disabled as I dont care about uncrossable breaks # Disabled as I don't care about uncrossable breaks
WRITE_UNCROSSABLE_BREAKS = False WRITE_UNCROSSABLE_BREAKS = False
NULL_INDEX = 0xffffffff NULL_INDEX = 0xffffffff

View File

@ -25,7 +25,7 @@ def process_jpegs_for_amazon(data: bytes) -> bytes:
img = Image.open(BytesIO(data)) img = Image.open(BytesIO(data))
if img.format == 'JPEG': if img.format == 'JPEG':
# Amazon's MOBI renderer can't render JPEG images without JFIF metadata # Amazon's MOBI renderer can't render JPEG images without JFIF metadata
# and images with EXIF data dont get displayed on the cover screen # and images with EXIF data don't get displayed on the cover screen
changed = not img.info changed = not img.info
has_exif = False has_exif = False
if hasattr(img, 'getexif'): if hasattr(img, 'getexif'):

View File

@ -240,7 +240,7 @@ class Serializer:
if tocref.klass == 'periodical': if tocref.klass == 'periodical':
# This is a section node. # This is a section node.
# For periodical tocs, the section urls are like r'feed_\d+/index.html' # For periodical tocs, the section urls are like r'feed_\d+/index.html'
# We dont want to point to the start of the first article # We don't want to point to the start of the first article
# so we change the href. # so we change the href.
itemhref = re.sub(r'article_\d+/', '', itemhref) itemhref = re.sub(r'article_\d+/', '', itemhref)
self.href_offsets[itemhref].append(buf.tell()) self.href_offsets[itemhref].append(buf.tell())

View File

@ -246,7 +246,7 @@ class SkelIndex(Index):
def __init__(self, skel_table): def __init__(self, skel_table):
self.entries = [ self.entries = [
(s.name, { (s.name, {
# Dont ask me why these entries have to be repeated twice # Don't ask me why these entries have to be repeated twice
'chunk_count':(s.chunk_count, s.chunk_count), 'chunk_count':(s.chunk_count, s.chunk_count),
'geometry':(s.start_pos, s.length, s.start_pos, s.length), 'geometry':(s.start_pos, s.length, s.start_pos, s.length),
}) for s in skel_table }) for s in skel_table
@ -387,7 +387,7 @@ if __name__ == '__main__':
subprocess.check_call(['ebook-convert', src, '.epub', '--level1-toc', '//h:p', '--no-default-epub-cover', '--flow-size', '1000000']) subprocess.check_call(['ebook-convert', src, '.epub', '--level1-toc', '//h:p', '--no-default-epub-cover', '--flow-size', '1000000'])
subprocess.check_call(['ebook-convert', src, '.azw3', '--level1-toc', '//h:p', '--no-inline-toc', '--extract-to=x']) subprocess.check_call(['ebook-convert', src, '.azw3', '--level1-toc', '//h:p', '--no-inline-toc', '--extract-to=x'])
subprocess.call(['kindlegen', 'index.epub']) # kindlegen exit code is not 0 as we dont have a cover subprocess.call(['kindlegen', 'index.epub']) # kindlegen exit code is not 0 as we don't have a cover
subprocess.check_call(['calibre-debug', 'index.mobi']) subprocess.check_call(['calibre-debug', 'index.mobi'])
from calibre.gui2.tweak_book.diff.main import main from calibre.gui2.tweak_book.diff.main import main

View File

@ -500,7 +500,7 @@ class Container(ContainerBase): # {{{
# spec requires all text including filenames to be in NFC form. # spec requires all text including filenames to be in NFC form.
# The proper fix is to implement a VFS that maps between # The proper fix is to implement a VFS that maps between
# canonical names and their file system representation, however, # canonical names and their file system representation, however,
# I dont have the time for that now. Note that the container # I don't have the time for that now. Note that the container
# ensures that all text files are normalized to NFC when # ensures that all text files are normalized to NFC when
# decoding them anyway, so there should be no mismatch between # decoding them anyway, so there should be no mismatch between
# names in the text and NFC canonical file names. # names in the text and NFC canonical file names.
@ -1481,7 +1481,7 @@ def opf_to_azw3(opf, outpath, container):
def _parse_css(self, data): def _parse_css(self, data):
# The default CSS parser used by oeb.base inserts the h namespace # The default CSS parser used by oeb.base inserts the h namespace
# and resolves all @import rules. We dont want that. # and resolves all @import rules. We don't want that.
return container.parse_css(data) return container.parse_css(data)
def specialize(oeb): def specialize(oeb):

View File

@ -131,8 +131,8 @@ def filter_by_weight(fonts, val):
def find_matching_font(fonts, weight='normal', style='normal', stretch='normal'): def find_matching_font(fonts, weight='normal', style='normal', stretch='normal'):
# See https://www.w3.org/TR/css-fonts-3/#font-style-matching # See https://www.w3.org/TR/css-fonts-3/#font-style-matching
# We dont implement the unicode character range testing # We don't implement the unicode character range testing
# We also dont implement bolder, lighter # We also don't implement bolder, lighter
for f, q in ((filter_by_stretch, stretch), (filter_by_style, style), (filter_by_weight, weight)): for f, q in ((filter_by_stretch, stretch), (filter_by_style, style), (filter_by_weight, weight)):
fonts = f(fonts, q) fonts = f(fonts, q)
if len(fonts) == 1: if len(fonts) == 1:

View File

@ -81,7 +81,7 @@ def pretty_opf(root):
try: try:
children = sorted(manifest, key=manifest_key) children = sorted(manifest, key=manifest_key)
except AttributeError: except AttributeError:
continue # There are comments so dont sort since that would mess up the comments continue # There are comments so don't sort since that would mess up the comments
for x in reversed(children): for x in reversed(children):
manifest.insert(0, x) manifest.insert(0, x)

View File

@ -232,7 +232,7 @@ def parse_css(data, fname='<string>', is_declaration=False, decode=None, log_lev
if css_preprocessor is not None: if css_preprocessor is not None:
data = css_preprocessor(data) data = css_preprocessor(data)
parser = CSSParser(loglevel=log_level, parser = CSSParser(loglevel=log_level,
# We dont care about @import rules # We don't care about @import rules
fetcher=lambda x: (None, None), log=_css_logger) fetcher=lambda x: (None, None), log=_css_logger)
if is_declaration: if is_declaration:
data = parser.parseStyle(data, validate=False) data = parser.parseStyle(data, validate=False)

View File

@ -84,7 +84,7 @@ class CoverManager:
def default_cover(self): def default_cover(self):
''' '''
Create a generic cover for books that dont have a cover Create a generic cover for books that don't have a cover
''' '''
if self.no_default_cover: if self.no_default_cover:
return None return None

View File

@ -141,7 +141,7 @@ class EmbedFonts:
for sel in rule.selectorList: for sel in rule.selectorList:
sel = sel.selectorText sel = sel.selectorText
if sel and sel.startswith('.'): if sel and sel.startswith('.'):
# We dont care about pseudo-selectors as the worst that # We don't care about pseudo-selectors as the worst that
# can happen is some extra characters will remain in # can happen is some extra characters will remain in
# the font # the font
sel = sel.partition(':')[0] sel = sel.partition(':')[0]

View File

@ -144,7 +144,7 @@ class MergeMetadata:
self.oeb.guide.remove('cover') self.oeb.guide.remove('cover')
self.oeb.guide.remove('titlepage') self.oeb.guide.remove('titlepage')
elif self.oeb.plumber_output_format in {'mobi', 'azw3'} and old_cover is not None: elif self.oeb.plumber_output_format in {'mobi', 'azw3'} and old_cover is not None:
# The amazon formats dont support html cover pages, so remove them # The amazon formats don't support html cover pages, so remove them
# even if no cover was specified. # even if no cover was specified.
self.oeb.guide.remove('titlepage') self.oeb.guide.remove('titlepage')
do_remove_old_cover = False do_remove_old_cover = False

View File

@ -214,7 +214,7 @@ class SubsetFonts:
for sel in rule.selectorList: for sel in rule.selectorList:
sel = sel.selectorText sel = sel.selectorText
if sel and sel.startswith('.'): if sel and sel.startswith('.'):
# We dont care about pseudo-selectors as the worst that # We don't care about pseudo-selectors as the worst that
# can happen is some extra characters will remain in # can happen is some extra characters will remain in
# the font # the font
sel = sel.partition(':')[0] sel = sel.partition(':')[0]

View File

@ -836,7 +836,7 @@ def fonts_are_identical(fonts):
def merge_font_files(fonts, log): def merge_font_files(fonts, log):
# As of Qt 5.15.1 Chromium has switched to harfbuzz and dropped sfntly. It # As of Qt 5.15.1 Chromium has switched to harfbuzz and dropped sfntly. It
# now produces font descriptors whose W arrays dont match the glyph width # now produces font descriptors whose W arrays don't match the glyph width
# information from the hhea table, in contravention of the PDF spec. So # information from the hhea table, in contravention of the PDF spec. So
# we can no longer merge font descriptors, all we can do is merge the # we can no longer merge font descriptors, all we can do is merge the
# actual sfnt data streams into a single stream and subset it to contain # actual sfnt data streams into a single stream and subset it to contain
@ -1013,7 +1013,7 @@ def add_header_footer(manager, opts, pdf_doc, container, page_number_display_map
toplevel_toc_map = stack_to_map(create_toc_stack(tc())) toplevel_toc_map = stack_to_map(create_toc_stack(tc()))
toplevel_pagenum_map, toplevel_pages_map = page_counts_map(tc()) toplevel_pagenum_map, toplevel_pages_map = page_counts_map(tc())
dpi = 96 # dont know how to query Qt for this, seems to be the same on all platforms dpi = 96 # don't know how to query Qt for this, seems to be the same on all platforms
def pt_to_px(pt): return int(pt * dpi / 72) def pt_to_px(pt): return int(pt * dpi / 72)
def create_container(page_num, margins): def create_container(page_num, margins):

View File

@ -1628,7 +1628,7 @@ def ensure_app(headless=True):
# unhandled python exception in a slot or virtual method. Since ensure_app() # unhandled python exception in a slot or virtual method. Since ensure_app()
# is used in worker processes for background work like rendering html # is used in worker processes for background work like rendering html
# or running a headless browser, we circumvent this as I really # or running a headless browser, we circumvent this as I really
# dont feel like going through all the code and making sure no # don't feel like going through all the code and making sure no
# unhandled exceptions ever occur. All the actual GUI apps already # unhandled exceptions ever occur. All the actual GUI apps already
# override sys.excepthook with a proper error handler. # override sys.excepthook with a proper error handler.
sys.excepthook = simple_excepthook sys.excepthook = simple_excepthook

View File

@ -269,7 +269,7 @@ class InterfaceAction(QObject):
else: else:
self.shortcut_action_for_context_menu = shortcut_action self.shortcut_action_for_context_menu = shortcut_action
if ismacos: if ismacos:
# In Qt 5 keyboard shortcuts dont work unless the # In Qt 5 keyboard shortcuts don't work unless the
# action is explicitly added to the main window # action is explicitly added to the main window
self.gui.addAction(shortcut_action) self.gui.addAction(shortcut_action)
@ -338,7 +338,7 @@ class InterfaceAction(QObject):
shortcut_name, default_keys=keys, shortcut_name, default_keys=keys,
action=ac, description=description, group=self.action_spec[0], action=ac, description=description, group=self.action_spec[0],
persist_shortcut=persist_shortcut) persist_shortcut=persist_shortcut)
# In Qt 5 keyboard shortcuts dont work unless the # In Qt 5 keyboard shortcuts don't work unless the
# action is explicitly added to the main window and on OSX and # action is explicitly added to the main window and on OSX and
# Unity since the menu might be exported, the shortcuts won't work # Unity since the menu might be exported, the shortcuts won't work
self.gui.addAction(ac) self.gui.addAction(ac)

View File

@ -62,7 +62,7 @@ class SortByAction(InterfaceAction):
m.aboutToShow.connect(self.about_to_show_menu) m.aboutToShow.connect(self.about_to_show_menu)
# self.qaction.triggered.connect(self.show_menu) # self.qaction.triggered.connect(self.show_menu)
# Create a "hidden" menu that can have a shortcut. This also lets us # Create a "hidden" menu that can have a shortcut. This also let's us
# manually show the menu instead of letting Qt do it to work around a # manually show the menu instead of letting Qt do it to work around a
# problem where Qt can show the menu on the wrong screen. # problem where Qt can show the menu on the wrong screen.
self.hidden_menu = QMenu() self.hidden_menu = QMenu()

View File

@ -520,7 +520,7 @@ class CoverSettingsWidget(QWidget):
def restore_defaults(self): def restore_defaults(self):
defaults = self.original_prefs.defaults.copy() defaults = self.original_prefs.defaults.copy()
# Dont delete custom color themes when restoring defaults # Don't delete custom color themes when restoring defaults
defaults['color_themes'] = self.custom_colors defaults['color_themes'] = self.custom_colors
self.apply_prefs(defaults) self.apply_prefs(defaults)
self.update_preview() self.update_preview()

View File

@ -491,7 +491,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
python_context_object=None, dialog_number=None, kwargs=None, python_context_object=None, dialog_number=None, kwargs=None,
formatter=SafeFormat, icon_dir='cc_icons'): formatter=SafeFormat, icon_dir='cc_icons'):
# If dialog_number isn't None then we want separate non-modal windows # If dialog_number isn't None then we want separate non-modal windows
# that don't stay on top of the main dialog. This lets Alt-Tab work to # that don't stay on top of the main dialog. This let's Alt-Tab work to
# switch between them. dialog_number must be set only by the template # switch between them. dialog_number must be set only by the template
# tester, not the rules dialogs etc that depend on modality. # tester, not the rules dialogs etc that depend on modality.

View File

@ -160,14 +160,14 @@ def send_mails(jobnames, callback, attachments, to_s, subjects,
# #
# And since this email is only going to be processed by automated # And since this email is only going to be processed by automated
# services, make the subject+text random too as at least the amazon # services, make the subject+text random too as at least the amazon
# service can't handle non-ascii text. I dont know what baboons # service can't handle non-ascii text. I don't know what baboons
# these companies employ to write their code. It's the height of # these companies employ to write their code. It's the height of
# irony that they are called "tech" companies. # irony that they are called "tech" companies.
# https://bugs.launchpad.net/calibre/+bug/1989282 # https://bugs.launchpad.net/calibre/+bug/1989282
from calibre.utils.short_uuid import uuid4 from calibre.utils.short_uuid import uuid4
if not is_for_kindle(to): if not is_for_kindle(to):
# Amazon nowadays reads metadata from attachment filename instead of # Amazon nowadays reads metadata from attachment filename instead of
# file internal metadata so dont nuke the filename. # file internal metadata so don't nuke the filename.
# https://www.mobileread.com/forums/showthread.php?t=349290 # https://www.mobileread.com/forums/showthread.php?t=349290
aname = f'{uuid4()}.' + aname.rpartition('.')[-1] aname = f'{uuid4()}.' + aname.rpartition('.')[-1]
subject = uuid4() subject = uuid4()

View File

@ -392,7 +392,7 @@ class VLTabs(QTabBar): # {{{
def tab_close(self, index): def tab_close(self, index):
vl = str(self.tabData(index) or '') vl = str(self.tabData(index) or '')
if vl: # Dont allow closing the All Books tab if vl: # Don't allow closing the All Books tab
self.current_db.new_api.set_pref('virt_libs_hidden', list( self.current_db.new_api.set_pref('virt_libs_hidden', list(
self.current_db.new_api.pref('virt_libs_hidden', ())) + [vl]) self.current_db.new_api.pref('virt_libs_hidden', ())) + [vl])
self.removeTab(index) self.removeTab(index)

View File

@ -646,7 +646,7 @@ class CoverDelegate(QStyledItemDelegate):
if self.title_height != 0: if self.title_height != 0:
self.paint_title(painter, trect, db, book_id) self.paint_title(painter, trect, db, book_id)
if self.emblem_size > 0: if self.emblem_size > 0:
# We dont draw embossed emblems as the ondevice/marked emblems are drawn in the gutter # We don't draw embossed emblems as the ondevice/marked emblems are drawn in the gutter
return return
if marked: if marked:
try: try:
@ -1163,7 +1163,7 @@ class GridView(QListView):
self.thumbnail_cache.set_database(newdb) self.thumbnail_cache.set_database(newdb)
try: try:
# Use a timeout so that if, for some reason, the render thread # Use a timeout so that if, for some reason, the render thread
# gets stuck, we dont deadlock, future covers won't get # gets stuck, we don't deadlock, future covers won't get
# rendered, but this is better than a deadlock # rendered, but this is better than a deadlock
join_with_timeout(self.delegate.render_queue) join_with_timeout(self.delegate.render_queue)
except RuntimeError: except RuntimeError:

View File

@ -243,7 +243,7 @@ class BooksModel(QAbstractTableModel): # {{{
self.bool_yes_icon = QIcon.ic('ok.png').pixmap(icon_height) self.bool_yes_icon = QIcon.ic('ok.png').pixmap(icon_height)
self.bool_no_icon = QIcon.ic('list_remove.png').pixmap(icon_height) self.bool_no_icon = QIcon.ic('list_remove.png').pixmap(icon_height)
self.bool_blank_icon = QIcon.ic('blank.png').pixmap(icon_height) self.bool_blank_icon = QIcon.ic('blank.png').pixmap(icon_height)
# Qt auto-scales marked icon correctly, so we dont need to do it (and # Qt auto-scales marked icon correctly, so we don't need to do it (and
# remember that the cover grid view needs a larger version of the icon, # remember that the cover grid view needs a larger version of the icon,
# anyway) # anyway)
self.marked_icon = QIcon.ic('marked.png') self.marked_icon = QIcon.ic('marked.png')

View File

@ -164,7 +164,7 @@ class PreserveViewState: # {{{
''' '''
Save the set of selected books at enter time. If at exit time there are no Save the set of selected books at enter time. If at exit time there are no
selected books, restore the previous selection, the previous current index selected books, restore the previous selection, the previous current index
and dont affect the scroll position. and don't affect the scroll position.
''' '''
def __init__(self, view, preserve_hpos=True, preserve_vpos=True, require_selected_ids=True): def __init__(self, view, preserve_hpos=True, preserve_vpos=True, require_selected_ids=True):

View File

@ -253,7 +253,7 @@ def get_notifier(systray=None):
if not ans.ok: if not ans.ok:
ans = DummyNotifier() ans = DummyNotifier()
else: else:
# We dont use Qt's systray based notifier as it uses Growl and is # We don't use Qt's systray based notifier as it uses Growl and is
# broken with different versions of Growl # broken with different versions of Growl
ans = DummyNotifier() ans = DummyNotifier()
elif iswindows: elif iswindows:

View File

@ -965,7 +965,7 @@ QRect PictureFlowPrivate::renderSlide(const SlideInfo &slide, int alpha, int col
if(column < 0) if(column < 0)
continue; continue;
if (preserveAspectRatio && !slide_moving_to_center) { if (preserveAspectRatio && !slide_moving_to_center) {
// We dont want a black border at the edge of narrow images when the images are in the left or right stacks // We don't want a black border at the edge of narrow images when the images are in the left or right stacks
if (slide.slideIndex < centerIndex) { if (slide.slideIndex < centerIndex) {
column = qMin(column + img_offset, sw - 1); column = qMin(column + img_offset, sw - 1);
} else if (slide.slideIndex == centerIndex) { } else if (slide.slideIndex == centerIndex) {

View File

@ -290,7 +290,7 @@ void CalibreStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *
const QStyleOptionViewItem *vopt = NULL; const QStyleOptionViewItem *vopt = NULL;
switch (element) { switch (element) {
case PE_FrameTabBarBase: // {{{ case PE_FrameTabBarBase: // {{{
// dont draw line below tabs in dark mode as it looks bad // don't draw line below tabs in dark mode as it looks bad
if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) { if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
if (tbb->shape == QTabBar::RoundedNorth) { if (tbb->shape == QTabBar::RoundedNorth) {
QColor bg = option->palette.color(QPalette::Window); QColor bg = option->palette.color(QPalette::Window);

View File

@ -107,7 +107,7 @@ class CalibreStyle : public QProxyStyle {
/*! /*!
\class QProgressIndicator \class QProgressIndicator
\brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way. \brief The QProgressIndicator class let's an application display a progress indicator to show that a lengthy task is under way.
Progress indicators are indeterminate and do nothing more than spin to show that the application is busy. Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
\sa QProgressBar \sa QProgressBar

View File

@ -80,7 +80,7 @@ def beautify_text(raw, syntax):
log.setLevel(logging.WARN) log.setLevel(logging.WARN)
log.raiseExceptions = False log.raiseExceptions = False
parser = CSSParser(loglevel=logging.WARNING, parser = CSSParser(loglevel=logging.WARNING,
# We dont care about @import rules # We don't care about @import rules
fetcher=lambda x: (None, None), log=_css_logger) fetcher=lambda x: (None, None), log=_css_logger)
data = parser.parseString(raw, href='<string>', validate=False) data = parser.parseString(raw, href='<string>', validate=False)
return serialize(data, 'text/css').decode('utf-8') return serialize(data, 'text/css').decode('utf-8')

View File

@ -46,7 +46,7 @@ from polyglot.builtins import codepoint_to_chr, iteritems, itervalues
def string_length(x): def string_length(x):
return strlen(str(x)) # Needed on narrow python builds, as subclasses of unicode dont work return strlen(str(x)) # Needed on narrow python builds, as subclasses of unicode don't work
KEY = Qt.Key.Key_J KEY = Qt.Key.Key_J

View File

@ -877,7 +877,7 @@ class TextEdit(PlainTextEdit):
c = self.textCursor() c = self.textCursor()
left = min(c.anchor(), c.position()) left = min(c.anchor(), c.position())
right = max(c.anchor(), c.position()) right = max(c.anchor(), c.position())
# For speed we use QPlainTextEdit's toPlainText as we dont care about # For speed we use QPlainTextEdit's toPlainText as we don't care about
# spaces in this context # spaces in this context
raw = str(QPlainTextEdit.toPlainText(self)) raw = str(QPlainTextEdit.toPlainText(self))
# Make sure the left edge is not within a <> # Make sure the left edge is not within a <>

View File

@ -1346,7 +1346,7 @@ def get_search_function(state):
ans = state['replace'] ans = state['replace']
is_regex = state['mode'] not in ('normal', 'fuzzy') is_regex = state['mode'] not in ('normal', 'fuzzy')
if not is_regex: if not is_regex:
# We dont want backslash escape sequences interpreted in normal mode # We don't want backslash escape sequences interpreted in normal mode
return lambda m: ans return lambda m: ans
if state['mode'] == 'function': if state['mode'] == 'function':
try: try:

View File

@ -862,7 +862,7 @@ class LibraryPage(QWizardPage, LibraryUI):
os.rmdir(dln) os.rmdir(dln)
except Exception: except Exception:
pass pass
# dont leave behind any empty dirs # don't leave behind any empty dirs
for x in self.made_dirs: for x in self.made_dirs:
with suppress(OSError): with suppress(OSError):
os.rmdir(x) os.rmdir(x)

View File

@ -3888,7 +3888,7 @@ class CatalogBuilder:
if zf is not None: if zf is not None:
# Ensure that the read succeeded # Ensure that the read succeeded
# If we failed to open the zip file for reading, # If we failed to open the zip file for reading,
# we dont know if it contained the thumb or not # we don't know if it contained the thumb or not
zf = _open_archive('a') zf = _open_archive('a')
if zf is not None: if zf is not None:
with zf: with zf:

View File

@ -200,7 +200,7 @@ class DigestAuth: # {{{
def validate_request(self, pw, data, log=None): def validate_request(self, pw, data, log=None):
# We should also be checking for replay attacks by using nonce_count, # We should also be checking for replay attacks by using nonce_count,
# however, various HTTP clients, most prominently Firefox dont # however, various HTTP clients, most prominently Firefox don't
# implement nonce-counts correctly, so we cannot do the check. # implement nonce-counts correctly, so we cannot do the check.
# https://bugzil.la/114451 # https://bugzil.la/114451
path = parse_uri(self.uri.encode('utf-8'))[1] path = parse_uri(self.uri.encode('utf-8'))[1]

View File

@ -541,7 +541,7 @@ def get_data_file(ctx, rd, book_id, relpath, library_id):
def strerr(e: Exception): def strerr(e: Exception):
# Dont leak the filepath in the error response # Don't leak the filepath in the error response
if isinstance(e, OSError): if isinstance(e, OSError):
return e.strerror or str(e) return e.strerror or str(e)
return str(e) return str(e)

View File

@ -256,7 +256,7 @@ class Connection: # {{{
def recv(self, amt): def recv(self, amt):
# If there is data in the read buffer we have to return only that, # If there is data in the read buffer we have to return only that,
# since we dont know if the socket has signalled it is ready for # since we don't know if the socket has signalled it is ready for
# reading # reading
if self.read_buffer.has_data: if self.read_buffer.has_data:
return self.read_buffer.read(amt) return self.read_buffer.read(amt)

View File

@ -233,7 +233,7 @@ class GroupedSearchTerms:
def __init__(self, src): def __init__(self, src):
self.keys = frozenset(src) self.keys = frozenset(src)
self.hash = hash(self.keys) self.hash = hash(self.keys)
# We dont need to store values since this is used as part of a key for # We don't need to store values since this is used as part of a key for
# a cache and if the values have changed the cache will be invalidated # a cache and if the values have changed the cache will be invalidated
# for other reasons anyway (last_modified() will have changed on the # for other reasons anyway (last_modified() will have changed on the
# db) # db)

View File

@ -295,7 +295,7 @@ class Router:
if x: if x:
k, v = x.partition('=')[::2] k, v = x.partition('=')[::2]
if k: if k:
# Since we only set simple hex encoded cookies, we dont # Since we only set simple hex encoded cookies, we don't
# need more sophisticated value parsing # need more sophisticated value parsing
c[k] = v.strip('"') c[k] = v.strip('"')

View File

@ -31,7 +31,7 @@ class ModernHTTPSHandler(HTTPSHandler):
class Browser(B): class Browser(B):
''' '''
A cloneable mechanize browser. Useful for multithreading. The idea is that A clonable mechanize browser. Useful for multithreading. The idea is that
each thread has a browser clone. Every clone uses the same thread safe each thread has a browser clone. Every clone uses the same thread safe
cookie jar. All clones share the same browser configuration. cookie jar. All clones share the same browser configuration.

View File

@ -153,7 +153,7 @@ class WindowsFileCopier:
except OSError as err: except OSError as err:
# Ignore dir not empty errors. Should never happen but we # Ignore dir not empty errors. Should never happen but we
# ignore it as the UNIX semantics are to not delete folders # ignore it as the UNIX semantics are to not delete folders
# during __exit__ anyway and we dont want to leak the handle. # during __exit__ anyway and we don't want to leak the handle.
if err.winerror != winutil.ERROR_DIR_NOT_EMPTY: if err.winerror != winutil.ERROR_DIR_NOT_EMPTY:
raise raise
h.close() h.close()

View File

@ -222,7 +222,7 @@ def case_preserving_open_file(path, mode='wb', mkdir_mode=0o777):
try: try:
candidates = [c for c in os.listdir(cpath) if c.lower() == cl] candidates = [c for c in os.listdir(cpath) if c.lower() == cl]
except: except:
# Dont have permission to do the listdir, assume the case is # Don't have permission to do the listdir, assume the case is
# correct as we have no way to check it. # correct as we have no way to check it.
pass pass
else: else:

View File

@ -315,8 +315,8 @@ class FontScanner(Thread):
self.reload_cache() self.reload_cache()
if isworker: if isworker:
# Dont scan font files in worker processes, use whatever is # Don't scan font files in worker processes, use whatever is
# cached. Font files typically dont change frequently enough to # cached. Font files typically don't change frequently enough to
# justify a rescan in a worker process. # justify a rescan in a worker process.
self.build_families() self.build_families()
return return

View File

@ -374,7 +374,7 @@ icu_Collator_contractions(icu_Collator *self, PyObject *args) {
if (pbuf == NULL) { Py_DECREF(ans); ans = NULL; goto end; } if (pbuf == NULL) { Py_DECREF(ans); ans = NULL; goto end; }
PyTuple_SetItem(ans, i, pbuf); PyTuple_SetItem(ans, i, pbuf);
} else { } else {
// Ranges dont make sense for contractions, ignore them // Ranges don't make sense for contractions, ignore them
PyTuple_SetItem(ans, i, Py_None); Py_INCREF(Py_None); PyTuple_SetItem(ans, i, Py_None); Py_INCREF(Py_None);
} }
} }

View File

@ -248,7 +248,7 @@ class INotifyTreeWatcher(INotify):
raise NoSuchDir(f'The dir {base} does not exist') raise NoSuchDir(f'The dir {base} does not exist')
return return
if e.errno == errno.EACCES: if e.errno == errno.EACCES:
# We silently ignore entries for which we dont have permission, # We silently ignore entries for which we don't have permission,
# unless they are the top level dir # unless they are the top level dir
if top_level: if top_level:
raise NoSuchDir(f'You do not have permission to monitor {base}') raise NoSuchDir(f'You do not have permission to monitor {base}')
@ -293,7 +293,7 @@ class INotifyTreeWatcher(INotify):
def process_event(self, wd, mask, cookie, name): def process_event(self, wd, mask, cookie, name):
if wd == -1 and (mask & self.Q_OVERFLOW): if wd == -1 and (mask & self.Q_OVERFLOW):
# We missed some INOTIFY events, so we dont # We missed some INOTIFY events, so we don't
# know the state of any tracked dirs. # know the state of any tracked dirs.
self.watch_tree() self.watch_tree()
self.modified.add(None) self.modified.add(None)

View File

@ -202,7 +202,7 @@ class IP_ADAPTER_ADDRESSES(ctypes.Structure):
('Dhcpv6ClientDuid', ctypes.c_ubyte * MAX_DHCPV6_DUID_LENGTH), ('Dhcpv6ClientDuid', ctypes.c_ubyte * MAX_DHCPV6_DUID_LENGTH),
('Dhcpv6ClientDuidLength', wintypes.ULONG), ('Dhcpv6ClientDuidLength', wintypes.ULONG),
('Dhcpv6Iaid', wintypes.ULONG), ('Dhcpv6Iaid', wintypes.ULONG),
# Vista SP1 and later, so we comment it out as we dont need it # Vista SP1 and later, so we comment it out as we don't need it
# ('FirstDnsSuffix', ctypes.POINTER(IP_ADAPTER_DNS_SUFFIX)), # ('FirstDnsSuffix', ctypes.POINTER(IP_ADAPTER_DNS_SUFFIX)),
] ]

View File

@ -113,8 +113,8 @@ history_length(2000) #value of -1 means no limit
if not os.path.exists(ipydir): if not os.path.exists(ipydir):
os.makedirs(ipydir) os.makedirs(ipydir)
conf = os.path.join(ipydir, 'pyreadline.txt') conf = os.path.join(ipydir, 'pyreadline.txt')
hist = os.path.join(ipydir, 'history.txt') history = os.path.join(ipydir, 'history.txt')
config = config % hist config = config % history
with open(conf, 'wb') as f: with open(conf, 'wb') as f:
f.write(config.encode('utf-8')) f.write(config.encode('utf-8'))
pyreadline.rlmain.config_path = conf pyreadline.rlmain.config_path = conf

View File

@ -134,7 +134,7 @@ def delete_tree(path, permanent=False):
try: try:
# For completely mysterious reasons, sometimes a file is left open # For completely mysterious reasons, sometimes a file is left open
# leading to access errors. If we get an exception, wait and hope # leading to access errors. If we get an exception, wait and hope
# that whatever has the file (Antivirus, DropBox?) lets go of it. # that whatever has the file (Antivirus, DropBox?) let's go of it.
shutil.rmtree(path) shutil.rmtree(path)
except: except:
import traceback import traceback

View File

@ -43,7 +43,7 @@ it's *much* faster (see below). It's also much smaller than the CRT
versions code-space-wise. We've also added some simple improvements versions code-space-wise. We've also added some simple improvements
that are super handy (commas in thousands, callbacks at buffer full, that are super handy (commas in thousands, callbacks at buffer full,
for example). Finally, the format strings for MSVC and GCC differ for example). Finally, the format strings for MSVC and GCC differ
for 64-bit integers (among other small things), so this lets you use for 64-bit integers (among other small things), so this let's you use
the same format strings in cross platform code. the same format strings in cross platform code.
It uses the standard single file trick of being both the header file It uses the standard single file trick of being both the header file

View File

@ -293,7 +293,7 @@ def _EndRecData(fpin):
endrec = list(struct.unpack(structEndArchive, recData)) endrec = list(struct.unpack(structEndArchive, recData))
comment = data[start+sizeEndCentDir:] comment = data[start+sizeEndCentDir:]
# check that comment length is correct # check that comment length is correct
# Kovid: Added == 0 check as some zip files apparently dont set this # Kovid: Added == 0 check as some zip files apparently don't set this
if endrec[_ECD_COMMENT_SIZE] == 0 or endrec[_ECD_COMMENT_SIZE] == len(comment): if endrec[_ECD_COMMENT_SIZE] == 0 or endrec[_ECD_COMMENT_SIZE] == len(comment):
# Append the archive comment and start offset # Append the archive comment and start offset
endrec.append(comment) endrec.append(comment)

View File

@ -457,7 +457,7 @@ def create_search_panel(container):
)) ))
# Build search input # Build search input
# We dont focus the search box because on mobile that will cause the # We don't focus the search box because on mobile that will cause the
# keyboard to popup and obscure the rest of the page # keyboard to popup and obscure the rest of the page
search_container = component(container, 'search') search_container = component(container, 'search')
search_button = create_button(_('Search'), icon='search', tooltip=_('Do the search')) search_button = create_button(_('Search'), icon='search', tooltip=_('Do the search'))

View File

@ -176,7 +176,7 @@ def create_wrapper_function(wrapper_elem, r, intersecting_wrappers, process_wrap
end_node = current_wrapper end_node = current_wrapper
end_offset = 1 end_offset = 1
if current_range.collapsed: if current_range.collapsed:
# Dont wrap empty ranges. This is needed otherwise two adjacent # Don't wrap empty ranges. This is needed otherwise two adjacent
# selections of text will incorrectly be detected as overlapping. # selections of text will incorrectly be detected as overlapping.
# For example: highlight abc then def in the word abcdef here the # For example: highlight abc then def in the word abcdef here the
# second highlight's first range is the collapsed range at the end # second highlight's first range is the collapsed range at the end

View File

@ -105,7 +105,7 @@ def find_offset_for_point(x, y, node, cdoc):
return v'[child, offset_in_text_node(child, range_, x, y)]' return v'[child, offset_in_text_node(child, range_, x, y)]'
child = child.nextSibling child = child.nextSibling
# The point must be after the last bit of text/in the padding/border, we dont know # The point must be after the last bit of text/in the padding/border, we don't know
# how to get a good point in this case # how to get a good point in this case
return None, None return None, None
@ -304,7 +304,7 @@ def node_for_text_offset(nodes, offset, first_node):
return node, offset, True return node, offset, True
last_text_node = node last_text_node = node
offset -= l offset -= l
# mathml nodes dont have dataset # mathml nodes don't have dataset
elif node.nodeType is Node.ELEMENT_NODE and node.dataset?.calibreRangeWrapper: elif node.nodeType is Node.ELEMENT_NODE and node.dataset?.calibreRangeWrapper:
qn, offset, ok = node_for_text_offset(unwrapped_nodes(node), offset) qn, offset, ok = node_for_text_offset(unwrapped_nodes(node), offset)
if ok: if ok:
@ -524,7 +524,7 @@ def at(x, y, doc): # {{{
# has large margins/padding (e.g. in fullscreen mode) # has large margins/padding (e.g. in fullscreen mode)
# A possible solution for this is to wrap all text node # A possible solution for this is to wrap all text node
# children of body in <span> but that is seriously ugly and # children of body in <span> but that is seriously ugly and
# might have side effects. Lets do this only if there are lots of # might have side effects. Let's do this only if there are lots of
# books in the wild that actually have text children of body, # books in the wild that actually have text children of body,
# and even in this case it might be better to change the input # and even in this case it might be better to change the input
# plugin to prevent this from happening. # plugin to prevent this from happening.

View File

@ -260,7 +260,7 @@ class IframeBoss:
console.log(f'Unhandled error from external javascript, ignoring: {msg} {script_url} {line_number}') console.log(f'Unhandled error from external javascript, ignoring: {msg} {script_url} {line_number}')
return return
is_internal_error = script_url in ('about:srcdoc', 'userscript:viewer.js') is_internal_error = script_url in ('about:srcdoc', 'userscript:viewer.js')
if is_internal_error: # dont report errors from scripts in the book itself if is_internal_error: # don't report errors from scripts in the book itself
console.log(f'{script_url}: {error_object}') console.log(f'{script_url}: {error_object}')
try: try:
fname = script_url.rpartition('/')[-1] or script_url fname = script_url.rpartition('/')[-1] or script_url

Some files were not shown because too many files have changed in this diff Show More