

def build_regex(self):
    regex_parts = []
    for (_type, _variable, _static) in parse_rule(self.rule):
        if ((_type is None) and _static):
            regex_parts.append(re.escape(_static))
            self._trace.append((False, _static))
        elif _variable:
            regex_parts.append(('(?P<%s>%s)' % (_variable, '[a-zA-Z0-9_]*')))
            self._trace.append((True, _variable))
            self.variables.add(_variable)
    regex = ('^%s$' % ''.join(regex_parts))
    self._regex = re.compile(regex, re.UNICODE)

dataset/ETHPy150Open jasonlvhit/lunar/lunar/router.py Rule.build_regex/original