py3: work towards enforce all __future__s everywhere

In various places, update division to use // (unless it specifically
wanted a float).
Drop use of u'' literals.
This commit is contained in:
Eli Schwartz 2019-05-26 15:26:05 -04:00
parent 4d547f40e7
commit 89e2638cdd
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
18 changed files with 113 additions and 108 deletions

View File

@ -1,5 +1,4 @@
from __future__ import with_statement from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import print_function
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'

View File

@ -1370,7 +1370,7 @@ plugins += [LookAndFeel, Behavior, Columns, Toolbar, Search, InputOptions,
class StoreAmazonKindleStore(StoreBase): class StoreAmazonKindleStore(StoreBase):
name = 'Amazon Kindle' name = 'Amazon Kindle'
description = u'Kindle books from Amazon.' description = 'Kindle books from Amazon.'
actual_plugin = 'calibre.gui2.store.stores.amazon_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_plugin:AmazonKindleStore'
headquarters = 'US' headquarters = 'US'
@ -1380,8 +1380,8 @@ class StoreAmazonKindleStore(StoreBase):
class StoreAmazonAUKindleStore(StoreBase): class StoreAmazonAUKindleStore(StoreBase):
name = 'Amazon AU Kindle' name = 'Amazon AU Kindle'
author = u'Kovid Goyal' author = 'Kovid Goyal'
description = u'Kindle books from Amazon.' description = 'Kindle books from Amazon.'
actual_plugin = 'calibre.gui2.store.stores.amazon_au_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_au_plugin:AmazonKindleStore'
headquarters = 'AU' headquarters = 'AU'
@ -1390,8 +1390,8 @@ class StoreAmazonAUKindleStore(StoreBase):
class StoreAmazonCAKindleStore(StoreBase): class StoreAmazonCAKindleStore(StoreBase):
name = 'Amazon CA Kindle' name = 'Amazon CA Kindle'
author = u'Kovid Goyal' author = 'Kovid Goyal'
description = u'Kindle books from Amazon.' description = 'Kindle books from Amazon.'
actual_plugin = 'calibre.gui2.store.stores.amazon_ca_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_ca_plugin:AmazonKindleStore'
headquarters = 'CA' headquarters = 'CA'
@ -1400,8 +1400,8 @@ class StoreAmazonCAKindleStore(StoreBase):
class StoreAmazonINKindleStore(StoreBase): class StoreAmazonINKindleStore(StoreBase):
name = 'Amazon IN Kindle' name = 'Amazon IN Kindle'
author = u'Kovid Goyal' author = 'Kovid Goyal'
description = u'Kindle books from Amazon.' description = 'Kindle books from Amazon.'
actual_plugin = 'calibre.gui2.store.stores.amazon_in_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_in_plugin:AmazonKindleStore'
headquarters = 'IN' headquarters = 'IN'
@ -1411,7 +1411,7 @@ class StoreAmazonINKindleStore(StoreBase):
class StoreAmazonDEKindleStore(StoreBase): class StoreAmazonDEKindleStore(StoreBase):
name = 'Amazon DE Kindle' name = 'Amazon DE Kindle'
author = 'Kovid Goyal' author = 'Kovid Goyal'
description = u'Kindle Bücher von Amazon.' description = 'Kindle Bücher von Amazon.'
actual_plugin = 'calibre.gui2.store.stores.amazon_de_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_de_plugin:AmazonKindleStore'
headquarters = 'DE' headquarters = 'DE'
@ -1421,7 +1421,7 @@ class StoreAmazonDEKindleStore(StoreBase):
class StoreAmazonFRKindleStore(StoreBase): class StoreAmazonFRKindleStore(StoreBase):
name = 'Amazon FR Kindle' name = 'Amazon FR Kindle'
author = 'Kovid Goyal' author = 'Kovid Goyal'
description = u'Tous les e-books Kindle' description = 'Tous les e-books Kindle'
actual_plugin = 'calibre.gui2.store.stores.amazon_fr_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_fr_plugin:AmazonKindleStore'
headquarters = 'FR' headquarters = 'FR'
@ -1431,7 +1431,7 @@ class StoreAmazonFRKindleStore(StoreBase):
class StoreAmazonITKindleStore(StoreBase): class StoreAmazonITKindleStore(StoreBase):
name = 'Amazon IT Kindle' name = 'Amazon IT Kindle'
author = 'Kovid Goyal' author = 'Kovid Goyal'
description = u'e-book Kindle a prezzi incredibili' description = 'e-book Kindle a prezzi incredibili'
actual_plugin = 'calibre.gui2.store.stores.amazon_it_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_it_plugin:AmazonKindleStore'
headquarters = 'IT' headquarters = 'IT'
@ -1441,7 +1441,7 @@ class StoreAmazonITKindleStore(StoreBase):
class StoreAmazonESKindleStore(StoreBase): class StoreAmazonESKindleStore(StoreBase):
name = 'Amazon ES Kindle' name = 'Amazon ES Kindle'
author = 'Kovid Goyal' author = 'Kovid Goyal'
description = u'e-book Kindle en España' description = 'e-book Kindle en España'
actual_plugin = 'calibre.gui2.store.stores.amazon_es_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_es_plugin:AmazonKindleStore'
headquarters = 'ES' headquarters = 'ES'
@ -1451,7 +1451,7 @@ class StoreAmazonESKindleStore(StoreBase):
class StoreAmazonUKKindleStore(StoreBase): class StoreAmazonUKKindleStore(StoreBase):
name = 'Amazon UK Kindle' name = 'Amazon UK Kindle'
author = 'Kovid Goyal' author = 'Kovid Goyal'
description = u'Kindle books from Amazon\'s UK web site. Also, includes French language e-books.' description = 'Kindle books from Amazon\'s UK web site. Also, includes French language e-books.'
actual_plugin = 'calibre.gui2.store.stores.amazon_uk_plugin:AmazonKindleStore' actual_plugin = 'calibre.gui2.store.stores.amazon_uk_plugin:AmazonKindleStore'
headquarters = 'UK' headquarters = 'UK'
@ -1460,7 +1460,7 @@ class StoreAmazonUKKindleStore(StoreBase):
class StoreArchiveOrgStore(StoreBase): class StoreArchiveOrgStore(StoreBase):
name = 'Archive.org' name = 'Archive.org'
description = u'An Internet library offering permanent access for researchers, historians, scholars, people with disabilities, and the general public to historical collections that exist in digital format.' # noqa description = 'An Internet library offering permanent access for researchers, historians, scholars, people with disabilities, and the general public to historical collections that exist in digital format.' # noqa
actual_plugin = 'calibre.gui2.store.stores.archive_org_plugin:ArchiveOrgStore' actual_plugin = 'calibre.gui2.store.stores.archive_org_plugin:ArchiveOrgStore'
drm_free_only = True drm_free_only = True
@ -1470,7 +1470,7 @@ class StoreArchiveOrgStore(StoreBase):
class StoreBubokPublishingStore(StoreBase): class StoreBubokPublishingStore(StoreBase):
name = 'Bubok Spain' name = 'Bubok Spain'
description = u'Bubok Publishing is a publisher, library and store of books of authors from all around the world. They have a big amount of books of a lot of topics' # noqa description = 'Bubok Publishing is a publisher, library and store of books of authors from all around the world. They have a big amount of books of a lot of topics' # noqa
actual_plugin = 'calibre.gui2.store.stores.bubok_publishing_plugin:BubokPublishingStore' actual_plugin = 'calibre.gui2.store.stores.bubok_publishing_plugin:BubokPublishingStore'
drm_free_only = True drm_free_only = True
@ -1480,7 +1480,7 @@ class StoreBubokPublishingStore(StoreBase):
class StoreBubokPortugalStore(StoreBase): class StoreBubokPortugalStore(StoreBase):
name = 'Bubok Portugal' name = 'Bubok Portugal'
description = u'Bubok Publishing Portugal is a publisher, library and store of books of authors from Portugal. They have a big amount of books of a lot of topics' # noqa description = 'Bubok Publishing Portugal is a publisher, library and store of books of authors from Portugal. They have a big amount of books of a lot of topics' # noqa
actual_plugin = 'calibre.gui2.store.stores.bubok_portugal_plugin:BubokPortugalStore' actual_plugin = 'calibre.gui2.store.stores.bubok_portugal_plugin:BubokPortugalStore'
drm_free_only = True drm_free_only = True
@ -1490,7 +1490,7 @@ class StoreBubokPortugalStore(StoreBase):
class StoreBaenWebScriptionStore(StoreBase): class StoreBaenWebScriptionStore(StoreBase):
name = 'Baen Ebooks' name = 'Baen Ebooks'
description = u'Sci-Fi & Fantasy brought to you by Jim Baen.' description = 'Sci-Fi & Fantasy brought to you by Jim Baen.'
actual_plugin = 'calibre.gui2.store.stores.baen_webscription_plugin:BaenWebScriptionStore' actual_plugin = 'calibre.gui2.store.stores.baen_webscription_plugin:BaenWebScriptionStore'
drm_free_only = True drm_free_only = True
@ -1500,7 +1500,7 @@ class StoreBaenWebScriptionStore(StoreBase):
class StoreBNStore(StoreBase): class StoreBNStore(StoreBase):
name = 'Barnes and Noble' name = 'Barnes and Noble'
description = u'The world\'s largest book seller. As the ultimate destination for book lovers, Barnes & Noble.com offers an incredible array of content.' description = 'The world\'s largest book seller. As the ultimate destination for book lovers, Barnes & Noble.com offers an incredible array of content.'
actual_plugin = 'calibre.gui2.store.stores.bn_plugin:BNStore' actual_plugin = 'calibre.gui2.store.stores.bn_plugin:BNStore'
headquarters = 'US' headquarters = 'US'
@ -1510,7 +1510,7 @@ class StoreBNStore(StoreBase):
class StoreBeamEBooksDEStore(StoreBase): class StoreBeamEBooksDEStore(StoreBase):
name = 'Beam EBooks DE' name = 'Beam EBooks DE'
author = 'Charles Haley' author = 'Charles Haley'
description = u'Bei uns finden Sie: Tausende deutschsprachige e-books; Alle e-books ohne hartes DRM; PDF, ePub und Mobipocket Format; Sofortige Verfügbarkeit - 24 Stunden am Tag; Günstige Preise; e-books für viele Lesegeräte, PC,Mac und Smartphones; Viele Gratis e-books' # noqa description = 'Bei uns finden Sie: Tausende deutschsprachige e-books; Alle e-books ohne hartes DRM; PDF, ePub und Mobipocket Format; Sofortige Verfügbarkeit - 24 Stunden am Tag; Günstige Preise; e-books für viele Lesegeräte, PC,Mac und Smartphones; Viele Gratis e-books' # noqa
actual_plugin = 'calibre.gui2.store.stores.beam_ebooks_de_plugin:BeamEBooksDEStore' actual_plugin = 'calibre.gui2.store.stores.beam_ebooks_de_plugin:BeamEBooksDEStore'
drm_free_only = True drm_free_only = True
@ -1519,9 +1519,9 @@ class StoreBeamEBooksDEStore(StoreBase):
class StoreBiblioStore(StoreBase): class StoreBiblioStore(StoreBase):
name = u'Библио.бг' name = 'Библио.бг'
author = 'Alex Stanev' author = 'Alex Stanev'
description = u'Електронна книжарница за книги и списания във формати ePUB и PDF. Част от заглавията са с активна DRM защита.' description = 'Електронна книжарница за книги и списания във формати ePUB и PDF. Част от заглавията са с активна DRM защита.'
actual_plugin = 'calibre.gui2.store.stores.biblio_plugin:BiblioStore' actual_plugin = 'calibre.gui2.store.stores.biblio_plugin:BiblioStore'
headquarters = 'BG' headquarters = 'BG'
@ -1529,9 +1529,9 @@ class StoreBiblioStore(StoreBase):
class StoreChitankaStore(StoreBase): class StoreChitankaStore(StoreBase):
name = u'Моята библиотека' name = 'Моята библиотека'
author = 'Alex Stanev' author = 'Alex Stanev'
description = u'Независим сайт за DRM свободна литература на български език' description = 'Независим сайт за DRM свободна литература на български език'
actual_plugin = 'calibre.gui2.store.stores.chitanka_plugin:ChitankaStore' actual_plugin = 'calibre.gui2.store.stores.chitanka_plugin:ChitankaStore'
drm_free_only = True drm_free_only = True
@ -1541,7 +1541,7 @@ class StoreChitankaStore(StoreBase):
class StoreEbookNLStore(StoreBase): class StoreEbookNLStore(StoreBase):
name = 'eBook.nl' name = 'eBook.nl'
description = u'De eBookwinkel van Nederland' description = 'De eBookwinkel van Nederland'
actual_plugin = 'calibre.gui2.store.stores.ebook_nl_plugin:EBookNLStore' actual_plugin = 'calibre.gui2.store.stores.ebook_nl_plugin:EBookNLStore'
headquarters = 'NL' headquarters = 'NL'
@ -1551,8 +1551,8 @@ class StoreEbookNLStore(StoreBase):
class StoreEbookpointStore(StoreBase): class StoreEbookpointStore(StoreBase):
name = 'Ebookpoint' name = 'Ebookpoint'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'E-booki wolne od DRM, 3 formaty w pakiecie, wysyłanie na Kindle' description = 'E-booki wolne od DRM, 3 formaty w pakiecie, wysyłanie na Kindle'
actual_plugin = 'calibre.gui2.store.stores.ebookpoint_plugin:EbookpointStore' actual_plugin = 'calibre.gui2.store.stores.ebookpoint_plugin:EbookpointStore'
drm_free_only = True drm_free_only = True
@ -1563,7 +1563,7 @@ class StoreEbookpointStore(StoreBase):
class StoreEbookscomStore(StoreBase): class StoreEbookscomStore(StoreBase):
name = 'eBooks.com' name = 'eBooks.com'
description = u'Sells books in multiple electronic formats in all categories. Technical infrastructure is cutting edge, robust and scalable, with servers in the US and Europe.' # noqa description = 'Sells books in multiple electronic formats in all categories. Technical infrastructure is cutting edge, robust and scalable, with servers in the US and Europe.' # noqa
actual_plugin = 'calibre.gui2.store.stores.ebooks_com_plugin:EbookscomStore' actual_plugin = 'calibre.gui2.store.stores.ebooks_com_plugin:EbookscomStore'
headquarters = 'US' headquarters = 'US'
@ -1573,7 +1573,7 @@ class StoreEbookscomStore(StoreBase):
class StoreEbooksGratuitsStore(StoreBase): class StoreEbooksGratuitsStore(StoreBase):
name = 'EbooksGratuits.com' name = 'EbooksGratuits.com'
description = u'Ebooks Libres et Gratuits' description = 'Ebooks Libres et Gratuits'
actual_plugin = 'calibre.gui2.store.stores.ebooksgratuits_plugin:EbooksGratuitsStore' actual_plugin = 'calibre.gui2.store.stores.ebooksgratuits_plugin:EbooksGratuitsStore'
headquarters = 'FR' headquarters = 'FR'
@ -1582,8 +1582,8 @@ class StoreEbooksGratuitsStore(StoreBase):
# class StoreEBookShoppeUKStore(StoreBase): # class StoreEBookShoppeUKStore(StoreBase):
# name = 'ebookShoppe UK' # name = 'ebookShoppe UK'
# author = u'Charles Haley' # author = 'Charles Haley'
# description = u'We made this website in an attempt to offer the widest range of UK eBooks possible across and as many formats as we could manage.' # description = 'We made this website in an attempt to offer the widest range of UK eBooks possible across and as many formats as we could manage.'
# actual_plugin = 'calibre.gui2.store.stores.ebookshoppe_uk_plugin:EBookShoppeUKStore' # actual_plugin = 'calibre.gui2.store.stores.ebookshoppe_uk_plugin:EBookShoppeUKStore'
# #
# headquarters = 'UK' # headquarters = 'UK'
@ -1592,9 +1592,9 @@ class StoreEbooksGratuitsStore(StoreBase):
class StoreEKnigiStore(StoreBase): class StoreEKnigiStore(StoreBase):
name = u'еКниги' name = 'еКниги'
author = 'Alex Stanev' author = 'Alex Stanev'
description = u'Онлайн книжарница за електронни книги и аудио риалити романи' description = 'Онлайн книжарница за електронни книги и аудио риалити романи'
actual_plugin = 'calibre.gui2.store.stores.eknigi_plugin:eKnigiStore' actual_plugin = 'calibre.gui2.store.stores.eknigi_plugin:eKnigiStore'
headquarters = 'BG' headquarters = 'BG'
@ -1604,8 +1604,8 @@ class StoreEKnigiStore(StoreBase):
class StoreEmpikStore(StoreBase): class StoreEmpikStore(StoreBase):
name = 'Empik' name = 'Empik'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'Empik to marka o unikalnym dziedzictwie i legendarne miejsce, dawne “okno na świat”. Jest obecna w polskim krajobrazie kulturalnym od 60 lat (wcześniej jako Kluby Międzynarodowej Prasy i Książki).' # noqa description = 'Empik to marka o unikalnym dziedzictwie i legendarne miejsce, dawne “okno na świat”. Jest obecna w polskim krajobrazie kulturalnym od 60 lat (wcześniej jako Kluby Międzynarodowej Prasy i Książki).' # noqa
actual_plugin = 'calibre.gui2.store.stores.empik_plugin:EmpikStore' actual_plugin = 'calibre.gui2.store.stores.empik_plugin:EmpikStore'
headquarters = 'PL' headquarters = 'PL'
@ -1615,7 +1615,7 @@ class StoreEmpikStore(StoreBase):
class StoreFeedbooksStore(StoreBase): class StoreFeedbooksStore(StoreBase):
name = 'Feedbooks' name = 'Feedbooks'
description = u'Feedbooks is a cloud publishing and distribution service, connected to a large ecosystem of reading systems and social networks. Provides a variety of genres from independent and classic books.' # noqa description = 'Feedbooks is a cloud publishing and distribution service, connected to a large ecosystem of reading systems and social networks. Provides a variety of genres from independent and classic books.' # noqa
actual_plugin = 'calibre.gui2.store.stores.feedbooks_plugin:FeedbooksStore' actual_plugin = 'calibre.gui2.store.stores.feedbooks_plugin:FeedbooksStore'
headquarters = 'FR' headquarters = 'FR'
@ -1624,7 +1624,7 @@ class StoreFeedbooksStore(StoreBase):
class StoreGoogleBooksStore(StoreBase): class StoreGoogleBooksStore(StoreBase):
name = 'Google Books' name = 'Google Books'
description = u'Google Books' description = 'Google Books'
actual_plugin = 'calibre.gui2.store.stores.google_books_plugin:GoogleBooksStore' actual_plugin = 'calibre.gui2.store.stores.google_books_plugin:GoogleBooksStore'
headquarters = 'US' headquarters = 'US'
@ -1633,7 +1633,7 @@ class StoreGoogleBooksStore(StoreBase):
class StoreGutenbergStore(StoreBase): class StoreGutenbergStore(StoreBase):
name = 'Project Gutenberg' name = 'Project Gutenberg'
description = u'The first producer of free e-books. Free in the United States because their copyright has expired. They may not be free of copyright in other countries. Readers outside of the United States must check the copyright laws of their countries before downloading or redistributing our e-books.' # noqa description = 'The first producer of free e-books. Free in the United States because their copyright has expired. They may not be free of copyright in other countries. Readers outside of the United States must check the copyright laws of their countries before downloading or redistributing our e-books.' # noqa
actual_plugin = 'calibre.gui2.store.stores.gutenberg_plugin:GutenbergStore' actual_plugin = 'calibre.gui2.store.stores.gutenberg_plugin:GutenbergStore'
drm_free_only = True drm_free_only = True
@ -1643,7 +1643,7 @@ class StoreGutenbergStore(StoreBase):
class StoreKoboStore(StoreBase): class StoreKoboStore(StoreBase):
name = 'Kobo' name = 'Kobo'
description = u'With over 2.3 million e-books to browse we have engaged readers in over 200 countries in Kobo eReading. Our e-book listings include New York Times Bestsellers, award winners, classics and more!' # noqa description = 'With over 2.3 million e-books to browse we have engaged readers in over 200 countries in Kobo eReading. Our e-book listings include New York Times Bestsellers, award winners, classics and more!' # noqa
actual_plugin = 'calibre.gui2.store.stores.kobo_plugin:KoboStore' actual_plugin = 'calibre.gui2.store.stores.kobo_plugin:KoboStore'
headquarters = 'CA' headquarters = 'CA'
@ -1653,8 +1653,8 @@ class StoreKoboStore(StoreBase):
class StoreLegimiStore(StoreBase): class StoreLegimiStore(StoreBase):
name = 'Legimi' name = 'Legimi'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'E-booki w formacie EPUB, MOBI i PDF' description = 'E-booki w formacie EPUB, MOBI i PDF'
actual_plugin = 'calibre.gui2.store.stores.legimi_plugin:LegimiStore' actual_plugin = 'calibre.gui2.store.stores.legimi_plugin:LegimiStore'
headquarters = 'PL' headquarters = 'PL'
@ -1665,7 +1665,7 @@ class StoreLegimiStore(StoreBase):
class StoreLibreDEStore(StoreBase): class StoreLibreDEStore(StoreBase):
name = 'ebook.de' name = 'ebook.de'
author = 'Charles Haley' author = 'Charles Haley'
description = u'All Ihre Bücher immer dabei. Suchen, finden, kaufen: so einfach wie nie. ebook.de war libre.de' description = 'All Ihre Bücher immer dabei. Suchen, finden, kaufen: so einfach wie nie. ebook.de war libre.de'
actual_plugin = 'calibre.gui2.store.stores.libri_de_plugin:LibreDEStore' actual_plugin = 'calibre.gui2.store.stores.libri_de_plugin:LibreDEStore'
headquarters = 'DE' headquarters = 'DE'
@ -1675,7 +1675,7 @@ class StoreLibreDEStore(StoreBase):
class StoreLitResStore(StoreBase): class StoreLitResStore(StoreBase):
name = 'LitRes' name = 'LitRes'
description = u'e-books from LitRes.ru' description = 'e-books from LitRes.ru'
actual_plugin = 'calibre.gui2.store.stores.litres_plugin:LitResStore' actual_plugin = 'calibre.gui2.store.stores.litres_plugin:LitResStore'
author = 'Roman Mukhin' author = 'Roman Mukhin'
@ -1687,7 +1687,7 @@ class StoreLitResStore(StoreBase):
class StoreManyBooksStore(StoreBase): class StoreManyBooksStore(StoreBase):
name = 'ManyBooks' name = 'ManyBooks'
description = u'Public domain and creative commons works from many sources.' description = 'Public domain and creative commons works from many sources.'
actual_plugin = 'calibre.gui2.store.stores.manybooks_plugin:ManyBooksStore' actual_plugin = 'calibre.gui2.store.stores.manybooks_plugin:ManyBooksStore'
drm_free_only = True drm_free_only = True
@ -1698,7 +1698,7 @@ class StoreManyBooksStore(StoreBase):
class StoreMillsBoonUKStore(StoreBase): class StoreMillsBoonUKStore(StoreBase):
name = 'Mills and Boon UK' name = 'Mills and Boon UK'
author = 'Charles Haley' author = 'Charles Haley'
description = u'"Bring Romance to Life" "[A] hallmark for romantic fiction, recognised around the world."' description = '"Bring Romance to Life" "[A] hallmark for romantic fiction, recognised around the world."'
actual_plugin = 'calibre.gui2.store.stores.mills_boon_uk_plugin:MillsBoonUKStore' actual_plugin = 'calibre.gui2.store.stores.mills_boon_uk_plugin:MillsBoonUKStore'
headquarters = 'UK' headquarters = 'UK'
@ -1708,7 +1708,7 @@ class StoreMillsBoonUKStore(StoreBase):
class StoreMobileReadStore(StoreBase): class StoreMobileReadStore(StoreBase):
name = 'MobileRead' name = 'MobileRead'
description = u'E-books handcrafted with the utmost care.' description = 'E-books handcrafted with the utmost care.'
actual_plugin = 'calibre.gui2.store.stores.mobileread.mobileread_plugin:MobileReadStore' actual_plugin = 'calibre.gui2.store.stores.mobileread.mobileread_plugin:MobileReadStore'
drm_free_only = True drm_free_only = True
@ -1718,8 +1718,8 @@ class StoreMobileReadStore(StoreBase):
class StoreNextoStore(StoreBase): class StoreNextoStore(StoreBase):
name = 'Nexto' name = 'Nexto'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'Największy w Polsce sklep internetowy z audiobookami mp3, ebookami pdf oraz prasą do pobrania on-line.' description = 'Największy w Polsce sklep internetowy z audiobookami mp3, ebookami pdf oraz prasą do pobrania on-line.'
actual_plugin = 'calibre.gui2.store.stores.nexto_plugin:NextoStore' actual_plugin = 'calibre.gui2.store.stores.nexto_plugin:NextoStore'
headquarters = 'PL' headquarters = 'PL'
@ -1729,7 +1729,7 @@ class StoreNextoStore(StoreBase):
class StoreOpenBooksStore(StoreBase): class StoreOpenBooksStore(StoreBase):
name = 'Open Books' name = 'Open Books'
description = u'Comprehensive listing of DRM free e-books from a variety of sources provided by users of calibre.' description = 'Comprehensive listing of DRM free e-books from a variety of sources provided by users of calibre.'
actual_plugin = 'calibre.gui2.store.stores.open_books_plugin:OpenBooksStore' actual_plugin = 'calibre.gui2.store.stores.open_books_plugin:OpenBooksStore'
drm_free_only = True drm_free_only = True
@ -1738,7 +1738,7 @@ class StoreOpenBooksStore(StoreBase):
class StoreOzonRUStore(StoreBase): class StoreOzonRUStore(StoreBase):
name = 'OZON.ru' name = 'OZON.ru'
description = u'e-books from OZON.ru' description = 'e-books from OZON.ru'
actual_plugin = 'calibre.gui2.store.stores.ozon_ru_plugin:OzonRUStore' actual_plugin = 'calibre.gui2.store.stores.ozon_ru_plugin:OzonRUStore'
author = 'Roman Mukhin' author = 'Roman Mukhin'
@ -1750,7 +1750,7 @@ class StoreOzonRUStore(StoreBase):
class StorePragmaticBookshelfStore(StoreBase): class StorePragmaticBookshelfStore(StoreBase):
name = 'Pragmatic Bookshelf' name = 'Pragmatic Bookshelf'
description = u'The Pragmatic Bookshelf\'s collection of programming and tech books avaliable as e-books.' description = 'The Pragmatic Bookshelf\'s collection of programming and tech books avaliable as e-books.'
actual_plugin = 'calibre.gui2.store.stores.pragmatic_bookshelf_plugin:PragmaticBookshelfStore' actual_plugin = 'calibre.gui2.store.stores.pragmatic_bookshelf_plugin:PragmaticBookshelfStore'
drm_free_only = True drm_free_only = True
@ -1760,9 +1760,9 @@ class StorePragmaticBookshelfStore(StoreBase):
class StorePublioStore(StoreBase): class StorePublioStore(StoreBase):
name = 'Publio' name = 'Publio'
description = u'Publio.pl to księgarnia internetowa, w której mogą Państwo nabyć e-booki i audiobooki.' description = 'Publio.pl to księgarnia internetowa, w której mogą Państwo nabyć e-booki i audiobooki.'
actual_plugin = 'calibre.gui2.store.stores.publio_plugin:PublioStore' actual_plugin = 'calibre.gui2.store.stores.publio_plugin:PublioStore'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
headquarters = 'PL' headquarters = 'PL'
formats = ['EPUB', 'MOBI', 'PDF'] formats = ['EPUB', 'MOBI', 'PDF']
@ -1771,9 +1771,9 @@ class StorePublioStore(StoreBase):
class StoreRW2010Store(StoreBase): class StoreRW2010Store(StoreBase):
name = 'RW2010' name = 'RW2010'
description = u'Polski serwis self-publishingowy. Pliki PDF, EPUB i MOBI.' description = 'Polski serwis self-publishingowy. Pliki PDF, EPUB i MOBI.'
actual_plugin = 'calibre.gui2.store.stores.rw2010_plugin:RW2010Store' actual_plugin = 'calibre.gui2.store.stores.rw2010_plugin:RW2010Store'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
drm_free_only = True drm_free_only = True
headquarters = 'PL' headquarters = 'PL'
@ -1782,7 +1782,7 @@ class StoreRW2010Store(StoreBase):
class StoreSmashwordsStore(StoreBase): class StoreSmashwordsStore(StoreBase):
name = 'Smashwords' name = 'Smashwords'
description = u'An e-book publishing and distribution platform for e-book authors, publishers and readers. Covers many genres and formats.' description = 'An e-book publishing and distribution platform for e-book authors, publishers and readers. Covers many genres and formats.'
actual_plugin = 'calibre.gui2.store.stores.smashwords_plugin:SmashwordsStore' actual_plugin = 'calibre.gui2.store.stores.smashwords_plugin:SmashwordsStore'
drm_free_only = True drm_free_only = True
@ -1792,9 +1792,9 @@ class StoreSmashwordsStore(StoreBase):
class StoreSwiatEbookowStore(StoreBase): class StoreSwiatEbookowStore(StoreBase):
name = u'Świat Ebooków' name = 'Świat Ebooków'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'Ebooki maje tę zaletę, że są zawsze i wszędzie tam, gdzie tylko nas dopadnie ochota na czytanie.' description = 'Ebooki maje tę zaletę, że są zawsze i wszędzie tam, gdzie tylko nas dopadnie ochota na czytanie.'
actual_plugin = 'calibre.gui2.store.stores.swiatebookow_plugin:SwiatEbookowStore' actual_plugin = 'calibre.gui2.store.stores.swiatebookow_plugin:SwiatEbookowStore'
drm_free_only = True drm_free_only = True
@ -1805,8 +1805,8 @@ class StoreSwiatEbookowStore(StoreBase):
class StoreVirtualoStore(StoreBase): class StoreVirtualoStore(StoreBase):
name = 'Virtualo' name = 'Virtualo'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'Księgarnia internetowa, która oferuje bezpieczny i szeroki dostęp do książek w formie cyfrowej.' description = 'Księgarnia internetowa, która oferuje bezpieczny i szeroki dostęp do książek w formie cyfrowej.'
actual_plugin = 'calibre.gui2.store.stores.virtualo_plugin:VirtualoStore' actual_plugin = 'calibre.gui2.store.stores.virtualo_plugin:VirtualoStore'
headquarters = 'PL' headquarters = 'PL'
@ -1816,7 +1816,7 @@ class StoreVirtualoStore(StoreBase):
class StoreWeightlessBooksStore(StoreBase): class StoreWeightlessBooksStore(StoreBase):
name = 'Weightless Books' name = 'Weightless Books'
description = u'An independent DRM-free e-book site devoted to e-books of all sorts.' description = 'An independent DRM-free e-book site devoted to e-books of all sorts.'
actual_plugin = 'calibre.gui2.store.stores.weightless_books_plugin:WeightlessBooksStore' actual_plugin = 'calibre.gui2.store.stores.weightless_books_plugin:WeightlessBooksStore'
drm_free_only = True drm_free_only = True
@ -1836,8 +1836,8 @@ class StoreWHSmithUKStore(StoreBase):
class StoreWolneLekturyStore(StoreBase): class StoreWolneLekturyStore(StoreBase):
name = 'Wolne Lektury' name = 'Wolne Lektury'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'Wolne Lektury to biblioteka internetowa czynna 24 godziny na dobę, 365 dni w roku, której zasoby dostępne są całkowicie za darmo. Wszystkie dzieła są odpowiednio opracowane - opatrzone przypisami, motywami i udostępnione w kilku formatach - HTML, TXT, PDF, EPUB, MOBI, FB2.' # noqa description = 'Wolne Lektury to biblioteka internetowa czynna 24 godziny na dobę, 365 dni w roku, której zasoby dostępne są całkowicie za darmo. Wszystkie dzieła są odpowiednio opracowane - opatrzone przypisami, motywami i udostępnione w kilku formatach - HTML, TXT, PDF, EPUB, MOBI, FB2.' # noqa
actual_plugin = 'calibre.gui2.store.stores.wolnelektury_plugin:WolneLekturyStore' actual_plugin = 'calibre.gui2.store.stores.wolnelektury_plugin:WolneLekturyStore'
headquarters = 'PL' headquarters = 'PL'
@ -1846,8 +1846,8 @@ class StoreWolneLekturyStore(StoreBase):
class StoreWoblinkStore(StoreBase): class StoreWoblinkStore(StoreBase):
name = 'Woblink' name = 'Woblink'
author = u'Tomasz Długosz' author = 'Tomasz Długosz'
description = u'Czytanie zdarza się wszędzie!' description = 'Czytanie zdarza się wszędzie!'
actual_plugin = 'calibre.gui2.store.stores.woblink_plugin:WoblinkStore' actual_plugin = 'calibre.gui2.store.stores.woblink_plugin:WoblinkStore'
headquarters = 'PL' headquarters = 'PL'

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
''' '''
Defines the plugin system for conversions. Defines the plugin system for conversions.
''' '''

View File

@ -1,5 +1,5 @@
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL 3' __license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'

View File

@ -1,5 +1,4 @@
from __future__ import with_statement from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import print_function
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'

View File

@ -425,7 +425,7 @@ class WEBOS(USBMS):
im.thumbnail((52, 69), Image.ANTIALIAS) im.thumbnail((52, 69), Image.ANTIALIAS)
x, y = im.size x, y = im.size
cover.paste(im, ((52-x)/2, (69-y)/2)) cover.paste(im, ((52-x)//2, (69-y)//2))
cover2 = cover.resize((52, 69), Image.ANTIALIAS).convert('RGB') cover2 = cover.resize((52, 69), Image.ANTIALIAS).convert('RGB')

View File

@ -40,7 +40,7 @@ def write_t2b(t2bfile, coverdata=None):
t2bcover = Image.new('L', (96, 144), 'white') t2bcover = Image.new('L', (96, 144), 'white')
x, y = cover.size x, y = cover.size
t2bcover.paste(cover, ((96-x)/2, (144-y)/2)) t2bcover.paste(cover, ((96-x)//2, (144-y)//2))
px = [] px = []
pxs = t2bcover.getdata() pxs = t2bcover.getdata()

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john at nachtimwald.com>' __copyright__ = '2009, John Schember <john at nachtimwald.com>'
@ -14,8 +15,8 @@ from calibre.devices.usbms.driver import USBMS
def is_alex(device_info): def is_alex(device_info):
return device_info[3] == u'Linux 2.6.28 with pxa3xx_u2d' and \ return device_info[3] == 'Linux 2.6.28 with pxa3xx_u2d' and \
device_info[4] == u'Seleucia Disk' device_info[4] == 'Seleucia Disk'
class N516(USBMS): class N516(USBMS):

View File

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'

View File

@ -147,7 +147,7 @@ class APNXBuilder(object):
r0 = phead.section_data(0) r0 = phead.section_data(0)
text_length = struct.unpack('>I', r0[4:8])[0] text_length = struct.unpack('>I', r0[4:8])[0]
chars_per_page = int(text_length / page_count) chars_per_page = int(text_length // page_count)
while count < text_length: while count < text_length:
pages.append(count) pages.append(count)
count += chars_per_page count += chars_per_page

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john at nachtimwald.com>' __copyright__ = '2009, John Schember <john at nachtimwald.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
@ -118,11 +118,11 @@ class KINDLE(USBMS):
return mi return mi
def get_annotations(self, path_map): def get_annotations(self, path_map):
MBP_FORMATS = [u'azw', u'mobi', u'prc', u'txt'] MBP_FORMATS = ['azw', 'mobi', 'prc', 'txt']
mbp_formats = set(MBP_FORMATS) mbp_formats = set(MBP_FORMATS)
PDR_FORMATS = [u'pdf'] PDR_FORMATS = ['pdf']
pdr_formats = set(PDR_FORMATS) pdr_formats = set(PDR_FORMATS)
TAN_FORMATS = [u'tpz', u'azw1'] TAN_FORMATS = ['tpz', 'azw1']
tan_formats = set(TAN_FORMATS) tan_formats = set(TAN_FORMATS)
def get_storage(): def get_storage():
@ -213,7 +213,7 @@ class KINDLE(USBMS):
# Add the last-read location # Add the last-read location
if bookmark.book_format == 'pdf': if bookmark.book_format == 'pdf':
markup = _("%(time)s<br />Last page read: %(loc)d (%(pr)d%%)") % dict( markup = _("%(time)s<br />Last page read: %(loc)d (%(pr)d%%)") % dict(
time=strftime(u'%x', timestamp.timetuple()), time=strftime('%x', timestamp.timetuple()),
loc=last_read_location, loc=last_read_location,
pr=percent_read) pr=percent_read)
else: else:

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
@ -9,4 +11,3 @@ CACHE_EXT = 'Sony Reader/database/cacheExt.xml'
MEDIA_THUMBNAIL = 'database/thumbnail' MEDIA_THUMBNAIL = 'database/thumbnail'
CACHE_THUMBNAIL = 'Sony Reader/thumbnail' CACHE_THUMBNAIL = 'Sony Reader/thumbnail'

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
@ -16,10 +17,10 @@ from calibre.ebooks.chardet import xml_to_unicode
from calibre.ebooks.metadata import authors_to_string, title_sort, \ from calibre.ebooks.metadata import authors_to_string, title_sort, \
authors_to_sort_string authors_to_sort_string
from polyglot.binary import from_base64_bytes from polyglot.binary import from_base64_bytes
from polyglot.builtins import zip from polyglot.builtins import unicode_type, zip
''' '''
cahceExt.xml cacheExt.xml
Periodical identifier sample from a PRS-650: Periodical identifier sample from a PRS-650:
@ -65,8 +66,8 @@ INVERSE_MONTH_MAP = dict(zip(MONTH_MAP.values(), MONTH_MAP.keys()))
def strptime(src): def strptime(src):
src = src.strip() src = src.strip()
src = src.split() src = src.split()
src[0] = str(DAY_MAP[src[0][:-1]])+',' src[0] = unicode_type(DAY_MAP[src[0][:-1]])+','
src[2] = str(MONTH_MAP[src[2]]) src[2] = unicode_type(MONTH_MAP[src[2]])
return time.strptime(' '.join(src), '%w, %d %m %Y %H:%M:%S %Z') return time.strptime(' '.join(src), '%w, %d %m %Y %H:%M:%S %Z')
@ -83,7 +84,7 @@ def strftime(epoch, zone=time.localtime):
def uuid(): def uuid():
from uuid import uuid4 from uuid import uuid4
return str(uuid4()).replace('-', '', 1).upper() return unicode_type(uuid4()).replace('-', '', 1).upper()
# }}} # }}}
@ -199,8 +200,8 @@ class XMLCache(object):
playlist.set('title', title) playlist.set('title', title)
if title in seen: if title in seen:
for i in range(2, 1000): for i in range(2, 1000):
if title+str(i) not in seen: if title+unicode_type(i) not in seen:
title = title+str(i) title = title+unicode_type(i)
playlist.set('title', title) playlist.set('title', title)
seen.add(title) seen.add(title)
break break
@ -273,7 +274,7 @@ class XMLCache(object):
nsmap=root.nsmap, attrib={ nsmap=root.nsmap, attrib={
'uuid' : uuid(), 'uuid' : uuid(),
'title': title, 'title': title,
'id' : str(self.max_id(root)+1), 'id' : unicode_type(self.max_id(root)+1),
'sourceid': '1' 'sourceid': '1'
}) })
root.append(ans) root.append(ans)
@ -312,13 +313,13 @@ class XMLCache(object):
def ensure_media_xml_base_ids(root): def ensure_media_xml_base_ids(root):
for num, tag in enumerate(('library', 'watchSpecial')): for num, tag in enumerate(('library', 'watchSpecial')):
for x in root.xpath('//*[local-name()="%s"]'%tag): for x in root.xpath('//*[local-name()="%s"]'%tag):
x.set('id', str(num)) x.set('id', unicode_type(num))
def rebase_ids(root, base, sourceid, pl_sourceid): def rebase_ids(root, base, sourceid, pl_sourceid):
'Rebase all ids and also make them consecutive' 'Rebase all ids and also make them consecutive'
for item in root.xpath('//*[@sourceid]'): for item in root.xpath('//*[@sourceid]'):
sid = pl_sourceid if item.tag.endswith('playlist') else sourceid sid = pl_sourceid if item.tag.endswith('playlist') else sourceid
item.set('sourceid', str(sid)) item.set('sourceid', unicode_type(sid))
# Only rebase ids of nodes that are immediate children of the # Only rebase ids of nodes that are immediate children of the
# record root (that way playlist/itemnodes are unaffected # record root (that way playlist/itemnodes are unaffected
items = root.xpath('child::*[@id]') items = root.xpath('child::*[@id]')
@ -328,8 +329,8 @@ class XMLCache(object):
old = int(item.get('id')) old = int(item.get('id'))
new = base + i new = base + i
if old != new: if old != new:
item.set('id', str(new)) item.set('id', unicode_type(new))
idmap[str(old)] = str(new) idmap[unicode_type(old)] = unicode_type(new)
return idmap return idmap
self.prune_empty_playlists() self.prune_empty_playlists()
@ -358,7 +359,7 @@ class XMLCache(object):
last_bl = max(self.roots.keys()) last_bl = max(self.roots.keys())
max_id = self.max_id(self.roots[last_bl]) max_id = self.max_id(self.roots[last_bl])
self.roots[0].set('nextID', str(max_id+1)) self.roots[0].set('nextID', unicode_type(max_id+1))
debug_print('Finished running fix_ids()') debug_print('Finished running fix_ids()')
# }}} # }}}
@ -515,7 +516,7 @@ class XMLCache(object):
# Ensure each book has an ID. # Ensure each book has an ID.
for rec in records: for rec in records:
if rec.get('id', None) is None: if rec.get('id', None) is None:
rec.set('id', str(self.max_id(root)+1)) rec.set('id', unicode_type(self.max_id(root)+1))
ids = [x.get('id', None) for x in records] ids = [x.get('id', None) for x in records]
# Given that we set the ids, there shouldn't be any None's. But # Given that we set the ids, there shouldn't be any None's. But
# better to be safe... # better to be safe...
@ -572,7 +573,7 @@ class XMLCache(object):
id_ = self.max_id(root)+1 id_ = self.max_id(root)+1
attrib = { attrib = {
'page':'0', 'part':'0','pageOffset':'0','scale':'0', 'page':'0', 'part':'0','pageOffset':'0','scale':'0',
'id':str(id_), 'sourceid':'1', 'path':lpath} 'id':unicod_type(id_), 'sourceid':'1', 'path':lpath}
ans = root.makeelement('{%s}text'%namespace, attrib=attrib, nsmap=root.nsmap) ans = root.makeelement('{%s}text'%namespace, attrib=attrib, nsmap=root.nsmap)
root.append(ans) root.append(ans)
return ans return ans
@ -591,7 +592,7 @@ class XMLCache(object):
if thumbnail and thumbnail[-1]: if thumbnail and thumbnail[-1]:
ans.text = '\n' + '\t\t' ans.text = '\n' + '\t\t'
t = root.makeelement('{%s}thumbnail'%namespace, t = root.makeelement('{%s}thumbnail'%namespace,
attrib={'width':str(thumbnail[0]), 'height':str(thumbnail[1])}, attrib={'width':unicode_type(thumbnail[0]), 'height':unicode_type(thumbnail[1])},
nsmap=root.nsmap) nsmap=root.nsmap)
t.text = 'main_thumbnail.jpg' t.text = 'main_thumbnail.jpg'
ans.append(t) ans.append(t)
@ -629,7 +630,7 @@ class XMLCache(object):
def clean(x): def clean(x):
if isbytestring(x): if isbytestring(x):
x = x.decode(preferred_encoding, 'replace') x = x.decode(preferred_encoding, 'replace')
x.replace(u'\0', '') x.replace('\0', '')
return x return x
def record_set(k, v): def record_set(k, v):
@ -660,7 +661,7 @@ class XMLCache(object):
date = strftime(timestamp, zone=tz) date = strftime(timestamp, zone=tz)
record.set('date', clean(date)) record.set('date', clean(date))
try: try:
record.set('size', clean(str(os.stat(path).st_size))) record.set('size', clean(unicode_type(os.stat(path).st_size)))
except: except:
record.set('size', '0') record.set('size', '0')
title = book.title if book.title else _('Unknown') title = book.title if book.title else _('Unknown')
@ -690,7 +691,7 @@ class XMLCache(object):
record.set('sourceid', '1') record.set('sourceid', '1')
if 'id' not in record.attrib: if 'id' not in record.attrib:
num = self.max_id(record.getroottree().getroot()) num = self.max_id(record.getroottree().getroot())
record.set('id', str(num+1)) record.set('id', unicode_type(num+1))
return (gtz_count, ltz_count, use_tz_var) return (gtz_count, ltz_count, use_tz_var)
# }}} # }}}

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'

View File

@ -1,4 +1,5 @@
from __future__ import with_statement from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
@ -65,7 +66,7 @@ class HTMLRenderer(object):
buf = QBuffer(ba) buf = QBuffer(ba)
buf.open(QBuffer.WriteOnly) buf.open(QBuffer.WriteOnly)
image.save(buf, 'JPEG') image.save(buf, 'JPEG')
self.data = str(ba.data()) self.data = bytes(ba.data())
except Exception as e: except Exception as e:
self.exception = e self.exception = e
self.traceback = traceback.format_exc() self.traceback = traceback.format_exc()

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net> # License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals from __future__ import absolute_import, division, print_function, unicode_literals
from functools import partial from functools import partial
from collections import OrderedDict from collections import OrderedDict
import operator, numbers import operator, numbers
@ -12,7 +12,7 @@ from css_parser.css import Property, CSSRule
from calibre import force_unicode from calibre import force_unicode
from calibre.ebooks import parse_css_length from calibre.ebooks import parse_css_length
from calibre.ebooks.oeb.normalize_css import normalizers, safe_parser from calibre.ebooks.oeb.normalize_css import normalizers, safe_parser
from polyglot.builtins import iteritems from polyglot.builtins import iteritems, unicode_type
def compile_pat(pat): def compile_pat(pat):
@ -161,7 +161,7 @@ def transform_number(val, op, raw):
v = op(v, val) v = op(v, val)
if int(v) == v: if int(v) == v:
v = int(v) v = int(v)
return str(v) + u return unicode_type(v) + u
class Rule(object): class Rule(object):
@ -379,7 +379,7 @@ def test(return_tests=False): # {{{
r = Rule(**rule) r = Rule(**rule)
decl = StyleDeclaration(safe_parser().parseStyle(style)) decl = StyleDeclaration(safe_parser().parseStyle(style))
r.process_declaration(decl) r.process_declaration(decl)
return str(decl) return unicode_type(decl)
class TestTransforms(unittest.TestCase): class TestTransforms(unittest.TestCase):
longMessage = True longMessage = True

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import, division, print_function, unicode_literals
""" Hyphenation, using Frank Liang's algorithm. """ Hyphenation, using Frank Liang's algorithm.
This module provides a single function to hyphenate words. hyphenate_word takes This module provides a single function to hyphenate words. hyphenate_word takes
@ -13,7 +15,6 @@
Ned Batchelder, July 2007. Ned Batchelder, July 2007.
This Python code is in the public domain. This Python code is in the public domain.
""" """
from __future__ import print_function
import re import re