# HG changeset patch # User Christian Ebert # Date 1191502876 -7200 # Node ID 22e08d0f25dcbd49f0ca3cb47963257171c8ccaa # Parent 001902b60bdd735a8d21dc1e4bfa0e96cd696a05 List comprehension instead of loop to create ui template dictionary diff -r 001902b60bdd -r 22e08d0f25dc 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)