|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /lib64/python2.7/site-packages/django/utils/ |
Upload File : |
�
r�\c @ s� d Z d d l m Z d d l m Z d d l m Z i
d d 6d d 6d d 6d d 6d
d 6d d
6d
d 6d
d 6d d 6d d 6Z d e f d � � YZ
d e f d � � YZ d e f d � � YZ d � Z
d � Z d � Z d � Z d � Z d � Z d S( u
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
i����( t unicode_literals( t six( t zipu Au bu Bu 0u du xu Du u su Su wu !u Wu Zt Choicec B s e Z d Z RS( u�
Used to represent multiple possibilities at this point in a pattern string.
We use a distinguished type, rather than a list, so that the usage in the
code is clear.
( t __name__t
__module__t __doc__( ( ( s; /tmp/pip-install-XxeQeY/django/django/utils/regex_helper.pyR s t Groupc B s e Z d Z RS( uD
Used to represent a capturing group in the pattern string.
( R R R ( ( ( s; /tmp/pip-install-XxeQeY/django/django/utils/regex_helper.pyR $ s t
NonCapturec B s e Z d Z RS( uH
Used to represent a non-capturing group in the pattern string.
( R R R ( ( ( s; /tmp/pip-install-XxeQeY/django/django/utils/regex_helper.pyR ) s c C ss g } g } t } t t | � � } d } y t | � \ } } Wn t k
r] d g f g SXy�x�t r-| r� | j | � n�| d k r� | j d � nm| d k r� t � nX| d k r� nI| d k r� Pn9| d k r| j � } t | | � } | | | g } n�| d k rwt | � \ } } | j | � t | � \ } } x�| s^| d k rst | � \ } } qLWn�| d
k rUt | � \ } } | d k s�| r�d | }
| d
7} | j t d |
|
f � � t
| | � q t | � \ } } | d k rt
| | � q | d k r8| j t | � � q | d k rWt d | � � q t | � \ } } | d k r�t d | � � n | d k r�d } n d } g }
t | � \ } } x/ | | k r�|
j | � t | � \ } } q�Wd j
|
� } | d k r5| j t d | | f � � t
| | � q | j t d | d f � � n� | d k r�t | | � \ }
} | r�t } n |
d k r�t | d t � r�t d | d g � | d <q�| j � q |
d
k r | j | d g |
d
� q n
| j | � | r$t | � \ } } qd t } qd WWn+ t k
rBn t k
r\d g f g SXt t t | � � � S( u�
Given a reg-exp pattern, normalizes it to an iterable of forms that
suffice for reverse matching. This does the following:
(1) For any repeating sections, keeps the minimum number of occurrences
permitted (this means zero for optional groups).
(2) If an optional group includes parameters, include one occurrence of
that group (along with the zero occurrence case from step (1)).
(3) Select the first (essentially an arbitrary) element from any character
class. Select an arbitrary character for any unordered class (e.g. '.'
or '\w') in the pattern.
(5) Ignore comments and any of the reg-exp flags that won't change
what we construct ("iLmsu"). "(?x)" is an error, however.
(6) Raise an error on all other non-capturing (?...) forms (e.g.
look-ahead and look-behind matches) and any disjunctive ('|')
constructs.
Django's URLs for forward resolving are either all positional arguments or
all keyword arguments. That is assumed here, as well. Although reverse
resolving can be done using positional args when keyword args are
specified, the two cannot be mixed in the same reverse() call.
i u u .u |u ^u $u )u [u ]u (u ?u _%di u %%(%s)su iLmsu#u :u Pu&