diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index d2573c500b..110b0774c9 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -1410,7 +1410,7 @@ if __name__ == '__main__': # tests {{{ ] # }}} ca_tests = [ # {{{ - ( # Paperback with series + ( # Paperback with series {'identifiers':{'isbn':'9781623808747'}}, [title_test('Parting Shot', exact=True), authors_test(['Mary Calmes'])] ), @@ -1434,8 +1434,7 @@ if __name__ == '__main__': # tests {{{ test_identify_plugin(Amazon.name, tests, modify_plugin=lambda p:(setattr(p, 'testing_domain', domain), setattr(p, 'touched_fields', p.touched_fields - {'tags'}))) - #do_test('com') - do_test('ca') + do_test('com') # do_test('de') # }}} diff --git a/src/calibre/ebooks/oeb/polish/parsing.py b/src/calibre/ebooks/oeb/polish/parsing.py index 3c6dce466d..790f3ac059 100644 --- a/src/calibre/ebooks/oeb/polish/parsing.py +++ b/src/calibre/ebooks/oeb/polish/parsing.py @@ -541,6 +541,8 @@ class NoNamespaceTreeBuilder(TreeBuilder): body.set(to_xml_name(k), v) # Input Stream {{{ + + _regex_cache = {} @@ -604,6 +606,7 @@ class FastStream(object): return (lnum + 1, offset) # }}} + if len("\U0010FFFF") == 1: # UCS4 build replace_chars = re.compile("[\uD800-\uDFFF]") else: @@ -689,9 +692,9 @@ def parse(raw, decoder=None, log=None, line_numbers=True, linenumber_attribute=N log.exception('Failed to parse as XML, parsing as tag soup') return parse_html5(raw, log=log, line_numbers=line_numbers, linenumber_attribute=linenumber_attribute, replace_entities=False, fix_newlines=False) + if __name__ == '__main__': from lxml import etree root = parse_html5('\na\n

 \nb', discard_namespaces=False) print (etree.tostring(root, encoding='utf-8')) print() - diff --git a/src/calibre/srv/loop.py b/src/calibre/srv/loop.py index 35eb67a1ce..55817b19e4 100644 --- a/src/calibre/srv/loop.py +++ b/src/calibre/srv/loop.py @@ -664,6 +664,7 @@ class EchoLine(Connection): # {{{ self.rbuf.seek(pos + sent) # }}} + if __name__ == '__main__': s = ServerLoop(EchoLine) with HandleInterrupt(s.wakeup): diff --git a/src/calibre/utils/filenames.py b/src/calibre/utils/filenames.py index 12c1d1f36a..8c7d5dc3be 100644 --- a/src/calibre/utils/filenames.py +++ b/src/calibre/utils/filenames.py @@ -525,6 +525,7 @@ def remove_dir_if_empty(path, ignore_metadata_caches=False): return raise + if iswindows: # Python's expanduser is broken for non-ASCII usernames def expanduser(path):