mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Various ixes for the previous polyglot commit
This commit is contained in:
parent
1ea8b07078
commit
9386839320
@ -136,6 +136,7 @@ class DeleteService(Thread):
|
|||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tdir)
|
shutil.rmtree(tdir)
|
||||||
|
|
||||||
|
|
||||||
__ds = None
|
__ds = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class TOCItem(object):
|
|||||||
r = makeelement(p, 'w:r')
|
r = makeelement(p, 'w:r')
|
||||||
makeelement(r, 'w:fldChar', w_fldCharType='begin')
|
makeelement(r, 'w:fldChar', w_fldCharType='begin')
|
||||||
r = makeelement(p, 'w:r')
|
r = makeelement(p, 'w:r')
|
||||||
makeelement(r, 'w:instrText').text = ' TOC \h '
|
makeelement(r, 'w:instrText').text = r' TOC \h '
|
||||||
r[0].set('{http://www.w3.org/XML/1998/namespace}space', 'preserve')
|
r[0].set('{http://www.w3.org/XML/1998/namespace}space', 'preserve')
|
||||||
r = makeelement(p, 'w:r')
|
r = makeelement(p, 'w:r')
|
||||||
makeelement(r, 'w:fldChar', w_fldCharType='separate')
|
makeelement(r, 'w:fldChar', w_fldCharType='separate')
|
||||||
|
@ -36,5 +36,6 @@ def run_devel_server():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run_devel_server()
|
run_devel_server()
|
||||||
|
@ -235,6 +235,7 @@ class MessageWriter(object):
|
|||||||
return ReadOnlyFileBuffer(create_frame(fin, opcode, raw, self.mask))
|
return ReadOnlyFileBuffer(create_frame(fin, opcode, raw, self.mask))
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
conn_id = 0
|
conn_id = 0
|
||||||
|
|
||||||
|
|
||||||
@ -562,6 +563,7 @@ def run_echo_server():
|
|||||||
with HandleInterrupt(s.wakeup):
|
with HandleInterrupt(s.wakeup):
|
||||||
s.serve_forever()
|
s.serve_forever()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# import cProfile
|
# import cProfile
|
||||||
# cProfile.runctx('r()', {'r':run_echo_server}, {}, filename='stats.profile')
|
# cProfile.runctx('r()', {'r':run_echo_server}, {}, filename='stats.profile')
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env python2
|
|
||||||
# vim:fileencoding=utf-8
|
|
||||||
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
|
||||||
|
|
||||||
def find_tests():
|
|
||||||
return unittest.defaultTestLoader.loadTestsFromTestCase(Test)
|
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
from __future__ import with_statement, print_function
|
from __future__ import print_function, with_statement
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
@ -7,25 +8,35 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
Fetch a webpage and its links recursively. The webpages are saved to disk in
|
Fetch a webpage and its links recursively. The webpages are saved to disk in
|
||||||
UTF-8 encoding with any charset declarations removed.
|
UTF-8 encoding with any charset declarations removed.
|
||||||
'''
|
'''
|
||||||
import sys, socket, os, re, time, threading, traceback
|
|
||||||
from httplib import responses
|
|
||||||
from base64 import b64decode
|
|
||||||
|
|
||||||
from html5_parser.soup import set_soup_module, parse
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import socket
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
from base64 import b64decode
|
||||||
|
from httplib import responses
|
||||||
|
|
||||||
|
from html5_parser.soup import parse, set_soup_module
|
||||||
|
|
||||||
from calibre import browser, relpath, unicode_path
|
from calibre import browser, relpath, unicode_path
|
||||||
from calibre.constants import filesystem_encoding, iswindows
|
from calibre.constants import filesystem_encoding, iswindows
|
||||||
from calibre.utils.filenames import ascii_filename
|
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
||||||
from calibre.ebooks.chardet import xml_to_unicode
|
from calibre.ebooks.chardet import xml_to_unicode
|
||||||
from calibre.utils.config import OptionParser
|
from calibre.utils.config import OptionParser
|
||||||
from calibre.utils.logging import Log
|
from calibre.utils.filenames import ascii_filename
|
||||||
from calibre.utils.img import image_from_data, image_to_data
|
from calibre.utils.img import image_from_data, image_to_data
|
||||||
from calibre.utils.imghdr import what
|
from calibre.utils.imghdr import what
|
||||||
|
from calibre.utils.logging import Log
|
||||||
from calibre.web.fetch.utils import rescale_image
|
from calibre.web.fetch.utils import rescale_image
|
||||||
from polyglot.builtins import unicode_type
|
from polyglot.builtins import unicode_type
|
||||||
from polyglot.urllib import (quote, URLError, url2pathname, urljoin,
|
from polyglot.urllib import (
|
||||||
urlparse, urlsplit, urlunsplit)
|
URLError, quote, url2pathname, urljoin, urlparse, urlsplit, urlunparse,
|
||||||
|
urlunsplit
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AbortArticle(Exception):
|
class AbortArticle(Exception):
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
from polyglot.builtins import is_py3
|
from polyglot.builtins import is_py3
|
||||||
|
|
||||||
if is_py3:
|
if is_py3:
|
||||||
from queue import * # noqa
|
from queue import Queue, Empty, Full, PriorityQueue, LifoQueue # noqa
|
||||||
else:
|
else:
|
||||||
from Queue import * # noqa
|
from Queue import Queue, Empty, Full, PriorityQueue, LifoQueue # noqa
|
||||||
|
Loading…
x
Reference in New Issue
Block a user