@staticmethod<EOL><INDENT>def _compile_path_pattern(pattern):<DEDENT>
def replace_variable(match):<EOL><INDENT>"""<STR_LIT>"""<EOL>if match.lastindex > <NUM_LIT:1>:<EOL><INDENT>var_name = ApiConfigManager._to_safe_path_param_name(match.group(<NUM_LIT:2>))<EOL>return '<STR_LIT>' % (match.group(<NUM_LIT:1>), var_name,<EOL>_PATH_VALUE_PATTERN)<EOL><DEDENT>return match.group(<NUM_LIT:0>)<EOL><DEDENT>pattern = re.sub('<STR_LIT>' % _PATH_VARIABLE_PATTERN,<EOL>replace_variable, pattern)<EOL>return re.compile(pattern + '<STR_LIT>')<EOL>
r"""Generates a compiled regex pattern for a path pattern.

        e.g. '/MyApi/v1/notes/{id}'
        returns re.compile(r'/MyApi/v1/notes/(?P<id>[^/?#\[\]{}]*)')

        Args:
          pattern: A string, the parameterized path pattern to be checked.

        Returns:
          A compiled regex object to match this path pattern.