ruạṛ
a [��f* � @ sH d Z ddlZddlZddlmZmZ dd� Zdd� Zdd � Zd d� Z dS )zRouting utilities.� N)�COMBINED_METHODS� respondersc C s� t | tj�std��| �d�s&td��d| v r6td��| dkrT| �d�rT| dd� } d}tt� || ��}t� d d | �}t� |d|�}d| d }|t�|tj�fS )a] Compile the given URI template string into a pattern matcher. This function can be used to construct custom routing engines that iterate through a list of possible routes, attempting to match an incoming request against each route's compiled regular expression. Each field is converted to a named group, so that when a match is found, the fields can be easily extracted using :py:meth:`re.MatchObject.groupdict`. This function does not support the more flexible templating syntax used in the default router. Only simple paths with bracketed field expressions are recognized. For example:: / /books /books/{isbn} /books/{isbn}/characters /books/{isbn}/characters/{name} Also, note that if the template contains a trailing slash character, it will be stripped in order to normalize the routing logic. Args: template(str): The template to compile. Note that field names are restricted to ASCII a-z, A-Z, and the underscore character. Returns: tuple: (template_field_names, template_regex) zuri_template is not a string�/z uri_template must start with '/'z//z!uri_template may not contain '//'N���z{([a-zA-Z]\w*)}z[\.\(\)\[\]\?\*\+\^\|]z\\\g<0>z (?P<\1>[^/]+)z\Az\Z) � isinstance�six�string_types� TypeError� startswith� ValueError�endswith�set�re�findall�sub�compile� IGNORECASE)�template�expression_pattern�fields�escaped�pattern� r �w/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/falcon/routing/util.py�compile_uri_template s r c C s� i }t D ]>}zt| d|�� �}W n ty4 Y q0 t|�r|||<