mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
add 'code' dictionary to codespell setting
This commit is contained in:
parent
d176b3a7cf
commit
b0d58ade70
@ -55,10 +55,10 @@ def binary_includes():
|
||||
get_dll_path('bz2', 2), j(PREFIX, 'lib', 'libunrar.so'),
|
||||
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
|
||||
# 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.
|
||||
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html (The current
|
||||
# debian stable libstdc++ is libstdc++.so.6.0.17)
|
||||
|
@ -13,10 +13,10 @@ entitlements = {
|
||||
# MAP_JIT is used by libpcre which is bundled with Qt
|
||||
'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,
|
||||
|
||||
# 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.
|
||||
'com.apple.security.cs.allow-dyld-environment-variables': True,
|
||||
|
||||
|
@ -346,7 +346,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
return write_bytes(pipe, echo_sz, echo_buf) ? 0 : 1;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -5,16 +5,16 @@
|
||||
<SummaryInformation Keywords="Installer" Description="{app} Installer" Manufacturer="Kovid Goyal" />
|
||||
|
||||
<!-- 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) -->
|
||||
<Property Id="MSIFASTINSTALL" Value="3" />
|
||||
|
||||
<Media Id="1" Cabinet="{app}.cab" CompressionLevel="{compression}" EmbedCab="yes" />
|
||||
<!-- 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
|
||||
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
|
||||
should always result in a consistent set of files being present in the
|
||||
installation folder, though of course, with Microsoft there are no
|
||||
|
@ -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
|
||||
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
|
||||
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
|
||||
|
@ -43,7 +43,7 @@ You can download the Hello World plugin from
|
||||
: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
|
||||
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 User Interface plugin
|
||||
|
@ -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
|
||||
: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
|
||||
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
|
||||
selected them in, useful, for instance to rename all images by the order
|
||||
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
|
||||
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
|
||||
or stylesheet by simply entering the file name into the box for the new 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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -153,7 +153,7 @@ are processed in the order in which they appear in the book. See
|
||||
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
|
||||
``<h1 id="someid">Some Text</h1>``. We will auto-generate an HTML Table of
|
||||
Contents based on these headings. Create the custom function below:
|
||||
|
@ -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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -138,7 +138,7 @@ This can be removed by adding::
|
||||
|
||||
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 }'
|
||||
|
||||
|
@ -14,7 +14,7 @@ from calibre.utils.config import JSONConfig
|
||||
# Remember that this name (i.e. plugins/interface_demo) is also
|
||||
# in a global namespace, so make it as unique as possible.
|
||||
# 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')
|
||||
|
||||
# Set defaults
|
||||
|
@ -140,7 +140,7 @@ class DemoDialog(QDialog):
|
||||
set_metadata(ffile, mi, fmt)
|
||||
ffile.seek(0)
|
||||
# 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.
|
||||
db.add_format(book_id, fmt, ffile, run_hooks=False)
|
||||
|
||||
|
@ -22,7 +22,7 @@ class InterfacePlugin(InterfaceAction):
|
||||
name = 'Interface Plugin Demo'
|
||||
|
||||
# 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
|
||||
# keyboard shortcuts, so try to use an unusual/unused shortcut.
|
||||
action_spec = ('Interface Plugin Demo', None,
|
||||
|
@ -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.
|
||||
|
||||
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?
|
||||
-----------------------------------------------------------------------------------------------------
|
||||
|
@ -474,7 +474,7 @@ In `TPM`, using ``{`` and ``}`` characters in string literals can lead to errors
|
||||
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:
|
||||
|
||||
@ -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 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:
|
||||
|
||||
|
@ -87,6 +87,7 @@ builtin = [
|
||||
'clear',
|
||||
'rare',
|
||||
'informal',
|
||||
'code',
|
||||
]
|
||||
ignore-words-list = [
|
||||
"alo",
|
||||
@ -108,6 +109,37 @@ ignore-words-list = [
|
||||
"re-used",
|
||||
"re-using",
|
||||
"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 = '*'
|
||||
skip = [
|
||||
|
@ -81,7 +81,7 @@ class BaltimoreSun(BasicNewsRecipe):
|
||||
(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'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 ##
|
||||
(u'BaltTech', u'http://www.baltimoresun.com/business/technology/blog/rss2.0.xml'),
|
||||
|
@ -45,7 +45,7 @@ class epw(BasicNewsRecipe):
|
||||
'/styles/freeissue/public', ''
|
||||
)
|
||||
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'
|
||||
|
||||
feeds = OrderedDict()
|
||||
|
@ -56,7 +56,7 @@ class TheMiamiHerald(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
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
|
||||
br = BasicNewsRecipe.get_browser(self, *a, **kw)
|
||||
br.addheaders = [x for x in br.addheaders if x[0].lower() != 'user-agent']
|
||||
|
@ -285,7 +285,7 @@ auto_connect_to_folder = ''
|
||||
# category. If two books have fields that generate the same collection name,
|
||||
# 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
|
||||
# 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
(function() {
|
||||
"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';
|
||||
|
||||
var break_avoid_block_styles = {
|
||||
|
@ -12,7 +12,7 @@
|
||||
var settings = SETTINGS;
|
||||
|
||||
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.
|
||||
event.stopPropagation();
|
||||
var frac = window.pageYOffset/document.body.scrollHeight;
|
||||
|
@ -580,7 +580,7 @@ class Build(Command):
|
||||
if iswindows or env is self.windows_cross_env:
|
||||
pre_ld_flags = []
|
||||
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
|
||||
cmd += pre_ld_flags + env.ldflags + ext.ldflags + elib + xlib + \
|
||||
['/EXPORT:' + init_symbol_name(ext.name)] + all_objects + ['/OUT:'+dest]
|
||||
@ -623,7 +623,7 @@ class Build(Command):
|
||||
def build_headless(self):
|
||||
from setup.parallel_build import cpu_count
|
||||
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
|
||||
self.info('\n####### Building headless QPA plugin', '#'*7)
|
||||
a = absolutize
|
||||
|
@ -57,7 +57,7 @@ def get_dist(base, which, bitness):
|
||||
|
||||
def shutdown_allowed(which, bitness):
|
||||
# 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.
|
||||
return bitness != 'arm64'
|
||||
|
||||
|
@ -286,7 +286,7 @@ class Translations(POT): # {{{
|
||||
|
||||
def is_po_file_ok(self, x):
|
||||
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.
|
||||
if '_' in bname:
|
||||
return bname.partition('_')[0] in ('pt', 'zh', 'bn')
|
||||
|
@ -45,7 +45,7 @@ class InputProfile(Plugin):
|
||||
type = _('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 '
|
||||
'if you know nothing about the input document.')
|
||||
|
||||
@ -243,7 +243,7 @@ class OutputProfile(Plugin):
|
||||
type = _('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 '
|
||||
'if you want to produce a document intended to be read at a '
|
||||
'computer or on a range of devices.')
|
||||
|
@ -715,7 +715,7 @@ def patch_metadata_plugins(possibly_updated_plugins):
|
||||
if pup is not None:
|
||||
if pup.version > plugin.version and pup.minimum_calibre_version <= numeric_version:
|
||||
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.
|
||||
patches[i].initialize()
|
||||
for i, pup in iteritems(patches):
|
||||
|
@ -2283,7 +2283,7 @@ class DB:
|
||||
|
||||
def remove_trash_formats_dir_if_empty(self, 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)
|
||||
|
||||
def list_trash_entries(self):
|
||||
|
@ -373,7 +373,7 @@ class Cache:
|
||||
mi.format_metadata = FormatMetadata(self, book_id, formats)
|
||||
good_formats = FormatsList(sorted(formats), mi.format_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
|
||||
# all use _proxy_metadata.
|
||||
# mi.book_size = self._field_for('size', book_id, default_value=0)
|
||||
@ -2287,7 +2287,7 @@ class Cache:
|
||||
# We must preserve order.
|
||||
vals = list(vals)
|
||||
# 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
|
||||
try:
|
||||
dex = vals.index(self._get_item_name(field, old_id))
|
||||
|
@ -135,7 +135,7 @@ class Restore(Thread):
|
||||
tdir = TemporaryDirectory('_rlib', dir=basedir)
|
||||
tdir.__enter__()
|
||||
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
|
||||
tdir = TemporaryDirectory('_rlib')
|
||||
|
||||
|
@ -707,7 +707,7 @@ class Parser(SearchQueryParser): # {{{
|
||||
continue
|
||||
if fm['search_terms'] and x not in {'series_sort', 'id'}:
|
||||
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
|
||||
all_locs.add(x)
|
||||
field_metadata[x] = fm
|
||||
|
@ -46,8 +46,8 @@ def get_defaults(spec):
|
||||
|
||||
|
||||
def compare_argspecs(old, new, attr):
|
||||
# We dont compare the names of the non-keyword arguments as they are often
|
||||
# different and they dont affect the usage of the API.
|
||||
# We don't compare the names of the non-keyword arguments as they are often
|
||||
# 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)
|
||||
if not ok:
|
||||
|
@ -188,7 +188,7 @@ def debug(ioreg_to_tmp=False, buf=None, plugins=None,
|
||||
out(' ')
|
||||
if ioreg_to_tmp:
|
||||
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')
|
||||
else:
|
||||
out(ioreg)
|
||||
|
@ -29,7 +29,7 @@
|
||||
* These flags are used to indicate if some or other
|
||||
* device need special treatment. These should be possible
|
||||
* 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
|
||||
/**
|
||||
|
@ -620,7 +620,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
if e.args[0] != EAGAIN and e.args[0] != EINTR:
|
||||
self._close_device_socket()
|
||||
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:
|
||||
self._close_device_socket()
|
||||
raise
|
||||
|
@ -922,7 +922,7 @@ def get_usb_info(usbdev, debug=False): # {{{
|
||||
try:
|
||||
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:
|
||||
# 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)
|
||||
# print(111, langs)
|
||||
for index, name in ((dd.iManufacturer, 'manufacturer'), (dd.iProduct, 'product'), (dd.iSerialNumber, 'serial_number')):
|
||||
|
@ -117,7 +117,7 @@ class HTMLZInput(InputFormatPlugin):
|
||||
if opf:
|
||||
opf_parsed = OPF(opf, basedir=os.getcwd())
|
||||
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.
|
||||
if cover_path:
|
||||
cdata = None
|
||||
|
@ -123,7 +123,7 @@ def read_single_border(parent, edge, XPath, get):
|
||||
pass
|
||||
sz = get(elem, 'w:sz')
|
||||
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:
|
||||
width = min(96, max(2, float(sz))) / 8
|
||||
except (ValueError, TypeError):
|
||||
|
@ -33,7 +33,7 @@ def read_text_border(parent, dest, XPath, get):
|
||||
pass
|
||||
sz = get(elem, 'w:sz')
|
||||
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:
|
||||
# A border of less than 1pt is not rendered by WebKit
|
||||
border_width = min(96, max(8, float(sz))) / 8
|
||||
|
@ -520,7 +520,7 @@ class Convert:
|
||||
if float_spec is None and is_float:
|
||||
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:
|
||||
self.add_block_tag(tagname, html_tag, tag_style, stylizer, float_spec=float_spec)
|
||||
float_spec = None
|
||||
@ -539,7 +539,7 @@ class Convert:
|
||||
self.blocks.start_new_table(html_tag, tag_style)
|
||||
else:
|
||||
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)
|
||||
else:
|
||||
if tagname == 'hr':
|
||||
|
@ -9,7 +9,7 @@ import regex
|
||||
|
||||
class Parser:
|
||||
''' 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.
|
||||
it can be used from multiple threads simultaneously. '''
|
||||
|
||||
|
@ -580,7 +580,7 @@ class LitFile:
|
||||
offset, size = u32(piece), int32(piece[8:])
|
||||
piece = self.read_raw(offset, size)
|
||||
if i == 0:
|
||||
continue # Dont need this piece
|
||||
continue # Don't need this piece
|
||||
elif i == 1:
|
||||
if u32(piece[8:]) != self.entry_chunklen or \
|
||||
u32(piece[12:]) != self.entry_unknown:
|
||||
|
@ -814,7 +814,7 @@ class HTMLConverter:
|
||||
|
||||
collapse_whitespace = 'white-space' not in css or css['white-space'] != 'pre'
|
||||
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()
|
||||
|
||||
def append_text(src):
|
||||
|
@ -637,11 +637,11 @@ class TBSIndexing: # {{{
|
||||
ai, extra, consumed = decode_tbs(byts)
|
||||
byts = byts[consumed:]
|
||||
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')
|
||||
if extra.get(0b1000, None) is not None:
|
||||
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')
|
||||
nsi = self.get_index(psi.index+1)
|
||||
ans.append(
|
||||
@ -675,7 +675,7 @@ class TBSIndexing: # {{{
|
||||
si, extra, consumed = decode_tbs(byts)
|
||||
byts = byts[consumed:]
|
||||
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')
|
||||
si = self.get_index(si)
|
||||
ans.append('The section at the start of this record is:'
|
||||
|
@ -55,7 +55,7 @@ def parse_indx_header(data):
|
||||
ans['ordt_map'] = ''
|
||||
|
||||
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
|
||||
ans['ordt1_raw'] = data[ordt1+4:ordt1+4+ans['oentries']]
|
||||
if ordt2 > 0 and data[ordt2:ordt2+4] == b'ORDT':
|
||||
|
@ -221,7 +221,7 @@ class SecondaryIndexEntry(IndexEntry):
|
||||
tag = self.INDEX_MAP[index]
|
||||
|
||||
# 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(
|
||||
itervalues(self.INDEX_MAP)) else 0, 0, tag]
|
||||
|
||||
|
@ -20,7 +20,7 @@ from calibre.ebooks.mobi.writer2.serializer import Serializer
|
||||
from calibre.utils.filenames import ascii_filename
|
||||
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
|
||||
NULL_INDEX = 0xffffffff
|
||||
|
||||
|
@ -25,7 +25,7 @@ def process_jpegs_for_amazon(data: bytes) -> bytes:
|
||||
img = Image.open(BytesIO(data))
|
||||
if img.format == 'JPEG':
|
||||
# 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
|
||||
has_exif = False
|
||||
if hasattr(img, 'getexif'):
|
||||
|
@ -240,7 +240,7 @@ class Serializer:
|
||||
if tocref.klass == 'periodical':
|
||||
# This is a section node.
|
||||
# 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.
|
||||
itemhref = re.sub(r'article_\d+/', '', itemhref)
|
||||
self.href_offsets[itemhref].append(buf.tell())
|
||||
|
@ -246,7 +246,7 @@ class SkelIndex(Index):
|
||||
def __init__(self, skel_table):
|
||||
self.entries = [
|
||||
(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),
|
||||
'geometry':(s.start_pos, s.length, s.start_pos, s.length),
|
||||
}) 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, '.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'])
|
||||
|
||||
from calibre.gui2.tweak_book.diff.main import main
|
||||
|
@ -500,7 +500,7 @@ class Container(ContainerBase): # {{{
|
||||
# spec requires all text including filenames to be in NFC form.
|
||||
# The proper fix is to implement a VFS that maps between
|
||||
# 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
|
||||
# decoding them anyway, so there should be no mismatch between
|
||||
# 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):
|
||||
# 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)
|
||||
|
||||
def specialize(oeb):
|
||||
|
@ -131,8 +131,8 @@ def filter_by_weight(fonts, val):
|
||||
|
||||
def find_matching_font(fonts, weight='normal', style='normal', stretch='normal'):
|
||||
# See https://www.w3.org/TR/css-fonts-3/#font-style-matching
|
||||
# We dont implement the unicode character range testing
|
||||
# We also dont implement bolder, lighter
|
||||
# We don't implement the unicode character range testing
|
||||
# We also don't implement bolder, lighter
|
||||
for f, q in ((filter_by_stretch, stretch), (filter_by_style, style), (filter_by_weight, weight)):
|
||||
fonts = f(fonts, q)
|
||||
if len(fonts) == 1:
|
||||
|
@ -81,7 +81,7 @@ def pretty_opf(root):
|
||||
try:
|
||||
children = sorted(manifest, key=manifest_key)
|
||||
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):
|
||||
manifest.insert(0, x)
|
||||
|
||||
|
@ -232,7 +232,7 @@ def parse_css(data, fname='<string>', is_declaration=False, decode=None, log_lev
|
||||
if css_preprocessor is not None:
|
||||
data = css_preprocessor(data)
|
||||
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)
|
||||
if is_declaration:
|
||||
data = parser.parseStyle(data, validate=False)
|
||||
|
@ -84,7 +84,7 @@ class CoverManager:
|
||||
|
||||
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:
|
||||
return None
|
||||
|
@ -141,7 +141,7 @@ class EmbedFonts:
|
||||
for sel in rule.selectorList:
|
||||
sel = sel.selectorText
|
||||
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
|
||||
# the font
|
||||
sel = sel.partition(':')[0]
|
||||
|
@ -144,7 +144,7 @@ class MergeMetadata:
|
||||
self.oeb.guide.remove('cover')
|
||||
self.oeb.guide.remove('titlepage')
|
||||
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.
|
||||
self.oeb.guide.remove('titlepage')
|
||||
do_remove_old_cover = False
|
||||
|
@ -214,7 +214,7 @@ class SubsetFonts:
|
||||
for sel in rule.selectorList:
|
||||
sel = sel.selectorText
|
||||
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
|
||||
# the font
|
||||
sel = sel.partition(':')[0]
|
||||
|
@ -836,7 +836,7 @@ def fonts_are_identical(fonts):
|
||||
|
||||
def merge_font_files(fonts, log):
|
||||
# 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
|
||||
# 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
|
||||
@ -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_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 create_container(page_num, margins):
|
||||
|
@ -1628,7 +1628,7 @@ def ensure_app(headless=True):
|
||||
# unhandled python exception in a slot or virtual method. Since ensure_app()
|
||||
# is used in worker processes for background work like rendering html
|
||||
# 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
|
||||
# override sys.excepthook with a proper error handler.
|
||||
sys.excepthook = simple_excepthook
|
||||
|
@ -269,7 +269,7 @@ class InterfaceAction(QObject):
|
||||
else:
|
||||
self.shortcut_action_for_context_menu = shortcut_action
|
||||
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
|
||||
self.gui.addAction(shortcut_action)
|
||||
|
||||
@ -338,7 +338,7 @@ class InterfaceAction(QObject):
|
||||
shortcut_name, default_keys=keys,
|
||||
action=ac, description=description, group=self.action_spec[0],
|
||||
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
|
||||
# Unity since the menu might be exported, the shortcuts won't work
|
||||
self.gui.addAction(ac)
|
||||
|
@ -62,7 +62,7 @@ class SortByAction(InterfaceAction):
|
||||
m.aboutToShow.connect(self.about_to_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
|
||||
# problem where Qt can show the menu on the wrong screen.
|
||||
self.hidden_menu = QMenu()
|
||||
|
@ -520,7 +520,7 @@ class CoverSettingsWidget(QWidget):
|
||||
|
||||
def restore_defaults(self):
|
||||
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
|
||||
self.apply_prefs(defaults)
|
||||
self.update_preview()
|
||||
|
@ -491,7 +491,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
||||
python_context_object=None, dialog_number=None, kwargs=None,
|
||||
formatter=SafeFormat, icon_dir='cc_icons'):
|
||||
# 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
|
||||
# tester, not the rules dialogs etc that depend on modality.
|
||||
|
||||
|
@ -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
|
||||
# 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
|
||||
# irony that they are called "tech" companies.
|
||||
# https://bugs.launchpad.net/calibre/+bug/1989282
|
||||
from calibre.utils.short_uuid import uuid4
|
||||
if not is_for_kindle(to):
|
||||
# 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
|
||||
aname = f'{uuid4()}.' + aname.rpartition('.')[-1]
|
||||
subject = uuid4()
|
||||
|
@ -392,7 +392,7 @@ class VLTabs(QTabBar): # {{{
|
||||
|
||||
def tab_close(self, index):
|
||||
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.pref('virt_libs_hidden', ())) + [vl])
|
||||
self.removeTab(index)
|
||||
|
@ -646,7 +646,7 @@ class CoverDelegate(QStyledItemDelegate):
|
||||
if self.title_height != 0:
|
||||
self.paint_title(painter, trect, db, book_id)
|
||||
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
|
||||
if marked:
|
||||
try:
|
||||
@ -1163,7 +1163,7 @@ class GridView(QListView):
|
||||
self.thumbnail_cache.set_database(newdb)
|
||||
try:
|
||||
# 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
|
||||
join_with_timeout(self.delegate.render_queue)
|
||||
except RuntimeError:
|
||||
|
@ -243,7 +243,7 @@ class BooksModel(QAbstractTableModel): # {{{
|
||||
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_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,
|
||||
# anyway)
|
||||
self.marked_icon = QIcon.ic('marked.png')
|
||||
|
@ -164,7 +164,7 @@ class PreserveViewState: # {{{
|
||||
'''
|
||||
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
|
||||
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):
|
||||
|
@ -253,7 +253,7 @@ def get_notifier(systray=None):
|
||||
if not ans.ok:
|
||||
ans = DummyNotifier()
|
||||
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
|
||||
ans = DummyNotifier()
|
||||
elif iswindows:
|
||||
|
@ -965,7 +965,7 @@ QRect PictureFlowPrivate::renderSlide(const SlideInfo &slide, int alpha, int col
|
||||
if(column < 0)
|
||||
continue;
|
||||
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) {
|
||||
column = qMin(column + img_offset, sw - 1);
|
||||
} else if (slide.slideIndex == centerIndex) {
|
||||
|
@ -290,7 +290,7 @@ void CalibreStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *
|
||||
const QStyleOptionViewItem *vopt = NULL;
|
||||
switch (element) {
|
||||
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 (tbb->shape == QTabBar::RoundedNorth) {
|
||||
QColor bg = option->palette.color(QPalette::Window);
|
||||
|
@ -107,7 +107,7 @@ class CalibreStyle : public QProxyStyle {
|
||||
|
||||
/*!
|
||||
\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.
|
||||
\sa QProgressBar
|
||||
|
@ -80,7 +80,7 @@ def beautify_text(raw, syntax):
|
||||
log.setLevel(logging.WARN)
|
||||
log.raiseExceptions = False
|
||||
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)
|
||||
data = parser.parseString(raw, href='<string>', validate=False)
|
||||
return serialize(data, 'text/css').decode('utf-8')
|
||||
|
@ -46,7 +46,7 @@ from polyglot.builtins import codepoint_to_chr, iteritems, itervalues
|
||||
|
||||
|
||||
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
|
||||
|
@ -877,7 +877,7 @@ class TextEdit(PlainTextEdit):
|
||||
c = self.textCursor()
|
||||
left = min(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
|
||||
raw = str(QPlainTextEdit.toPlainText(self))
|
||||
# Make sure the left edge is not within a <>
|
||||
|
@ -1346,7 +1346,7 @@ def get_search_function(state):
|
||||
ans = state['replace']
|
||||
is_regex = state['mode'] not in ('normal', 'fuzzy')
|
||||
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
|
||||
if state['mode'] == 'function':
|
||||
try:
|
||||
|
@ -862,7 +862,7 @@ class LibraryPage(QWizardPage, LibraryUI):
|
||||
os.rmdir(dln)
|
||||
except Exception:
|
||||
pass
|
||||
# dont leave behind any empty dirs
|
||||
# don't leave behind any empty dirs
|
||||
for x in self.made_dirs:
|
||||
with suppress(OSError):
|
||||
os.rmdir(x)
|
||||
|
@ -3888,7 +3888,7 @@ class CatalogBuilder:
|
||||
if zf is not None:
|
||||
# Ensure that the read succeeded
|
||||
# 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')
|
||||
if zf is not None:
|
||||
with zf:
|
||||
|
@ -200,7 +200,7 @@ class DigestAuth: # {{{
|
||||
|
||||
def validate_request(self, pw, data, log=None):
|
||||
# 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.
|
||||
# https://bugzil.la/114451
|
||||
path = parse_uri(self.uri.encode('utf-8'))[1]
|
||||
|
@ -541,7 +541,7 @@ def get_data_file(ctx, rd, book_id, relpath, library_id):
|
||||
|
||||
|
||||
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):
|
||||
return e.strerror or str(e)
|
||||
return str(e)
|
||||
|
@ -256,7 +256,7 @@ class Connection: # {{{
|
||||
|
||||
def recv(self, amt):
|
||||
# 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
|
||||
if self.read_buffer.has_data:
|
||||
return self.read_buffer.read(amt)
|
||||
|
@ -233,7 +233,7 @@ class GroupedSearchTerms:
|
||||
def __init__(self, src):
|
||||
self.keys = frozenset(src)
|
||||
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
|
||||
# for other reasons anyway (last_modified() will have changed on the
|
||||
# db)
|
||||
|
@ -295,7 +295,7 @@ class Router:
|
||||
if x:
|
||||
k, v = x.partition('=')[::2]
|
||||
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
|
||||
c[k] = v.strip('"')
|
||||
|
||||
|
@ -31,7 +31,7 @@ class ModernHTTPSHandler(HTTPSHandler):
|
||||
|
||||
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
|
||||
cookie jar. All clones share the same browser configuration.
|
||||
|
||||
|
@ -153,7 +153,7 @@ class WindowsFileCopier:
|
||||
except OSError as err:
|
||||
# Ignore dir not empty errors. Should never happen but we
|
||||
# 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:
|
||||
raise
|
||||
h.close()
|
||||
|
@ -222,7 +222,7 @@ def case_preserving_open_file(path, mode='wb', mkdir_mode=0o777):
|
||||
try:
|
||||
candidates = [c for c in os.listdir(cpath) if c.lower() == cl]
|
||||
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.
|
||||
pass
|
||||
else:
|
||||
|
@ -315,8 +315,8 @@ class FontScanner(Thread):
|
||||
self.reload_cache()
|
||||
|
||||
if isworker:
|
||||
# Dont scan font files in worker processes, use whatever is
|
||||
# cached. Font files typically dont change frequently enough to
|
||||
# Don't scan font files in worker processes, use whatever is
|
||||
# cached. Font files typically don't change frequently enough to
|
||||
# justify a rescan in a worker process.
|
||||
self.build_families()
|
||||
return
|
||||
|
@ -374,7 +374,7 @@ icu_Collator_contractions(icu_Collator *self, PyObject *args) {
|
||||
if (pbuf == NULL) { Py_DECREF(ans); ans = NULL; goto end; }
|
||||
PyTuple_SetItem(ans, i, pbuf);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ class INotifyTreeWatcher(INotify):
|
||||
raise NoSuchDir(f'The dir {base} does not exist')
|
||||
return
|
||||
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
|
||||
if top_level:
|
||||
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):
|
||||
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.
|
||||
self.watch_tree()
|
||||
self.modified.add(None)
|
||||
|
@ -202,7 +202,7 @@ class IP_ADAPTER_ADDRESSES(ctypes.Structure):
|
||||
('Dhcpv6ClientDuid', ctypes.c_ubyte * MAX_DHCPV6_DUID_LENGTH),
|
||||
('Dhcpv6ClientDuidLength', 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)),
|
||||
]
|
||||
|
||||
|
@ -113,8 +113,8 @@ history_length(2000) #value of -1 means no limit
|
||||
if not os.path.exists(ipydir):
|
||||
os.makedirs(ipydir)
|
||||
conf = os.path.join(ipydir, 'pyreadline.txt')
|
||||
hist = os.path.join(ipydir, 'history.txt')
|
||||
config = config % hist
|
||||
history = os.path.join(ipydir, 'history.txt')
|
||||
config = config % history
|
||||
with open(conf, 'wb') as f:
|
||||
f.write(config.encode('utf-8'))
|
||||
pyreadline.rlmain.config_path = conf
|
||||
|
@ -134,7 +134,7 @@ def delete_tree(path, permanent=False):
|
||||
try:
|
||||
# For completely mysterious reasons, sometimes a file is left open
|
||||
# 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)
|
||||
except:
|
||||
import traceback
|
||||
|
@ -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
|
||||
that are super handy (commas in thousands, callbacks at buffer full,
|
||||
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.
|
||||
|
||||
It uses the standard single file trick of being both the header file
|
||||
|
@ -293,7 +293,7 @@ def _EndRecData(fpin):
|
||||
endrec = list(struct.unpack(structEndArchive, recData))
|
||||
comment = data[start+sizeEndCentDir:]
|
||||
# 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):
|
||||
# Append the archive comment and start offset
|
||||
endrec.append(comment)
|
||||
|
@ -457,7 +457,7 @@ def create_search_panel(container):
|
||||
))
|
||||
|
||||
# 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
|
||||
search_container = component(container, 'search')
|
||||
search_button = create_button(_('Search'), icon='search', tooltip=_('Do the search'))
|
||||
|
@ -176,7 +176,7 @@ def create_wrapper_function(wrapper_elem, r, intersecting_wrappers, process_wrap
|
||||
end_node = current_wrapper
|
||||
end_offset = 1
|
||||
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.
|
||||
# For example: highlight abc then def in the word abcdef here the
|
||||
# second highlight's first range is the collapsed range at the end
|
||||
|
@ -105,7 +105,7 @@ def find_offset_for_point(x, y, node, cdoc):
|
||||
return v'[child, offset_in_text_node(child, range_, x, y)]'
|
||||
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
|
||||
return None, None
|
||||
|
||||
@ -304,7 +304,7 @@ def node_for_text_offset(nodes, offset, first_node):
|
||||
return node, offset, True
|
||||
last_text_node = node
|
||||
offset -= l
|
||||
# mathml nodes dont have dataset
|
||||
# mathml nodes don't have dataset
|
||||
elif node.nodeType is Node.ELEMENT_NODE and node.dataset?.calibreRangeWrapper:
|
||||
qn, offset, ok = node_for_text_offset(unwrapped_nodes(node), offset)
|
||||
if ok:
|
||||
@ -524,7 +524,7 @@ def at(x, y, doc): # {{{
|
||||
# has large margins/padding (e.g. in fullscreen mode)
|
||||
# A possible solution for this is to wrap all text node
|
||||
# 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,
|
||||
# and even in this case it might be better to change the input
|
||||
# plugin to prevent this from happening.
|
||||
|
@ -260,7 +260,7 @@ class IframeBoss:
|
||||
console.log(f'Unhandled error from external javascript, ignoring: {msg} {script_url} {line_number}')
|
||||
return
|
||||
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}')
|
||||
try:
|
||||
fname = script_url.rpartition('/')[-1] or script_url
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user