mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Misc fixes for the last py3 porting merge
This commit is contained in:
parent
c8688930ad
commit
5918acabad
@ -2,8 +2,6 @@
|
|||||||
max-line-length = 160
|
max-line-length = 160
|
||||||
builtins = _,dynamic_property,__,P,I,lopen,icu_lower,icu_upper,icu_title,ngettext,connect_lambda
|
builtins = _,dynamic_property,__,P,I,lopen,icu_lower,icu_upper,icu_title,ngettext,connect_lambda
|
||||||
ignore = E12,E203,E22,E231,E241,E401,E402,E731,W391,E722,E741,W504
|
ignore = E12,E203,E22,E231,E241,E401,E402,E731,W391,E722,E741,W504
|
||||||
per-file-ignores =
|
|
||||||
src/polyglot/*:F401
|
|
||||||
|
|
||||||
[yapf]
|
[yapf]
|
||||||
based_on_style = pep8
|
based_on_style = pep8
|
||||||
|
@ -270,7 +270,7 @@ class RecentUAs(Command): # {{{
|
|||||||
from setup.browser_data import get_data
|
from setup.browser_data import get_data
|
||||||
data = get_data()
|
data = get_data()
|
||||||
with open(self.UA_PATH, 'wb') as f:
|
with open(self.UA_PATH, 'wb') as f:
|
||||||
f.write(json.dumps(data, indent=2).encode('utf-8'))
|
f.write(json.dumps(data, indent=2, ensure_ascii=False).encode('utf-8'))
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,6 +193,7 @@ def prints(*args, **kwargs):
|
|||||||
Returns the number of bytes written.
|
Returns the number of bytes written.
|
||||||
'''
|
'''
|
||||||
file = kwargs.get('file', sys.stdout)
|
file = kwargs.get('file', sys.stdout)
|
||||||
|
file = getattr(file, 'buffer', file)
|
||||||
sep = bytes(kwargs.get('sep', ' '))
|
sep = bytes(kwargs.get('sep', ' '))
|
||||||
end = bytes(kwargs.get('end', '\n'))
|
end = bytes(kwargs.get('end', '\n'))
|
||||||
enc = 'utf-8' if 'CALIBRE_WORKER' in os.environ else preferred_encoding
|
enc = 'utf-8' if 'CALIBRE_WORKER' in os.environ else preferred_encoding
|
||||||
|
@ -212,7 +212,7 @@ class Plugin(object): # {{{
|
|||||||
For example to load an image::
|
For example to load an image::
|
||||||
|
|
||||||
pixmap = QPixmap()
|
pixmap = QPixmap()
|
||||||
next(pixmap.loadFromData(self.load_resources(['images/icon.png']).values())
|
pixmap.loadFromData(tuple(self.load_resources(['images/icon.png']).values())[0])
|
||||||
icon = QIcon(pixmap)
|
icon = QIcon(pixmap)
|
||||||
|
|
||||||
:param names: List of paths to resources in the ZIP file using / as separator
|
:param names: List of paths to resources in the ZIP file using / as separator
|
||||||
|
@ -18,7 +18,7 @@ from calibre.ebooks.oeb.polish.replace import remove_links_to
|
|||||||
from calibre.ebooks.oeb.polish.cover import get_raster_cover_name
|
from calibre.ebooks.oeb.polish.cover import get_raster_cover_name
|
||||||
from calibre.ebooks.oeb.polish.utils import guess_type, actual_case_for_name, corrected_case_for_name
|
from calibre.ebooks.oeb.polish.utils import guess_type, actual_case_for_name, corrected_case_for_name
|
||||||
from calibre.ebooks.oeb.polish.check.base import BaseError, WARN, INFO
|
from calibre.ebooks.oeb.polish.check.base import BaseError, WARN, INFO
|
||||||
from polyglot.builtins import iteritems, map, range
|
from polyglot.builtins import iteritems, map, range, itervalues
|
||||||
from polyglot.urllib import urlparse
|
from polyglot.urllib import urlparse
|
||||||
from polyglot.queue import Queue, Empty
|
from polyglot.queue import Queue, Empty
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import sys, os, numbers
|
import sys, os, numbers
|
||||||
|
from itertools import count
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
@ -623,7 +624,7 @@ class PDFDocument(object):
|
|||||||
self.opts, self.log = opts, log
|
self.opts, self.log = opts, log
|
||||||
parser = etree.XMLParser(recover=True)
|
parser = etree.XMLParser(recover=True)
|
||||||
self.root = etree.fromstring(xml, parser=parser)
|
self.root = etree.fromstring(xml, parser=parser)
|
||||||
idc = iter(range(sys.maxint))
|
idc = count()
|
||||||
|
|
||||||
self.fonts = []
|
self.fonts = []
|
||||||
self.font_map = {}
|
self.font_map = {}
|
||||||
|
@ -72,7 +72,7 @@ class J2H (object):
|
|||||||
if len(text) >= length:
|
if len(text) >= length:
|
||||||
if text.startswith(k):
|
if text.startswith(k):
|
||||||
for (yomi, tail) in v:
|
for (yomi, tail) in v:
|
||||||
if tail is '':
|
if tail == '':
|
||||||
if max_len < length:
|
if max_len < length:
|
||||||
Hstr = yomi
|
Hstr = yomi
|
||||||
max_len = length
|
max_len = length
|
||||||
|
@ -278,7 +278,7 @@ class InterfaceAction(QObject):
|
|||||||
For example to load an image::
|
For example to load an image::
|
||||||
|
|
||||||
pixmap = QPixmap()
|
pixmap = QPixmap()
|
||||||
next(pixmap.loadFromData(self.load_resources(['images/icon.png']).values()))
|
pixmap.loadFromData(tuple(self.load_resources(['images/icon.png']).values())[0])
|
||||||
icon = QIcon(pixmap)
|
icon = QIcon(pixmap)
|
||||||
|
|
||||||
:param names: List of paths to resources in the ZIP file using / as separator
|
:param names: List of paths to resources in the ZIP file using / as separator
|
||||||
|
@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import os, numbers
|
import os, numbers
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from polyglot.builtins itervalues, import map
|
from polyglot.builtins import itervalues, map
|
||||||
|
|
||||||
|
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs
|
||||||
|
@ -355,7 +355,7 @@ class DeviceManager(Thread): # {{{
|
|||||||
# anything besides set a flag that the right thread will see.
|
# anything besides set a flag that the right thread will see.
|
||||||
self.connected_device.unmount_device()
|
self.connected_device.unmount_device()
|
||||||
|
|
||||||
def next(self):
|
def next_job(self):
|
||||||
if not self.job_steps.empty():
|
if not self.job_steps.empty():
|
||||||
try:
|
try:
|
||||||
return self.job_steps.get_nowait()
|
return self.job_steps.get_nowait()
|
||||||
@ -411,7 +411,7 @@ class DeviceManager(Thread): # {{{
|
|||||||
|
|
||||||
do_sleep = True
|
do_sleep = True
|
||||||
while True:
|
while True:
|
||||||
job = next(self)
|
job = self.next_job()
|
||||||
if job is not None:
|
if job is not None:
|
||||||
do_sleep = False
|
do_sleep = False
|
||||||
self.current_job = job
|
self.current_job = job
|
||||||
|
Loading…
x
Reference in New Issue
Block a user