diff --git a/src/calibre/ebooks/hyphenate.py b/src/calibre/ebooks/hyphenate.py index 2ef6ce75c8..6ae0b55886 100644 --- a/src/calibre/ebooks/hyphenate.py +++ b/src/calibre/ebooks/hyphenate.py @@ -82,6 +82,7 @@ class Hyphenator: pieces.append('') return pieces + patterns = ( # Knuth and Liang's original hyphenation patterns from classic TeX. # In the public domain. diff --git a/src/calibre/srv/tests/main.py b/src/calibre/srv/tests/main.py index c8277cd17c..730cd9af9b 100644 --- a/src/calibre/srv/tests/main.py +++ b/src/calibre/srv/tests/main.py @@ -14,6 +14,7 @@ def find_tests(): base = os.path.dirname(os.path.abspath(__file__)) return find_tests_in_dir(base) + if __name__ == '__main__': try: import init_calibre # noqa diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py index 5d94987a54..8a9666faad 100644 --- a/src/calibre/utils/formatter.py +++ b/src/calibre/utils/formatter.py @@ -306,6 +306,7 @@ class _CompileParser(_Parser): else: self.error(_('expression is not function or constant')) + compile_counter = 0 @@ -547,6 +548,7 @@ class ValidateFormatter(TemplateFormatter): self.book = Metadata('') return self.vformat(x, [], {}) + validation_formatter = ValidateFormatter() @@ -561,6 +563,6 @@ class EvalFormatter(TemplateFormatter): key = key.lower() return kwargs.get(key, _('No such variable ') + key) + # DEPRECATED. This is not thread safe. Do not use. eval_formatter = EvalFormatter() - diff --git a/src/calibre/utils/threadpool.py b/src/calibre/utils/threadpool.py index a07fd11a97..2a6109d7ae 100644 --- a/src/calibre/utils/threadpool.py +++ b/src/calibre/utils/threadpool.py @@ -271,6 +271,7 @@ def makeRequests(callable, args_list, callback=None, exc_callback=None): # USAGE EXAMPLE ################ + if __name__ == '__main__': import random import time