List comprehension instead of loop to create ui template dictionary
authorChristian Ebert <blacktrash@gmx.net>
Thu, 04 Oct 2007 15:01:16 +0200
changeset 253 22e08d0f25dc
parent 252 001902b60bdd
child 254 474eccf2964f
List comprehension instead of loop to create ui template dictionary
hgkw/keyword.py
--- a/hgkw/keyword.py	Thu Oct 04 14:55:38 2007 +0200
+++ b/hgkw/keyword.py	Thu Oct 04 15:01:16 2007 +0200
@@ -168,10 +168,10 @@
         self.node = node
 
         kwmaps = self.ui.configitems('keywordmaps')
-        if kwmaps:
-            self.templates = {}
-            for k, v in kwmaps:
-                self.templates[k] = templater.parsestring(v, quoted=False)
+        if kwmaps: # override default templates
+            kwmaps = [(k, templater.parsestring(v, quoted=False))
+                      for (k, v) in kwmaps]
+            self.templates = dict(kwmaps)
         escaped = [re.escape(k) for k in self.templates.keys()]
         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
         self.re_kw = re.compile(kwpat)