From 0b23eaf328bed89358c6737e22f2fab58cf309e4 Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Fri, 24 Jan 2025 11:14:21 +0100 Subject: [PATCH] code indentation (extra-edit) --- recipes/20_minutos.recipe | 13 +- recipes/20minutes.recipe | 3 +- recipes/am730.recipe | 2 +- setup/wincross.py | 3 +- src/calibre/devices/jetbook/driver.py | 22 +-- .../devices/smart_device_app/driver.py | 66 +++---- .../ebooks/conversion/plugins/epub_output.py | 50 ++--- src/calibre/ebooks/lrf/html/color_map.py | 182 +++++++++--------- src/calibre/ebooks/lrf/html/convert_from.py | 44 ++--- src/calibre/ebooks/lrf/lrs/convert_from.py | 18 +- src/calibre/ebooks/metadata/sources/amazon.py | 2 +- src/calibre/ebooks/oeb/polish/embed.py | 4 +- src/calibre/ebooks/oeb/polish/upgrade.py | 88 ++++----- .../ebooks/unihandecode/unicodepoints.py | 146 +++++++------- src/calibre/gui2/library/models.py | 14 +- .../gui2/preferences/create_custom_column.py | 24 +-- .../gui2/store/config/chooser/models.py | 14 +- src/calibre/gui2/store/search/models.py | 18 +- .../gui2/store/stores/mobileread/models.py | 6 +- src/calibre/library/custom_columns.py | 2 +- src/calibre/library/database2.py | 8 +- src/calibre/linux.py | 32 +-- src/calibre/utils/search_query_parser_test.py | 44 ++--- src/odf/namespaces.py | 82 ++++---- src/odf/odf2moinmoin.py | 12 +- src/odf/odf2xhtml.py | 44 ++--- src/odf/opendocument.py | 32 +-- 27 files changed, 486 insertions(+), 489 deletions(-) diff --git a/recipes/20_minutos.recipe b/recipes/20_minutos.recipe index 02e447c633..73698f3390 100644 --- a/recipes/20_minutos.recipe +++ b/recipes/20_minutos.recipe @@ -40,18 +40,17 @@ class AdvancedUserRecipe1294946868(BasicNewsRecipe): ] remove_tags_before = dict(name='ul', attrs={'class': ['servicios-sub']}) - remove_tags_after = dict( - name='div', attrs={'class': ['related-news', 'col']}) + remove_tags_after = dict(name='div', attrs={'class': ['related-news', 'col']}) remove_tags = [ dict(name='ol', attrs={'class': ['navigation', ]}), dict(name='span', attrs={'class': ['action']}), dict(name='div', attrs={'class': ['twitter comments-list hidden', 'related-news', 'col', 'photo-gallery', 'photo-gallery side-art-block', 'calendario', 'article-comment', 'postto estirar', 'otras_vinetas estirar', 'kment', 'user-actions']}), dict( name='div', attrs={'id': ['twitter-destacados', 'eco-tabs', 'inner', 'vineta_calendario', 'vinetistas clearfix', 'otras_vinetas estirar', 'MIN1', 'main', 'SUP1', 'INT']}), dict(name='ul', attrs={'class': ['article-user-actions', 'stripped-list']}), dict(name='ul', attrs={'id': ['site-links']}), dict(name='li', attrs={'class': ['puntuacion', 'enviar', 'compartir']}) # noqa: E501 ] - extra_css = ''' - p{text-align: justify; font-size: 100%} - body{ text-align: left; font-size:100% } - h3{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; } - ''' + extra_css = ''' + p{text-align: justify; font-size: 100%} + body{ text-align: left; font-size:100% } + h3{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; } + ''' preprocess_regexps = [(re.compile( r'', re.DOTALL), lambda m: '')] diff --git a/recipes/20minutes.recipe b/recipes/20minutes.recipe index 0890b6f2c3..4baa4e1cd6 100644 --- a/recipes/20minutes.recipe +++ b/recipes/20minutes.recipe @@ -9,8 +9,7 @@ from calibre.web.feeds.recipes import BasicNewsRecipe def classes(classes): q = frozenset(classes.split(' ')) - return dict(attrs={ - 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}) class Minutes(BasicNewsRecipe): diff --git a/recipes/am730.recipe b/recipes/am730.recipe index f5bf33d378..80d52c1c43 100644 --- a/recipes/am730.recipe +++ b/recipes/am730.recipe @@ -89,7 +89,7 @@ class AM730(BasicNewsRecipe): ('體育','https://www.am730.com.hk/news/%E9%AB%94%E8%82%B2'), ('娛樂','https://www.am730.com.hk/news/%E5%A8%9B%E6%A8%82'), ('旅遊.飲食','https://www.am730.com.hk/news/%E6%97%85%E9%81%8A.%E9%A3%B2%E9%A3%9F') - ] # articles =[] + ] # articles =[] SectionsArticles=[] for (title, url) in Sections: if self.debug: diff --git a/setup/wincross.py b/setup/wincross.py index 00d0ae224d..ccc460169f 100644 --- a/setup/wincross.py +++ b/setup/wincross.py @@ -199,8 +199,7 @@ def download(dest_dir, manifest_version=17, manifest_type='release', manifest_pa pkgs = Packages(manifest, crt_variant, arch) os.makedirs(dest_dir, exist_ok=True) total = sum(x.size for x in pkgs.files_to_download) - print('Downloading', int(total/(1024*1024)), 'MB in', len(pkgs.files_to_download), - 'files...') + print('Downloading', int(total/(1024*1024)), 'MB in', len(pkgs.files_to_download), 'files...') with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor: for _ in executor.map(partial(download_item, dest_dir), pkgs.files_to_download): pass diff --git a/src/calibre/devices/jetbook/driver.py b/src/calibre/devices/jetbook/driver.py index 499ce3ed50..824467daa3 100644 --- a/src/calibre/devices/jetbook/driver.py +++ b/src/calibre/devices/jetbook/driver.py @@ -101,11 +101,11 @@ class MIBUK(USBMS): class JETBOOK_MINI(USBMS): ''' ['0x4b8', - '0x507', - '0x100', - 'ECTACO', - 'ECTACO ATA/ATAPI Bridge (Bulk-Only)', - 'Rev.0.20'] + '0x507', + '0x100', + 'ECTACO', + 'ECTACO ATA/ATAPI Bridge (Bulk-Only)', + 'Rev.0.20'] ''' FORMATS = ['fb2', 'txt'] @@ -126,12 +126,12 @@ class JETBOOK_MINI(USBMS): class JETBOOK_COLOR(USBMS): ''' -set([('0x951', - '0x160b', - '0x0', - 'Freescale', - 'Mass Storage Device', - '0802270905553')]) + set(['0x951', + '0x160b', + '0x0', + 'Freescale', + 'Mass Storage Device', + '0802270905553']) ''' FORMATS = ['epub', 'mobi', 'prc', 'fb2', 'rtf', 'txt', 'pdf', 'djvu'] diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 22196790c9..cae0266fe8 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -291,7 +291,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): '', _('Use fixed network port') + ':::

' + _('If checked, use the port number in the "Port" box, otherwise ' - 'the driver will pick a random port') + '

', + 'the driver will pick a random port') + '

', _('Port number: ') + ':::

' + _('Enter the port number the driver is to use if the "fixed port" box is checked') + '

', _('Print extra debug information') + ':::

' + @@ -300,52 +300,52 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): _('Comma separated list of metadata fields ' 'to turn into collections on the device.') + ':::

' + _('Possibilities include: series, tags, authors, etc' + - '. Three special collections are available: %(abt)s:%(abtv)s, ' - '%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add ' - 'these values to the list to enable them. The collections will be ' - 'given the name provided after the ":" character.')%dict( - abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR, - abs='abs', absv=ALL_BY_SOMETHING), + '. Three special collections are available: %(abt)s:%(abtv)s, ' + '%(aba)s:%(abav)s, and %(abs)s:%(absv)s. Add ' + 'these values to the list to enable them. The collections will be ' + 'given the name provided after the ":" character.')%dict( + abt='abt', abtv=ALL_BY_TITLE, aba='aba', abav=ALL_BY_AUTHOR, + abs='abs', absv=ALL_BY_SOMETHING), '', _('Enable the no-activity timeout') + ':::

' + _('If this box is checked, calibre will automatically disconnect if ' - 'a connected device does nothing for %d minutes. Unchecking this ' - ' box disables this timeout, so calibre will never automatically ' - 'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '

', + 'a connected device does nothing for %d minutes. Unchecking this ' + ' box disables this timeout, so calibre will never automatically ' + 'disconnect.')%(DISCONNECT_AFTER_N_SECONDS/60,) + '

', _('Use this IP address') + ':::

' + _('Use this option if you want to force the driver to listen on a ' - 'particular IP address. The driver will listen only on the ' - 'entered address, and this address will be the one advertised ' - 'over mDNS (BonJour).') + '

', + 'particular IP address. The driver will listen only on the ' + 'entered address, and this address will be the one advertised ' + 'over mDNS (BonJour).') + '

', _('Replace books with same calibre ID') + ':::

' + _('Use this option to overwrite a book on the device if that book ' - 'has the same calibre identifier as the book being sent. The file name of the ' - 'book will not change even if the save template produces a ' - 'different result. Using this option in most cases prevents ' - 'having multiple copies of a book on the device.') + '

', + 'has the same calibre identifier as the book being sent. The file name of the ' + 'book will not change even if the save template produces a ' + 'different result. Using this option in most cases prevents ' + 'having multiple copies of a book on the device.') + '

', _('Cover thumbnail compression quality') + ':::

' + _('Use this option to control the size and quality of the cover ' - 'file sent to the device. It must be between 50 and 99. ' - 'The larger the number the higher quality the cover, but also ' - 'the larger the file. For example, changing this from 70 to 90 ' - 'results in a much better cover that is approximately 2.5 ' - 'times as big. To see the changes you must force calibre ' - 'to resend metadata to the device, either by changing ' - 'the metadata for the book (updating the last modification ' - 'time) or resending the book itself.') + '

', + 'file sent to the device. It must be between 50 and 99. ' + 'The larger the number the higher quality the cover, but also ' + 'the larger the file. For example, changing this from 70 to 90 ' + 'results in a much better cover that is approximately 2.5 ' + 'times as big. To see the changes you must force calibre ' + 'to resend metadata to the device, either by changing ' + 'the metadata for the book (updating the last modification ' + 'time) or resending the book itself.') + '

', _('Use metadata cache') + ':::

' + _('Setting this option allows calibre to keep a copy of metadata ' - 'on the device, speeding up device connections. Unsetting this ' - 'option disables keeping the copy, forcing the device to send ' - 'metadata to calibre on every connect. Unset this option if ' - 'you think that the cache might not be operating correctly.') + '

', + 'on the device, speeding up device connections. Unsetting this ' + 'option disables keeping the copy, forcing the device to send ' + 'metadata to calibre on every connect. Unset this option if ' + 'you think that the cache might not be operating correctly.') + '

', '', _('Additional file extensions to send to the device') + ':::

' + _('This is a comma-separated list of format file extensions you want ' - 'to be able to send to the device. For example, you might have ' - 'audio books in your library with the extension "m4b" that you ' - 'want to listen to on your device. Don\'t worry about the "extra ' - 'enabled extensions" warning.'), + 'to be able to send to the device. For example, you might have ' + 'audio books in your library with the extension "m4b" that you ' + 'want to listen to on your device. Don\'t worry about the "extra ' + 'enabled extensions" warning.'), _('Ignore device free space') + ':::

' + _("Check this box to ignore the amount of free space reported by your " "devices. This might be needed if you store books on an SD card and " diff --git a/src/calibre/ebooks/conversion/plugins/epub_output.py b/src/calibre/ebooks/conversion/plugins/epub_output.py index 5f06404363..d2554bedec 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_output.py +++ b/src/calibre/ebooks/conversion/plugins/epub_output.py @@ -15,31 +15,31 @@ from calibre.ptempfile import TemporaryDirectory from polyglot.builtins import as_bytes block_level_tags = ( - 'address', - 'body', - 'blockquote', - 'center', - 'dir', - 'div', - 'dl', - 'fieldset', - 'form', - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'hr', - 'isindex', - 'menu', - 'noframes', - 'noscript', - 'ol', - 'p', - 'pre', - 'table', - 'ul', + 'address', + 'body', + 'blockquote', + 'center', + 'dir', + 'div', + 'dl', + 'fieldset', + 'form', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'hr', + 'isindex', + 'menu', + 'noframes', + 'noscript', + 'ol', + 'p', + 'pre', + 'table', + 'ul', ) diff --git a/src/calibre/ebooks/lrf/html/color_map.py b/src/calibre/ebooks/lrf/html/color_map.py index 0260fd4ab4..1fc4464256 100644 --- a/src/calibre/ebooks/lrf/html/color_map.py +++ b/src/calibre/ebooks/lrf/html/color_map.py @@ -4,97 +4,97 @@ __copyright__ = '2008, Kovid Goyal ' import re NAME_MAP = { - 'aliceblue': '#F0F8FF', - 'antiquewhite': '#FAEBD7', - 'aqua': '#00FFFF', - 'aquamarine': '#7FFFD4', - 'azure': '#F0FFFF', - 'beige': '#F5F5DC', - 'bisque': '#FFE4C4', - 'black': '#000000', - 'blanchedalmond': '#FFEBCD', - 'blue': '#0000FF', - 'brown': '#A52A2A', - 'burlywood': '#DEB887', - 'cadetblue': '#5F9EA0', - 'chartreuse': '#7FFF00', - 'chocolate': '#D2691E', - 'coral': '#FF7F50', - 'crimson': '#DC143C', - 'cyan': '#00FFFF', - 'darkblue': '#00008B', - 'darkgoldenrod': '#B8860B', - 'darkgreen': '#006400', - 'darkkhaki': '#BDB76B', - 'darkmagenta': '#8B008B', - 'darkolivegreen': '#556B2F', - 'darkorange': '#FF8C00', - 'darkorchid': '#9932CC', - 'darkred': '#8B0000', - 'darksalmon': '#E9967A', - 'darkslateblue': '#483D8B', - 'darkslategrey': '#2F4F4F', - 'darkviolet': '#9400D3', - 'deeppink': '#FF1493', - 'dodgerblue': '#1E90FF', - 'firebrick': '#B22222', - 'floralwhite': '#FFFAF0', - 'forestgreen': '#228B22', - 'fuchsia': '#FF00FF', - 'gainsboro': '#DCDCDC', - 'ghostwhite': '#F8F8FF', - 'gold': '#FFD700', - 'goldenrod': '#DAA520', - 'indianred ': '#CD5C5C', - 'indigo ': '#4B0082', - 'khaki': '#F0E68C', - 'lavenderblush': '#FFF0F5', - 'lawngreen': '#7CFC00', - 'lightblue': '#ADD8E6', - 'lightcoral': '#F08080', - 'lightgoldenrodyellow': '#FAFAD2', - 'lightgray': '#D3D3D3', - 'lightgrey': '#D3D3D3', - 'lightskyblue': '#87CEFA', - 'lightslategrey': '#778899', - 'lightsteelblue': '#B0C4DE', - 'lime': '#87CEFA', - 'linen': '#FAF0E6', - 'magenta': '#FF00FF', - 'maroon': '#800000', - 'mediumaquamarine': '#66CDAA', - 'mediumblue': '#0000CD', - 'mediumorchid': '#BA55D3', - 'mediumpurple': '#9370D8', - 'mediumseagreen': '#3CB371', - 'mediumslateblue': '#7B68EE', - 'midnightblue': '#191970', - 'moccasin': '#FFE4B5', - 'navajowhite': '#FFDEAD', - 'navy': '#000080', - 'oldlace': '#FDF5E6', - 'olive': '#808000', - 'orange': '#FFA500', - 'orangered': '#FF4500', - 'orchid': '#DA70D6', - 'paleturquoise': '#AFEEEE', - 'papayawhip': '#FFEFD5', - 'peachpuff': '#FFDAB9', - 'powderblue': '#B0E0E6', - 'rosybrown': '#BC8F8F', - 'royalblue': '#4169E1', - 'saddlebrown': '#8B4513', - 'sandybrown': '#8B4513', - 'seashell': '#FFF5EE', - 'sienna': '#A0522D', - 'silver': '#C0C0C0', - 'skyblue': '#87CEEB', - 'slategrey': '#708090', - 'snow': '#FFFAFA', - 'springgreen': '#00FF7F', - 'violet': '#EE82EE', - 'yellowgreen': '#9ACD32' - } + 'aliceblue': '#F0F8FF', + 'antiquewhite': '#FAEBD7', + 'aqua': '#00FFFF', + 'aquamarine': '#7FFFD4', + 'azure': '#F0FFFF', + 'beige': '#F5F5DC', + 'bisque': '#FFE4C4', + 'black': '#000000', + 'blanchedalmond': '#FFEBCD', + 'blue': '#0000FF', + 'brown': '#A52A2A', + 'burlywood': '#DEB887', + 'cadetblue': '#5F9EA0', + 'chartreuse': '#7FFF00', + 'chocolate': '#D2691E', + 'coral': '#FF7F50', + 'crimson': '#DC143C', + 'cyan': '#00FFFF', + 'darkblue': '#00008B', + 'darkgoldenrod': '#B8860B', + 'darkgreen': '#006400', + 'darkkhaki': '#BDB76B', + 'darkmagenta': '#8B008B', + 'darkolivegreen': '#556B2F', + 'darkorange': '#FF8C00', + 'darkorchid': '#9932CC', + 'darkred': '#8B0000', + 'darksalmon': '#E9967A', + 'darkslateblue': '#483D8B', + 'darkslategrey': '#2F4F4F', + 'darkviolet': '#9400D3', + 'deeppink': '#FF1493', + 'dodgerblue': '#1E90FF', + 'firebrick': '#B22222', + 'floralwhite': '#FFFAF0', + 'forestgreen': '#228B22', + 'fuchsia': '#FF00FF', + 'gainsboro': '#DCDCDC', + 'ghostwhite': '#F8F8FF', + 'gold': '#FFD700', + 'goldenrod': '#DAA520', + 'indianred ': '#CD5C5C', + 'indigo ': '#4B0082', + 'khaki': '#F0E68C', + 'lavenderblush': '#FFF0F5', + 'lawngreen': '#7CFC00', + 'lightblue': '#ADD8E6', + 'lightcoral': '#F08080', + 'lightgoldenrodyellow': '#FAFAD2', + 'lightgray': '#D3D3D3', + 'lightgrey': '#D3D3D3', + 'lightskyblue': '#87CEFA', + 'lightslategrey': '#778899', + 'lightsteelblue': '#B0C4DE', + 'lime': '#87CEFA', + 'linen': '#FAF0E6', + 'magenta': '#FF00FF', + 'maroon': '#800000', + 'mediumaquamarine': '#66CDAA', + 'mediumblue': '#0000CD', + 'mediumorchid': '#BA55D3', + 'mediumpurple': '#9370D8', + 'mediumseagreen': '#3CB371', + 'mediumslateblue': '#7B68EE', + 'midnightblue': '#191970', + 'moccasin': '#FFE4B5', + 'navajowhite': '#FFDEAD', + 'navy': '#000080', + 'oldlace': '#FDF5E6', + 'olive': '#808000', + 'orange': '#FFA500', + 'orangered': '#FF4500', + 'orchid': '#DA70D6', + 'paleturquoise': '#AFEEEE', + 'papayawhip': '#FFEFD5', + 'peachpuff': '#FFDAB9', + 'powderblue': '#B0E0E6', + 'rosybrown': '#BC8F8F', + 'royalblue': '#4169E1', + 'saddlebrown': '#8B4513', + 'sandybrown': '#8B4513', + 'seashell': '#FFF5EE', + 'sienna': '#A0522D', + 'silver': '#C0C0C0', + 'skyblue': '#87CEEB', + 'slategrey': '#708090', + 'snow': '#FFFAFA', + 'springgreen': '#00FF7F', + 'violet': '#EE82EE', + 'yellowgreen': '#9ACD32' +} hex_pat = re.compile(r'#(\d{2})(\d{2})(\d{2})') rgb_pat = re.compile(r'rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)', re.IGNORECASE) diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 04b7226647..96e1c8c7ce 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -196,28 +196,28 @@ class HTMLConverter: object.__setattr__(self, attr, val) CSS = { - 'h1' : {'font-size' : 'xx-large', 'font-weight':'bold', 'text-indent':'0pt'}, - 'h2' : {'font-size' : 'x-large', 'font-weight':'bold', 'text-indent':'0pt'}, - 'h3' : {'font-size' : 'large', 'font-weight':'bold', 'text-indent':'0pt'}, - 'h4' : {'font-size' : 'large', 'text-indent':'0pt'}, - 'h5' : {'font-weight' : 'bold', 'text-indent':'0pt'}, - 'b' : {'font-weight' : 'bold'}, - 'strong' : {'font-weight' : 'bold'}, - 'i' : {'font-style' : 'italic'}, - 'cite' : {'font-style' : 'italic'}, - 'em' : {'font-style' : 'italic'}, - 'small' : {'font-size' : 'small'}, - 'pre' : {'font-family' : 'monospace', 'white-space': 'pre'}, - 'code' : {'font-family' : 'monospace'}, - 'tt' : {'font-family' : 'monospace'}, - 'center' : {'text-align' : 'center'}, - 'th' : {'font-size' : 'large', 'font-weight':'bold'}, - 'big' : {'font-size' : 'large', 'font-weight':'bold'}, - '.libprs500_dropcaps' : {'font-size': 'xx-large'}, - 'u' : {'text-decoration': 'underline'}, - 'sup' : {'vertical-align': 'super', 'font-size': '60%'}, - 'sub' : {'vertical-align': 'sub', 'font-size': '60%'}, - } + 'h1' : {'font-size' : 'xx-large', 'font-weight':'bold', 'text-indent':'0pt'}, + 'h2' : {'font-size' : 'x-large', 'font-weight':'bold', 'text-indent':'0pt'}, + 'h3' : {'font-size' : 'large', 'font-weight':'bold', 'text-indent':'0pt'}, + 'h4' : {'font-size' : 'large', 'text-indent':'0pt'}, + 'h5' : {'font-weight' : 'bold', 'text-indent':'0pt'}, + 'b' : {'font-weight' : 'bold'}, + 'strong' : {'font-weight' : 'bold'}, + 'i' : {'font-style' : 'italic'}, + 'cite' : {'font-style' : 'italic'}, + 'em' : {'font-style' : 'italic'}, + 'small' : {'font-size' : 'small'}, + 'pre' : {'font-family' : 'monospace', 'white-space': 'pre'}, + 'code' : {'font-family' : 'monospace'}, + 'tt' : {'font-family' : 'monospace'}, + 'center' : {'text-align' : 'center'}, + 'th' : {'font-size' : 'large', 'font-weight':'bold'}, + 'big' : {'font-size' : 'large', 'font-weight':'bold'}, + '.libprs500_dropcaps' : {'font-size': 'xx-large'}, + 'u' : {'text-decoration': 'underline'}, + 'sup' : {'vertical-align': 'super', 'font-size': '60%'}, + 'sub' : {'vertical-align': 'sub', 'font-size': '60%'}, + } def __init__(self, book, fonts, options, logger, paths): ''' diff --git a/src/calibre/ebooks/lrf/lrs/convert_from.py b/src/calibre/ebooks/lrf/lrs/convert_from.py index 049278b086..ba8724da65 100644 --- a/src/calibre/ebooks/lrf/lrs/convert_from.py +++ b/src/calibre/ebooks/lrf/lrs/convert_from.py @@ -80,15 +80,15 @@ class LrsParser: def text_tag_to_element(self, tag): map = { - 'span' : Span, - 'italic' : Italic, - 'bold' : Bold, - 'empline' : EmpLine, - 'sup' : Sup, - 'sub' : Sub, - 'cr' : CR, - 'drawchar': DropCaps, - } + 'span' : Span, + 'italic' : Italic, + 'bold' : Bold, + 'empline' : EmpLine, + 'sup' : Sup, + 'sub' : Sub, + 'cr' : CR, + 'drawchar': DropCaps, + } if tag.name == 'charbutton': return CharButton(self.parsed_objects[tag.get('refobj')], None) if tag.name == 'plot': diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index bb225a8e0b..da6fa769b0 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -1344,7 +1344,7 @@ class Amazon(Source): terms = [] q = {'search-alias': 'aps', 'unfiltered': '1', - } + } if domain == 'com': q['sort'] = 'relevanceexprank' diff --git a/src/calibre/ebooks/oeb/polish/embed.py b/src/calibre/ebooks/oeb/polish/embed.py index 164f43d4bd..c74cfe7121 100644 --- a/src/calibre/ebooks/oeb/polish/embed.py +++ b/src/calibre/ebooks/oeb/polish/embed.py @@ -58,8 +58,8 @@ def stretch_as_number(val): pass try: return ('ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', - 'normal', 'semi-expanded', 'expanded', 'extra-expanded', - 'ultra-expanded').index(val) + 'normal', 'semi-expanded', 'expanded', 'extra-expanded', + 'ultra-expanded').index(val) except Exception: return 4 # normal diff --git a/src/calibre/ebooks/oeb/polish/upgrade.py b/src/calibre/ebooks/oeb/polish/upgrade.py index 55846a12ad..06940639e7 100644 --- a/src/calibre/ebooks/oeb/polish/upgrade.py +++ b/src/calibre/ebooks/oeb/polish/upgrade.py @@ -90,50 +90,50 @@ def collect_properties(container): guide_epubtype_map = { - 'acknowledgements' : 'acknowledgments', - 'other.afterword' : 'afterword', - 'other.appendix' : 'appendix', - 'other.backmatter' : 'backmatter', - 'bibliography' : 'bibliography', - 'text' : 'bodymatter', - 'other.chapter' : 'chapter', - 'colophon' : 'colophon', - 'other.conclusion' : 'conclusion', - 'other.contributors' : 'contributors', - 'copyright-page' : 'copyright-page', - 'cover' : 'cover', - 'dedication' : 'dedication', - 'other.division' : 'division', - 'epigraph' : 'epigraph', - 'other.epilogue' : 'epilogue', - 'other.errata' : 'errata', - 'other.footnotes' : 'footnotes', - 'foreword' : 'foreword', - 'other.frontmatter' : 'frontmatter', - 'glossary' : 'glossary', - 'other.halftitlepage': 'halftitlepage', - 'other.imprint' : 'imprint', - 'other.imprimatur' : 'imprimatur', - 'index' : 'index', - 'other.introduction' : 'introduction', - 'other.landmarks' : 'landmarks', - 'other.loa' : 'loa', - 'loi' : 'loi', - 'lot' : 'lot', - 'other.lov' : 'lov', - 'notes' : '', - 'other.notice' : 'notice', - 'other.other-credits': 'other-credits', - 'other.part' : 'part', - 'other.preamble' : 'preamble', - 'preface' : 'preface', - 'other.prologue' : 'prologue', - 'other.rearnotes' : 'rearnotes', - 'other.subchapter' : 'subchapter', - 'title-page' : 'titlepage', - 'toc' : 'toc', - 'other.volume' : 'volume', - 'other.warning' : 'warning' + 'acknowledgements' : 'acknowledgments', + 'other.afterword' : 'afterword', + 'other.appendix' : 'appendix', + 'other.backmatter' : 'backmatter', + 'bibliography' : 'bibliography', + 'text' : 'bodymatter', + 'other.chapter' : 'chapter', + 'colophon' : 'colophon', + 'other.conclusion' : 'conclusion', + 'other.contributors' : 'contributors', + 'copyright-page' : 'copyright-page', + 'cover' : 'cover', + 'dedication' : 'dedication', + 'other.division' : 'division', + 'epigraph' : 'epigraph', + 'other.epilogue' : 'epilogue', + 'other.errata' : 'errata', + 'other.footnotes' : 'footnotes', + 'foreword' : 'foreword', + 'other.frontmatter' : 'frontmatter', + 'glossary' : 'glossary', + 'other.halftitlepage': 'halftitlepage', + 'other.imprint' : 'imprint', + 'other.imprimatur' : 'imprimatur', + 'index' : 'index', + 'other.introduction' : 'introduction', + 'other.landmarks' : 'landmarks', + 'other.loa' : 'loa', + 'loi' : 'loi', + 'lot' : 'lot', + 'other.lov' : 'lov', + 'notes' : '', + 'other.notice' : 'notice', + 'other.other-credits': 'other-credits', + 'other.part' : 'part', + 'other.preamble' : 'preamble', + 'preface' : 'preface', + 'other.prologue' : 'prologue', + 'other.rearnotes' : 'rearnotes', + 'other.subchapter' : 'subchapter', + 'title-page' : 'titlepage', + 'toc' : 'toc', + 'other.volume' : 'volume', + 'other.warning' : 'warning' } diff --git a/src/calibre/ebooks/unihandecode/unicodepoints.py b/src/calibre/ebooks/unihandecode/unicodepoints.py index 8f5ee89a17..4b55ce58bf 100644 --- a/src/calibre/ebooks/unihandecode/unicodepoints.py +++ b/src/calibre/ebooks/unihandecode/unicodepoints.py @@ -1721,76 +1721,76 @@ CODEPOINTS = { '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ], - 'x1d4':[ - 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', - 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', - 'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K', - 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', - 'b','c','d','e','f','g','','i','j','k','l','m','n','o','p','q', - 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G', - 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W', - 'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m', - 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','','C', - 'D','','','G','','','J','K','','','N','O','P','Q','','S', - 'T','U','V','W','X','Y','Z','a','b','c','d','','f','','h','i', - 'j','k','l','m','n','','p','q','r','s','t','u','v','w','x','y', - 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', - 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v' - ], - 'x1d5':[ - 'w','x','y','z','A','B','','D','E','F','G','','','J','K', - 'L','M','N','O','P','Q','','S','T','U','V','W','X','Y','','a', - 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q', - 'r','s','t','u','v','w','x','y','z','A','B','','D','E','F','G', - '','I','J','K','L','M','','O','','','','S','T','U','V','W', - 'X','Y','','a','b','c','d','e','f','g','h','i','j','k','l','m', - 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C', - 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', - 'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i', - 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y', - 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', - 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', - 'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K', - 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', - 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r' - ], - 'x1d6':[ - 's','t','u','v','w','x','y','z','A','B','C','D','E','F','G', - 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W', - 'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m', - 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C', - 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', - 'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i', - 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y', - 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', - 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', - 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', - 'v','w','x','y','z','i','j','','','Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta', - 'Theta','Iota','Kappa','Lamda','Mu','Nu','Xi','Omicron','Pi','Rho','Theta','Sigma','Tau','Upsilon','Phi','Chi', - 'Psi','Omega','nabla','alpha','beta','gamma','delta','epsilon','zeta','eta','theta','iota','kappa','lamda','mu','nu', - 'xi','omicron','pi','rho','sigma','sigma','tai','upsilon','phi','chi','psi','omega','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','','' - ], - 'x1d7':[ - '','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','', - '','','','','','','','','','','','','','','','0', - '1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6', - '7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2', - '3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9' - ] - } + 'x1d4':[ + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', + 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', + 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', + 'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K', + 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', + 'b','c','d','e','f','g','','i','j','k','l','m','n','o','p','q', + 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G', + 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W', + 'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','','C', + 'D','','','G','','','J','K','','','N','O','P','Q','','S', + 'T','U','V','W','X','Y','Z','a','b','c','d','','f','','h','i', + 'j','k','l','m','n','','p','q','r','s','t','u','v','w','x','y', + 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', + 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', + 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v' + ], + 'x1d5':[ + 'w','x','y','z','A','B','','D','E','F','G','','','J','K', + 'L','M','N','O','P','Q','','S','T','U','V','W','X','Y','','a', + 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q', + 'r','s','t','u','v','w','x','y','z','A','B','','D','E','F','G', + '','I','J','K','L','M','','O','','','','S','T','U','V','W', + 'X','Y','','a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C', + 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', + 'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i', + 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y', + 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', + 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', + 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', + 'v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K', + 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', + 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r' + ], + 'x1d6':[ + 's','t','u','v','w','x','y','z','A','B','C','D','E','F','G', + 'H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W', + 'X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C', + 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', + 'T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i', + 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y', + 'z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', + 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e', + 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u', + 'v','w','x','y','z','i','j','','','Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta', + 'Theta','Iota','Kappa','Lamda','Mu','Nu','Xi','Omicron','Pi','Rho','Theta','Sigma','Tau','Upsilon','Phi','Chi', + 'Psi','Omega','nabla','alpha','beta','gamma','delta','epsilon','zeta','eta','theta','iota','kappa','lamda','mu','nu', + 'xi','omicron','pi','rho','sigma','sigma','tai','upsilon','phi','chi','psi','omega','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','','' + ], + 'x1d7':[ + '','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','', + '','','','','','','','','','','','','','','','0', + '1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6', + '7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2', + '3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9' + ] +} diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 3a65449878..89827a156e 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -1392,13 +1392,13 @@ class OnDeviceSearch(SearchQueryParser): # {{{ all_locs = set(self.USABLE_LOCATIONS) - {'all', 'tags', 'search'} locations = all_locs if location == 'all' else [location] q = { - 'title' : lambda x : getattr(x, 'title').lower(), - 'author': lambda x: ' & '.join(getattr(x, 'authors')).lower(), - 'collections':lambda x: ','.join(getattr(x, 'device_collections')).lower(), - 'format':lambda x: os.path.splitext(x.path)[1].lower(), - 'inlibrary':lambda x : getattr(x, 'in_library'), - 'tags':lambda x : getattr(x, 'tags', []) - } + 'title' : lambda x : getattr(x, 'title').lower(), + 'author': lambda x: ' & '.join(getattr(x, 'authors')).lower(), + 'collections':lambda x: ','.join(getattr(x, 'device_collections')).lower(), + 'format':lambda x: os.path.splitext(x.path)[1].lower(), + 'inlibrary':lambda x : getattr(x, 'in_library'), + 'tags':lambda x : getattr(x, 'tags', []) + } for x in ('author', 'format'): q[x+'s'] = q[x] upf = prefs['use_primary_find_in_search'] diff --git a/src/calibre/gui2/preferences/create_custom_column.py b/src/calibre/gui2/preferences/create_custom_column.py index 3cf7511135..247c9fc8fc 100644 --- a/src/calibre/gui2/preferences/create_custom_column.py +++ b/src/calibre/gui2/preferences/create_custom_column.py @@ -348,11 +348,11 @@ class CreateCustomColumn(QDialog): h.addWidget(ud) self.is_names = ins = QCheckBox(_('Contains names'), self) ins.setToolTip('

' + _('Check this box if this column contains names, ' - 'like the authors column. If checked, the item separator will be an ampersand ' - '(&) instead of a comma (,), sorting will be done using a computed value ' - 'that respects the author sort tweaks (for example converting "Firstname ' - 'Lastname" into "Lastname, Firstname"), and item order will be ' - 'preserved.')+'

') + 'like the authors column. If checked, the item separator will be an ampersand ' + '(&) instead of a comma (,), sorting will be done using a computed value ' + 'that respects the author sort tweaks (for example converting "Firstname ' + 'Lastname" into "Lastname, Firstname"), and item order will be ' + 'preserved.')+'

') h.addWidget(ins) add_row(_('&Column type:'), h) @@ -513,13 +513,13 @@ class CreateCustomColumn(QDialog): l = QHBoxLayout() self.store_template_value_in_opf = cmc = QCheckBox(_("Store this column's value in an OPF")) cmc.setToolTip('

' + _('If you check this box then the result of ' - "evaluating this column's template will be stored in the backup OPF " - 'stored in the library. The same is true when sending to a device, ' - 'assuming the format has an OPF. One reason to uncheck this box is ' - 'that the column contains large images.') + '

' + '

' + - _('Note that some background functions require data for a column to ' - 'be in the OPF, for example book jackets. If you uncheck this box ' - 'and some function stops working then check the box.') + '

') + "evaluating this column's template will be stored in the backup OPF " + 'stored in the library. The same is true when sending to a device, ' + 'assuming the format has an OPF. One reason to uncheck this box is ' + 'that the column contains large images.') + '

' + '

' + + _('Note that some background functions require data for a column to ' + 'be in the OPF, for example book jackets. If you uncheck this box ' + 'and some function stops working then check the box.') + '

') l.addWidget(cmc) l.addStretch() add_row(None, l) diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py index c4dd83dd18..04957c03e6 100644 --- a/src/calibre/gui2/store/config/chooser/models.py +++ b/src/calibre/gui2/store/config/chooser/models.py @@ -251,13 +251,13 @@ class SearchFilter(SearchQueryParser): all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { - 'affiliate': lambda x: x.affiliate, - 'description': lambda x: x.description.lower(), - 'drm': lambda x: not x.drm_free_only, - 'enabled': lambda x: not is_disabled(x), - 'format': lambda x: ','.join(x.formats).lower(), - 'headquarters': lambda x: x.headquarters.lower(), - 'name': lambda x : x.name.lower(), + 'affiliate': lambda x: x.affiliate, + 'description': lambda x: x.description.lower(), + 'drm': lambda x: not x.drm_free_only, + 'enabled': lambda x: not is_disabled(x), + 'format': lambda x: ','.join(x.formats).lower(), + 'headquarters': lambda x: x.headquarters.lower(), + 'name': lambda x : x.name.lower(), } q['formats'] = q['format'] upf = prefs['use_primary_find_in_search'] diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py index ca8816cb4e..1a742b0eee 100644 --- a/src/calibre/gui2/store/search/models.py +++ b/src/calibre/gui2/store/search/models.py @@ -397,15 +397,15 @@ class SearchFilter(SearchQueryParser): all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { - 'affiliate': attrgetter('affiliate'), - 'author': lambda x: x.author.lower(), - 'cover': attrgetter('cover_url'), - 'drm': attrgetter('drm'), - 'download': attrgetter('downloads'), - 'format': attrgetter('formats'), - 'price': lambda x: comparable_price(x.price), - 'store': lambda x: x.store_name.lower(), - 'title': lambda x: x.title.lower(), + 'affiliate': attrgetter('affiliate'), + 'author': lambda x: x.author.lower(), + 'cover': attrgetter('cover_url'), + 'drm': attrgetter('drm'), + 'download': attrgetter('downloads'), + 'format': attrgetter('formats'), + 'price': lambda x: comparable_price(x.price), + 'store': lambda x: x.store_name.lower(), + 'title': lambda x: x.title.lower(), } for x in ('author', 'download', 'format'): q[x+'s'] = q[x] diff --git a/src/calibre/gui2/store/stores/mobileread/models.py b/src/calibre/gui2/store/stores/mobileread/models.py index bed3d263a0..94f1af96df 100644 --- a/src/calibre/gui2/store/stores/mobileread/models.py +++ b/src/calibre/gui2/store/stores/mobileread/models.py @@ -152,9 +152,9 @@ class SearchFilter(SearchQueryParser): all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { - 'author': lambda x: x.author.lower(), - 'format': attrgetter('formats'), - 'title': lambda x: x.title.lower(), + 'author': lambda x: x.author.lower(), + 'format': attrgetter('formats'), + 'title': lambda x: x.title.lower(), } for x in ('author', 'format'): q[x+'s'] = q[x] diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index 85043bc0f4..48c788e7b8 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -628,7 +628,7 @@ class CustomColumns: def clean_custom(self): st = ('DELETE FROM {table} WHERE (SELECT COUNT(id) FROM {lt} WHERE' - ' {lt}.value={table}.id) < 1;') + ' {lt}.value={table}.id) < 1;') statements = [] for data in self.custom_column_num_map.values(): if data['normalized']: diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index bce7e1f990..3ef24e6b0d 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -440,10 +440,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): lines.extend([custom_map[x] for x in custom_cols]) self.FIELD_MAP = {'id':0, 'title':1, 'authors':2, 'timestamp':3, - 'size':4, 'rating':5, 'tags':6, 'comments':7, 'series':8, - 'publisher':9, 'series_index':10, 'sort':11, 'author_sort':12, - 'formats':13, 'path':14, 'pubdate':15, 'uuid':16, 'cover':17, - 'au_map':18, 'last_modified':19, 'identifiers':20, 'languages':21} + 'size':4, 'rating':5, 'tags':6, 'comments':7, 'series':8, + 'publisher':9, 'series_index':10, 'sort':11, 'author_sort':12, + 'formats':13, 'path':14, 'pubdate':15, 'uuid':16, 'cover':17, + 'au_map':18, 'last_modified':19, 'identifiers':20, 'languages':21} for k,v in iteritems(self.FIELD_MAP): self.field_metadata.set_field_record_index(k, v, prefer_custom=False) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 1cffadeb35..1fa493421f 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -22,22 +22,22 @@ from polyglot.builtins import iteritems entry_points = { 'console_scripts': [ - 'ebook-device = calibre.devices.cli:main', - 'ebook-meta = calibre.ebooks.metadata.cli:main', - 'ebook-convert = calibre.ebooks.conversion.cli:main', - 'ebook-polish = calibre.ebooks.oeb.polish.main:main', - 'markdown-calibre = markdown.__main__:run', - 'web2disk = calibre.web.fetch.simple:main', - 'calibre-server = calibre.srv.standalone:main', - 'lrf2lrs = calibre.ebooks.lrf.lrfparser:main', - 'lrs2lrf = calibre.ebooks.lrf.lrs.convert_from:main', - 'calibre-debug = calibre.debug:main', - 'calibredb = calibre.db.cli.main:main', - 'calibre-parallel = calibre.utils.ipc.worker:main', - 'calibre-customize = calibre.customize.ui:main', - 'calibre-complete = calibre.utils.complete:main', - 'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main', - 'calibre-smtp = calibre.utils.smtp:main', + 'ebook-device = calibre.devices.cli:main', + 'ebook-meta = calibre.ebooks.metadata.cli:main', + 'ebook-convert = calibre.ebooks.conversion.cli:main', + 'ebook-polish = calibre.ebooks.oeb.polish.main:main', + 'markdown-calibre = markdown.__main__:run', + 'web2disk = calibre.web.fetch.simple:main', + 'calibre-server = calibre.srv.standalone:main', + 'lrf2lrs = calibre.ebooks.lrf.lrfparser:main', + 'lrs2lrf = calibre.ebooks.lrf.lrs.convert_from:main', + 'calibre-debug = calibre.debug:main', + 'calibredb = calibre.db.cli.main:main', + 'calibre-parallel = calibre.utils.ipc.worker:main', + 'calibre-customize = calibre.customize.ui:main', + 'calibre-complete = calibre.utils.complete:main', + 'fetch-ebook-metadata = calibre.ebooks.metadata.sources.cli:main', + 'calibre-smtp = calibre.utils.smtp:main', ], 'gui_scripts' : [ __appname__+' = calibre.gui_launch:calibre', diff --git a/src/calibre/utils/search_query_parser_test.py b/src/calibre/utils/search_query_parser_test.py index 41fbc289ff..58299a42c0 100644 --- a/src/calibre/utils/search_query_parser_test.py +++ b/src/calibre/utils/search_query_parser_test.py @@ -300,28 +300,28 @@ class Tester(SearchQueryParser): } tests = { - 'Dysfunction' : {348}, - 'title:Dysfunction' : {348}, - 'Title:Dysfunction' : {348}, - 'title:Dysfunction OR author:Laurie': {348, 444}, - '(tag:txt or tag:pdf)': {33, 258, 354, 305, 242, 51, 55, 56, 154}, - '(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56}, - 'Tolstoy txt': {55, 56}, - 'Hamilton Amsterdam' : set(), - 'Beär' : {91}, - 'dysfunc or tolstoy': {348, 55, 56}, - 'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154}, - 'not tag:lrf' : {305}, - 'london:thames': {13}, - 'publisher:london:thames': {13}, - '"(1977)"': {13}, - 'jack weatherford orc': {30}, - 'S\\"calzi': {343}, - 'author:S\\"calzi': {343}, - '"S\\"calzi"': {343}, - 'M\\\\cMurtry': {427}, - 'author:Tolstoy (tag:txt OR tag:pdf)': {55, 56}, - } + 'Dysfunction' : {348}, + 'title:Dysfunction' : {348}, + 'Title:Dysfunction' : {348}, + 'title:Dysfunction OR author:Laurie': {348, 444}, + '(tag:txt or tag:pdf)': {33, 258, 354, 305, 242, 51, 55, 56, 154}, + '(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56}, + 'Tolstoy txt': {55, 56}, + 'Hamilton Amsterdam' : set(), + 'Beär' : {91}, + 'dysfunc or tolstoy': {348, 55, 56}, + 'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154}, + 'not tag:lrf' : {305}, + 'london:thames': {13}, + 'publisher:london:thames': {13}, + '"(1977)"': {13}, + 'jack weatherford orc': {30}, + 'S\\"calzi': {343}, + 'author:S\\"calzi': {343}, + '"S\\"calzi"': {343}, + 'M\\\\cMurtry': {427}, + 'author:Tolstoy (tag:txt OR tag:pdf)': {55, 56}, + } fields = {'title':0, 'author':1, 'publisher':2, 'tag':3} _universal_set = set(texts.keys()) diff --git a/src/odf/namespaces.py b/src/odf/namespaces.py index 511e69ea08..93da190dc8 100644 --- a/src/odf/namespaces.py +++ b/src/odf/namespaces.py @@ -63,45 +63,45 @@ XSDNS = 'http://www.w3.org/2001/XMLSchema' XSINS = 'http://www.w3.org/2001/XMLSchema-instance' nsdict = { - ANIMNS: 'anim', - CHARTNS: 'chart', - CHARTOOONS: 'chartooo', - CONFIGNS: 'config', - CSS3TNS: 'css3t', - DBNS: 'db', - DCNS: 'dc', - DOMNS: 'dom', - DR3DNS: 'dr3d', - DRAWNS: 'draw', - FIELDNS: 'field', - FONS: 'fo', - FORMNS: 'form', - FORMXNS: 'formx', - GRDDLNS: 'grddl', - KOFFICENS: 'koffice', - MANIFESTNS: 'manifest', - MATHNS: 'math', - METANS: 'meta', - NUMBERNS: 'number', - OFFICENS: 'office', - OFNS: 'of', - OOONS: 'ooo', - OOOWNS: 'ooow', - OOOCNS: 'oooc', - PRESENTATIONNS: 'presentation', - RDFANS: 'rdfa', - RPTNS: 'rpt', - SCRIPTNS: 'script', - SMILNS: 'smil', - STYLENS: 'style', - SVGNS: 'svg', - TABLENS: 'table', - TABLEOOONS: 'tableooo', - TEXTNS: 'text', - XFORMSNS: 'xforms', - XLINKNS: 'xlink', - XHTMLNS: 'xhtml', - XMLNS: 'xml', - XSDNS: 'xsd', - XSINS: 'xsi', + ANIMNS: 'anim', + CHARTNS: 'chart', + CHARTOOONS: 'chartooo', + CONFIGNS: 'config', + CSS3TNS: 'css3t', + DBNS: 'db', + DCNS: 'dc', + DOMNS: 'dom', + DR3DNS: 'dr3d', + DRAWNS: 'draw', + FIELDNS: 'field', + FONS: 'fo', + FORMNS: 'form', + FORMXNS: 'formx', + GRDDLNS: 'grddl', + KOFFICENS: 'koffice', + MANIFESTNS: 'manifest', + MATHNS: 'math', + METANS: 'meta', + NUMBERNS: 'number', + OFFICENS: 'office', + OFNS: 'of', + OOONS: 'ooo', + OOOWNS: 'ooow', + OOOCNS: 'oooc', + PRESENTATIONNS: 'presentation', + RDFANS: 'rdfa', + RPTNS: 'rpt', + SCRIPTNS: 'script', + SMILNS: 'smil', + STYLENS: 'style', + SVGNS: 'svg', + TABLENS: 'table', + TABLEOOONS: 'tableooo', + TEXTNS: 'text', + XFORMSNS: 'xforms', + XLINKNS: 'xlink', + XHTMLNS: 'xhtml', + XMLNS: 'xml', + XSDNS: 'xsd', + XSINS: 'xsi', } diff --git a/src/odf/odf2moinmoin.py b/src/odf/odf2moinmoin.py index 56ec1f2594..f58e524309 100644 --- a/src/odf/odf2moinmoin.py +++ b/src/odf/odf2moinmoin.py @@ -161,12 +161,12 @@ class ODF2MoinMoin: # Tags self.elements = { - 'draw:page': self.textToString, - 'draw:frame': self.textToString, - 'draw:image': self.draw_image, - 'draw:text-box': self.textToString, - 'text:a': self.text_a, - 'text:note': self.text_note, + 'draw:page': self.textToString, + 'draw:frame': self.textToString, + 'draw:image': self.draw_image, + 'draw:text-box': self.textToString, + 'text:a': self.text_a, + 'text:note': self.text_note, } for tag in IGNORED_TAGS: self.elements[tag] = self.do_nothing diff --git a/src/odf/odf2xhtml.py b/src/odf/odf2xhtml.py index d70702b8f1..2cfbe333b0 100644 --- a/src/odf/odf2xhtml.py +++ b/src/odf/odf2xhtml.py @@ -347,26 +347,26 @@ class TagStack: special_styles = { - 'S-Emphasis':'em', - 'S-Citation':'cite', - 'S-Strong_20_Emphasis':'strong', - 'S-Variable':'var', - 'S-Definition':'dfn', - 'S-Teletype':'tt', - 'P-Heading_20_1':'h1', - 'P-Heading_20_2':'h2', - 'P-Heading_20_3':'h3', - 'P-Heading_20_4':'h4', - 'P-Heading_20_5':'h5', - 'P-Heading_20_6':'h6', -# 'P-Caption':'caption', - 'P-Addressee':'address', -# 'P-List_20_Heading':'dt', -# 'P-List_20_Contents':'dd', - 'P-Preformatted_20_Text':'pre', -# 'P-Table_20_Heading':'th', -# 'P-Table_20_Contents':'td', -# 'P-Text_20_body':'p' + 'S-Emphasis':'em', + 'S-Citation':'cite', + 'S-Strong_20_Emphasis':'strong', + 'S-Variable':'var', + 'S-Definition':'dfn', + 'S-Teletype':'tt', + 'P-Heading_20_1':'h1', + 'P-Heading_20_2':'h2', + 'P-Heading_20_3':'h3', + 'P-Heading_20_4':'h4', + 'P-Heading_20_5':'h5', + 'P-Heading_20_6':'h6', + # 'P-Caption':'caption', + 'P-Addressee':'address', + # 'P-List_20_Heading':'dt', + # 'P-List_20_Contents':'dd', + 'P-Preformatted_20_Text':'pre', + # 'P-Table_20_Heading':'th', + # 'P-Table_20_Contents':'td', + # 'P-Text_20_body':'p' } # ----------------------------------------------------------------------------- @@ -1123,8 +1123,8 @@ dl.notes dd:last-of-type { page-break-after: avoid } # Short prefixes for class selectors _familyshort = {'drawing-page':'DP', 'paragraph':'P', 'presentation':'PR', 'text':'S', 'section':'D', - 'table':'T', 'table-cell':'TD', 'table-column':'TC', - 'table-row':'TR', 'graphic':'G'} + 'table':'T', 'table-cell':'TD', 'table-column':'TC', + 'table-row':'TR', 'graphic':'G'} def s_style_style(self, tag, attrs): ''' Collect the formatting for the style. diff --git a/src/odf/opendocument.py b/src/odf/opendocument.py index 383d7bf95b..9a6d268a06 100644 --- a/src/odf/opendocument.py +++ b/src/odf/opendocument.py @@ -72,22 +72,22 @@ assert sys.version_info >= (2, 2) # s=content() s.addElement(s) won't eat up too much processor time. odmimetypes = { - 'application/vnd.oasis.opendocument.text': '.odt', - 'application/vnd.oasis.opendocument.text-template': '.ott', - 'application/vnd.oasis.opendocument.graphics': '.odg', - 'application/vnd.oasis.opendocument.graphics-template': '.otg', - 'application/vnd.oasis.opendocument.presentation': '.odp', - 'application/vnd.oasis.opendocument.presentation-template': '.otp', - 'application/vnd.oasis.opendocument.spreadsheet': '.ods', - 'application/vnd.oasis.opendocument.spreadsheet-template': '.ots', - 'application/vnd.oasis.opendocument.chart': '.odc', - 'application/vnd.oasis.opendocument.chart-template': '.otc', - 'application/vnd.oasis.opendocument.image': '.odi', - 'application/vnd.oasis.opendocument.image-template': '.oti', - 'application/vnd.oasis.opendocument.formula': '.odf', - 'application/vnd.oasis.opendocument.formula-template': '.otf', - 'application/vnd.oasis.opendocument.text-master': '.odm', - 'application/vnd.oasis.opendocument.text-web': '.oth', + 'application/vnd.oasis.opendocument.text': '.odt', + 'application/vnd.oasis.opendocument.text-template': '.ott', + 'application/vnd.oasis.opendocument.graphics': '.odg', + 'application/vnd.oasis.opendocument.graphics-template': '.otg', + 'application/vnd.oasis.opendocument.presentation': '.odp', + 'application/vnd.oasis.opendocument.presentation-template': '.otp', + 'application/vnd.oasis.opendocument.spreadsheet': '.ods', + 'application/vnd.oasis.opendocument.spreadsheet-template': '.ots', + 'application/vnd.oasis.opendocument.chart': '.odc', + 'application/vnd.oasis.opendocument.chart-template': '.otc', + 'application/vnd.oasis.opendocument.image': '.odi', + 'application/vnd.oasis.opendocument.image-template': '.oti', + 'application/vnd.oasis.opendocument.formula': '.odf', + 'application/vnd.oasis.opendocument.formula-template': '.otf', + 'application/vnd.oasis.opendocument.text-master': '.odm', + 'application/vnd.oasis.opendocument.text-web': '.oth', }