From fcea1f35d4602fc85e5c5c7f965df246ff743904 Mon Sep 17 00:00:00 2001 From: Daniel Morrison Date: Sun, 16 Nov 2014 01:02:03 -0500 Subject: [PATCH] Only define UnclosedSection once. If you define things in a loop it slows down. Go figure. 42% speedup. --- entei.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/entei.py b/entei.py index 53de592..8679773 100755 --- a/entei.py +++ b/entei.py @@ -5,6 +5,11 @@ import json from sys import argv +class UnclosedSection(Exception): + """Raised when you have unbalanced section tags""" + pass + + def tokenize(template): """Tokenize a mustache template @@ -30,10 +35,6 @@ def tokenize(template): the literal itself. """ - class UnclosedSection(Exception): - """Raised when you have unbalanced section tags""" - pass - tag_types = { '!': 'comment', '#': 'section', -- 2.47.3