This commit is contained in:
Eli Schwartz 2019-03-21 01:20:29 -04:00
parent cb85e778d8
commit d66fdc2df7
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
6 changed files with 23 additions and 24 deletions

View File

@ -90,12 +90,12 @@ class Coffee(Command): # {{{
updated = {}
for arcname in todo:
name = arcname.rpartition('.')[0]
print ('\t%sCompiling %s'%(time.strftime('[%H:%M:%S] ') if
print('\t%sCompiling %s'%(time.strftime('[%H:%M:%S] ') if
timestamp else '', name))
src, sig = src_files[arcname]
js, errors = compile_coffeescript(open(src, 'rb').read(), filename=src)
if errors:
print ('\n\tCompilation of %s failed'%name)
print('\n\tCompilation of %s failed'%name)
for line in errors:
print(line, file=sys.stderr)
if ignore_errors:
@ -105,8 +105,8 @@ class Coffee(Command): # {{{
else:
if opts.show_js:
self.show_js(js)
print ('#'*80)
print ('#'*80)
print('#'*80)
print('#'*80)
zi = zipfile.ZipInfo()
zi.filename = arcname
zi.date_time = time.localtime()[:6]

View File

@ -510,8 +510,7 @@ class LitWriter(object):
data.write(pack('<Bc', 1, '\\'))
offset = 0
for state in states:
items = manifest[state]
items.sort()
items = sorted(manifest[state])
data.write(pack('<I', len(items)))
for item in items:
id, media_type = item.id, item.media_type

View File

@ -96,14 +96,14 @@ class MOBIFile(object):
self.read_tbs()
def print_header(self, f=sys.stdout):
print (str(self.mf.palmdb).encode('utf-8'), file=f)
print (file=f)
print ('Record headers:', file=f)
print(str(self.mf.palmdb).encode('utf-8'), file=f)
print(file=f)
print('Record headers:', file=f)
for i, r in enumerate(self.mf.records):
print ('%6d. %s'%(i, r.header), file=f)
print('%6d. %s'%(i, r.header), file=f)
print (file=f)
print (str(self.mf.mobi8_header).encode('utf-8'), file=f)
print(file=f)
print(str(self.mf.mobi8_header).encode('utf-8'), file=f)
def read_fdst(self):
self.fdst = None
@ -202,7 +202,7 @@ class MOBIFile(object):
resource_index = len(container.resources)
elif sig == b'\xa0\xa0\xa0\xa0' and len(payload) == 4:
if container is None:
print ('Found an end of container record with no container, ignoring')
print('Found an end of container record with no container, ignoring')
else:
container.resources.append(None)
continue
@ -287,7 +287,7 @@ class MOBIFile(object):
except:
calculated_bytes = b'failed to calculate tbs bytes'
if calculated_bytes != otbs:
print ('WARNING: TBS mismatch for record %d'%i)
print('WARNING: TBS mismatch for record %d'%i)
desc.append('WARNING: TBS mismatch!')
desc.append('Calculated sequences: %r'%calculated_sequences)
desc.append('')

View File

@ -77,7 +77,7 @@ class InsertTag(Dialog): # {{{
def test(cls):
d = cls()
if d.exec_() == d.Accepted:
print (d.tag)
print(d.tag)
# }}}
@ -475,7 +475,7 @@ class QuickOpen(Dialog):
items = get_items_from_dir(os.getcwdu(), lambda x:not x.endswith('.pyc'))
d = cls(items)
d.exec_()
print (d.selected_result)
print(d.selected_result)
# }}}
@ -1037,7 +1037,7 @@ class FilterCSS(Dialog): # {{{
def test(cls):
d = cls()
if d.exec_() == d.Accepted:
print (d.filtered_properties)
print(d.filtered_properties)
# }}}

View File

@ -261,10 +261,10 @@ class Server(socketserver.ThreadingMixIn, HTTPServer): # {{{
The default is to print a traceback and continue.
"""
print ('-'*40)
print ('Exception happened during processing of request', request)
print('-'*40)
print('Exception happened during processing of request', request)
traceback.print_exc() # XXX But this goes to stderr!
print ('-'*40)
print('-'*40)
# }}}
@ -320,9 +320,9 @@ def main():
from pygments.lexers import JavascriptLexer
from pygments.formatters import TerminalFormatter
from pygments import highlight
print (highlight(ans, JavascriptLexer(), TerminalFormatter()))
print(highlight(ans, JavascriptLexer(), TerminalFormatter()))
else:
print (ans.encode(sys.stdout.encoding or 'utf-8'))
print(ans.encode(sys.stdout.encoding or 'utf-8'))
else:
serve(port=args.port, host=args.host)

View File

@ -169,10 +169,10 @@ class Detect(object):
# to use raster fonts (the default). In this case
# rather than failing, write an informative error
# message and the asciized version of the text.
print ('Non-ASCII text detected. You must set your Console\'s font to'
print('Non-ASCII text detected. You must set your Console\'s font to'
' Lucida Console or Consolas or some other TrueType font to see this text', file=self.stream, end=' -- ')
from calibre.utils.filenames import ascii_text
print (ascii_text(t + text), file=self.stream, end='')
print(ascii_text(t + text), file=self.stream, end='')
continue
if not ignore_errors:
raise ctypes.WinError(err)