Various ixes for the previous polyglot commit

This commit is contained in:
Kovid Goyal 2019-03-20 21:11:45 +05:30
parent 1ea8b07078
commit 9386839320
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 27 additions and 24 deletions

View File

@ -136,6 +136,7 @@ class DeleteService(Thread):
finally:
shutil.rmtree(tdir)
__ds = None

View File

@ -42,7 +42,7 @@ class TOCItem(object):
r = makeelement(p, 'w:r')
makeelement(r, 'w:fldChar', w_fldCharType='begin')
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 = makeelement(p, 'w:r')
makeelement(r, 'w:fldChar', w_fldCharType='separate')

View File

@ -36,5 +36,6 @@ def run_devel_server():
except KeyboardInterrupt:
pass
if __name__ == '__main__':
run_devel_server()

View File

@ -235,6 +235,7 @@ class MessageWriter(object):
return ReadOnlyFileBuffer(create_frame(fin, opcode, raw, self.mask))
# }}}
conn_id = 0
@ -562,6 +563,7 @@ def run_echo_server():
with HandleInterrupt(s.wakeup):
s.serve_forever()
if __name__ == '__main__':
# import cProfile
# cProfile.runctx('r()', {'r':run_echo_server}, {}, filename='stats.profile')

View File

@ -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)

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python2
from __future__ import with_statement, print_function
from __future__ import print_function, with_statement
__license__ = 'GPL v3'
__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
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.constants import filesystem_encoding, iswindows
from calibre.utils.filenames import ascii_filename
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
from calibre.ebooks.chardet import xml_to_unicode
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.imghdr import what
from calibre.utils.logging import Log
from calibre.web.fetch.utils import rescale_image
from polyglot.builtins import unicode_type
from polyglot.urllib import (quote, URLError, url2pathname, urljoin,
urlparse, urlsplit, urlunsplit)
from polyglot.urllib import (
URLError, quote, url2pathname, urljoin, urlparse, urlsplit, urlunparse,
urlunsplit
)
class AbortArticle(Exception):

View File

@ -5,6 +5,6 @@
from polyglot.builtins import is_py3
if is_py3:
from queue import * # noqa
from queue import Queue, Empty, Full, PriorityQueue, LifoQueue # noqa
else:
from Queue import * # noqa
from Queue import Queue, Empty, Full, PriorityQueue, LifoQueue # noqa