Commit d9c5aa05 authored by Martijn Pieters's avatar Martijn Pieters

The 'if not self._valid(ref)' branch is *always* executed because ref still...

The 'if not self._valid(ref)' branch is *always* executed because ref still includes the ${} substitution marker around it. Update the _valid regular expression to include the markers, shaving off 4 tests for every substitution.
parent 9546d11d
......@@ -910,7 +910,7 @@ class Options(UserDict.DictMixin):
_template_split = re.compile('([$]{[^}]*})').split
_simple = re.compile('[-a-zA-Z0-9 ._]+$').match
_valid = re.compile('[-a-zA-Z0-9 ._]+:[-a-zA-Z0-9 ._]+$').match
_valid = re.compile('\${[-a-zA-Z0-9 ._]+:[-a-zA-Z0-9 ._]+}$').match
def _sub(self, template, seen):
value = self._template_split(template)
subs = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment