관리-도구
편집 파일: transactions.cpython-37.opt-1.pyc
B T a� � @ s� d Z ddlmZ ddlZddlmZ er�ddlmZ ddlm Z ddlm Z ddlmZ dd lmZ dd lm Z ddlmZ ddlmZ ydd lmZ W n ek r� dd lmZ Y nX dd� ZG dd� de�Ze� ZdS )zZ Copied from raven-python. Used for `DjangoIntegration(transaction_fron="raven_legacy")`. � )�absolute_importN)�MYPY)�URLResolver)�Dict)�List)�Optional)� URLPattern)�Tuple)�Union)�Pattern)�get_resolverc C s, y | j }W n tk r& | jj }Y nX |S )z5Utility method for django's deprecated resolver.regex)�regex�AttributeError�pattern)Zresolver_or_patternr � r �\/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/django/transactions.py� get_regex s r c @ s^ e Zd Ze�d�Ze�d�Ze�d�Ze�d�Ze�d�Z i Z dd� Zd d d �Zddd�Z dS )� RavenResolverz\(\?\:([^\)]+)\)z\(\?P<(\w+)>[^\)]+\)+z \([^\)]+\)z\[([^\]]+)\|([^\]]+)\]z([A-Z]+)([a-z])c C st | j �dd� |�}| j�dd� |�}| j�d|�}| j�dd� |�}|�dd��dd��d d��d d��dd�}|S ) z� Clean up urlpattern regexes into something readable by humans: From: > "^(?P<sport_slug>\w+)/athletes/(?P<athlete_slug>\w+)/$" To: > "{sport_slug}/athletes/{athlete_slug}/" c S s d| � d� S )Nz%s� )�group)�mr r r �<lambda>? � z)RavenResolver._simplify.<locals>.<lambda>c S s d| � d� S )Nz{%s}r )r )r r r r r B r z{var}c S s | � d�S )Nr )r )r r r r r H r �^� �$�?z//�/�\)�_optional_group_matcher�sub�_named_group_matcher�_non_named_group_matcher�_either_option_matcher�replace)�selfr �resultr r r � _simplify0 s zRavenResolver._simplifyNc s� t |��|�}|sd S |d kr&|g}n||kr8||g }||�� d � }x�|jD ]�}|jst� �|||�}|rP|S qPnt |��|�s�qPy � j| S tk r� Y nX d�� fdd�|D ��}|� � t |�j � } | �d�s�d| } | � j|<