ruạṛ
a [��f3u � @ s` d Z ddlZddlZddlZddlmZ ddlmZ dZe� d�Z e� d�ZG dd � d e�Z G d d� de�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG d d!� d!e�ZG d"d#� d#e�ZG d$d%� d%e�ZG d&d'� d'e�ZG d(d)� d)e�ZdS )*zDefault routing engine.� N)�UserDict�� convertersz zR{((?P<fname>[^}:]*)((?P<cname_sep>:(?P<cname>[^}\(]*))(\((?P<argstr>[^}]*)\))?)?)}z[A-Za-z_][A-Za-z0-9_]*$c @ sr e Zd ZdZdZdd� Zedd� �Zedd� �Zd d � Z ddd �Z dd� Zddd�Zdd� Z dd� Zddd�ZdS )�CompiledRoutera Fast URI router which compiles its routing logic to Python code. Generally you do not need to use this router class directly, as an instance is created by default when the falcon.API class is initialized. The router treats URI paths as a tree of URI segments and searches by checking the URI one segment at a time. Instead of interpreting the route tree for each look-up, it generates inlined, bespoke Python code to perform the search, then compiles that code. This makes the route processing quite fast. ) �_ast�_converter_map�_converters�_find�_finder_src�_options� _patterns�_return_values�_rootsc C sF d | _ d | _d | _t� | _| jjj| _d | _d | _ g | _ | �� | _d S �N) r r r �CompiledRouterOptionsr r �datar r r r �_compiler ��self� r �{/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/falcon/routing/compiled.py�__init__A s zCompiledRouter.__init__c C s | j S r )r r r r r �optionsT s zCompiledRouter.optionsc C s | j S r )r r r r r � finder_srcX s zCompiledRouter.finder_srcc sv t �dt�d���rtd����d��d��t� }�D ]}| �||� q6d � ����fdd� � � | j � | � � | _dS ) a} Adds a route between a URI path template and a resource. Args: uri_template (str): A URI template to use for the route method_map (dict): A mapping of HTTP methods (e.g., 'GET', 'POST') to methods of a resource object. resource (object): The resource instance to associate with the URI template. z\sz{FIELD}z)URI templates may not include whitespace.�/r c s� | D ]x}�| }|� |�rT|d7 }|t��krB�|_�|_�|_n� |j|� d S |�|�rt�d�� � � dd�}t|��qt�| �}| � |� |t��d kr��|_�|_�|_n� |j|d � d S )N� a� The URI template for this route is inconsistent or conflicts with another route's template. This is usually caused by configuring a field converter differently for the same field in two different routes, or by using different field names at the same level in the path (e.g., '/parents/{id}' and '/parents/{parent_id}/children') � � )�matches�len� method_map�resource�uri_template�children�conflicts_with�textwrap�dedent�strip�replace� ValueError�CompiledRouterNode�append)�nodes� path_index�node�segment�msg�new_node��insertr �pathr! r"