HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/django/urls/__pycache__/resolvers.cpython-310.pyc
o

�h|�@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZmZddlmZm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&m'Z'ddl(m)Z)Gdd�d�Z*d/dd�Z+ej,dd�d/dd��Z-ej,dd�dd��Z.Gdd�d�Z/Gdd �d �Z0Gd!d"�d"e0�Z1ed#�Z2d0d%d&�Z3Gd'd(�d(e0�Z4Gd)d*�d*�Z5Gd+d,�d,�Z6Gd-d.�d.�Z7dS)1z�
This module converts requested URLs to callback view functions.

URLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a ResolverMatch object which provides access to all
attributes of the resolved URL match.
�N)�
import_module)�
PicklingError)�quote)�Local)�settings)�Error�Warning)�check_resolver)�ImproperlyConfigured�ViewDoesNotExist)�MultiValueDict)�cached_property)�RFC3986_SUBDELIMS�escape_leading_slashes)�_lazy_re_compile�	normalize)�get_language�)�
get_converter)�NoReverseMatch�Resolver404)�get_callablec@s<eZdZ							d
dd�Zdd�Zdd�Zdd	�ZdS)�
ResolverMatchNcCs�||_||_||_||_||_||_|	|_|
|_|r!dd�|D�ng|_d�	|j�|_
|r4dd�|D�ng|_d�	|j�|_t
|d�rF|j}t
|d�sW|jjd|jj|_n	|jd|j|_|pd|j}d�	|j|g�|_dS)NcS�g|]}|r|�qS�r��.0�xrr�H/usr/local/CyberCP/lib/python3.10/site-packages/django/urls/resolvers.py�
<listcomp>:�z*ResolverMatch.__init__.<locals>.<listcomp>�:cSrrrrrrrr<r �
view_class�__name__�.)�func�args�kwargs�url_name�route�tried�captured_kwargs�extra_kwargs�	app_names�join�app_name�
namespaces�	namespace�hasattrr"�	__class__�
__module__r#�
_func_path�	view_name)�selfr%r&r'r(r-r0r)r*r+r,�	view_pathrrr�__init__"s&



zResolverMatch.__init__cCs|j|j|jf|S�N)r%r&r')r7�indexrrr�__getitem__K�zResolverMatch.__getitem__cCsnt|jtj�r
t|j�}n|j}d||j|j|j|j	|j
|j|jr'd|j��nd|j
r3d|j
��f	Sdf	S)NzbResolverMatch(func=%s, args=%r, kwargs=%r, url_name=%r, app_names=%r, namespaces=%r, route=%r%s%s)z, captured_kwargs=�z, extra_kwargs=)�
isinstancer%�	functools�partial�reprr5r&r'r(r-r0r)r+r,)r7r%rrr�__repr__Ns,�������zResolverMatch.__repr__cCstd|jj�d���)NzCannot pickle r$)rr3�__qualname__)r7�protocolrrr�
__reduce_ex__er=zResolverMatch.__reduce_ex__)NNNNNNN)r#r4rDr9r<rCrFrrrrr!s
�)rcCs|durtj}t|�Sr:)r�ROOT_URLCONF�_get_cached_resolver��urlconfrrr�get_resolverisrK)�maxsizecCsttd�|�S�N�^/)�URLResolver�RegexPatternrIrrrrHosrHcCs.t|�}t|�|_t||j�}ttd�|g�SrM)rP�dict�
convertersrO�url_patterns)�
ns_pattern�resolverrR�pattern�ns_resolverrrr�get_ns_resolverts
rXc@seZdZdd�Zddd�ZdS)�LocaleRegexDescriptorcCs
||_dSr:)�attr)r7rZrrrr9��
zLocaleRegexDescriptor.__init__NcCsj|dur|St||j�}t|t�r|�|�|jd<|jdSt�}||jvr0|�t|��|j|<|j|S)zT
        Return a compiled regular expression based on the active language.
        N�regex)�getattrrZr?�str�_compile�__dict__r�_regex_dict)r7�instance�clsrV�
language_coderrr�__get__�s



zLocaleRegexDescriptor.__get__r:)r#r4rDr9rerrrrrYsrYc@seZdZdd�Zdd�ZdS)�
CheckURLMixincCs$d�|�}|jr|d�|j�7}|S)zI
        Format the URL pattern for display in warning messages.
        �'{}'z [name='{}'])�format�name)r7�descriptionrrr�describe�s
zCheckURLMixin.describecCsF|jj}tjs	gS|�d�r!|�d�s!td�|���dd�}|gSgS)zM
        Check that the pattern does not begin with a forward slash.
        )�/rNz^\/rlz�Your URL pattern {} has a route beginning with a '/'. Remove this slash as it is unnecessary. If this pattern is targeted in an include(), ensure the include() pattern has a trailing '/'.z	urls.W002��id)	r\rVr�APPEND_SLASH�
startswith�endswithrrhrk)r7�
regex_pattern�warningrrr�_check_pattern_startswith_slash�s���z-CheckURLMixin._check_pattern_startswith_slashN)r#r4rDrkrtrrrrrf�s	rfc@sFeZdZed�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rP�_regexNFcCs"||_i|_||_||_i|_dSr:)rura�_is_endpointrirR)r7r\ri�is_endpointrrrr9�s

zRegexPattern.__init__cCst|jr|jj�d�r|j�|�n|j�|�}|r8|��}|r dn|��}dd�|��D�}||�	�d�||fSdS)N�$rcSsi|]\}}|dur||�qSr:r)r�k�vrrr�
<dictcomp>�sz&RegexPattern.match.<locals>.<dictcomp>)
rvr\rVrq�	fullmatch�search�	groupdict�groups�items�end)r7�path�matchr'r&rrrr��s��
�zRegexPattern.matchcCs*g}|�|���|js|�|���|Sr:)�extendrtrv�_check_include_trailing_dollar�r7�warningsrrr�check�s
zRegexPattern.checkcCs8|jj}|�d�r|�d�std�|���dd�gSgS)Nrxz\$z�Your URL pattern {} uses include with a route ending with a '$'. Remove the dollar from the route to avoid problems including URLs.z	urls.W001rm)r\rVrqrrhrk)r7rrrrrr��s
��	z+RegexPattern._check_include_trailing_dollarc
Cs:zt�|�WStjy}z	td||f�|�d}~ww)z0Compile and return the given regular expression.z*"%s" is not a valid regular expression: %sN)�re�compile�errorr
)r7r\�errrr_�s
����zRegexPattern._compilecC�
t|j�Sr:)r^ru�r7rrr�__str__�r[zRegexPattern.__str__�NF)r#r4rDrYr\r9r�r�r�r_r�rrrrrP�s
	rPz1<(?:(?P<converter>[^>:]+):)?(?P<parameter>[^>]+)>Fc

Cs*|}dg}i}	t�|�}|s|�t�|��not|����tj	�s(t
d|��|�t�|d|�����||��d�}|d}|�
�sNt
d||f��|d}|durXd}zt|�}Wntys}	z	t
d	||f�|	�d}	~	ww|||<|�d
|d|jd�q|r�|�d
�d�|�|fS)a
    Convert a path pattern into a regular expression. Return the regular
    expression and a dictionary mapping the capture names to the converters.
    For example, 'foo/<int:pk>' returns '^foo\/(?P<pk>[0-9]+)'
    and {'pk': <django.urls.converters.IntConverter>}.
    �^TuAURL route '%s' cannot contain whitespace in angle brackets <…>.N�	parameterzLURL route '%s' uses parameter name %r which isn't a valid Python identifier.�	converterr^z'URL route %r uses invalid converter %r.�(?P<�>�)z\Zr>)�_PATH_PARAMETER_COMPONENT_REr}�appendr��escape�set�group�
isdisjoint�string�
whitespacer
�startr��isidentifierr�KeyErrorr\r.)
r)rw�original_route�partsrRr�r��
raw_converterr�r�rrr�_route_to_regex�sX
����������
r�c@s>eZdZed�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�RoutePattern�_routeNFcCs0||_i|_||_||_tt|�|�d|_dS)Nr)r�rarvrir�r^rR)r7r)rirwrrrr9+s
zRoutePattern.__init__c	Csv|j�|�}|r9|��}|��D]\}}|j|}z	|�|�||<Wqty-YdSw||��d�d|fSdS�Nr)r\r}r~r�rR�	to_python�
ValueErrorr�)r7r�r�r'�key�valuer�rrrr�2s
�zRoutePattern.matchcCsJ|��}|j}d|vs|�d�s|�d�r#|�td�|���dd��|S)Nr�r�rxz�Your URL pattern {} has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().z2_0.W001rm)rtr�rprqr�rrhrk)r7r�r)rrrr�@s
��zRoutePattern.checkcCst�t||j�d�S)Nr)r�r�r�rv)r7r)rrrr_N�zRoutePattern._compilecCr�r:)r^r�r�rrrr�Qr[zRoutePattern.__str__r�)
r#r4rDrYr\r9r�r�r_r�rrrrr�(s
r�c@sNeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�LocalePrefixPatternTcCs||_i|_dSr:)�prefix_default_languagerR)r7r�rrrr9Vs
zLocalePrefixPattern.__init__cCst�t�|j��Sr:)r�r�r��language_prefixr�rrrr\ZszLocalePrefixPattern.regexcCs(t�ptj}|tjkr|jsdSd|S)Nr>z%s/)rr�
LANGUAGE_CODEr��r7rdrrrr�_sz#LocalePrefixPattern.language_prefixcCs*|j}|�|�r|t|�d�difSdSr�)r�rp�len)r7r�r�rrrr�gs
zLocalePrefixPattern.matchcCsgSr:rr�rrrr�mszLocalePrefixPattern.checkcCs
d�|�S)Nrg)rhr�rrrrkpr[zLocalePrefixPattern.describecCs|jSr:)r�r�rrrr�sszLocalePrefixPattern.__str__N)T)r#r4rDr9�propertyr\r�r�r�rkr�rrrrr�Us


r�c@sJeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Ze	dd��Z
dS)�
URLPatternNcCs ||_||_|p	i|_||_dSr:)rV�callback�default_argsri)r7rVr�r�rirrrr9xs

zURLPattern.__init__cCsd|jj|j��fS)Nz<%s %s>)r3r#rVrkr�rrrrC~r�zURLPattern.__repr__cCs*|��}|�|j���|�|���|Sr:)�_check_pattern_namer�rVr��_check_callbackr�rrrr��szURLPattern.checkcCs:|jjdurd|jjvrtd�|j���dd�}|gSgS)zG
        Check that the pattern name does not contain a colon.
        Nr!zjYour URL pattern {} has a name including a ':'. Remove the colon, to avoid ambiguous namespace references.z	urls.W003rm)rVrirrhrk)r7rsrrrr��s�zURLPattern._check_pattern_namecCsLddlm}|j}t�|�r$t||�r$td|j��|j	|j	fdd�gSgS)Nr)�ViewzIYour URL pattern %s has an invalid view, pass %s.as_view() instead of %s.z	urls.E009rm)
�django.viewsr�r��inspect�isclass�
issubclassrrVrkr#)r7r��viewrrrr��s����zURLPattern._check_callbackc	CsP|j�|�}|r&|\}}}i|�|j�}t|j|||jjt|j�||jd�SdS)N)r)r+r,)rVr�r�rr�rir^)r7r�r��new_pathr&r+r'rrr�resolve�s
��zURLPattern.resolvecCsV|j}t|tj�r|j}t|d�r|j}nt|d�s#|jd|jj	S|jd|j
S)zw
        A string that identifies the view (e.g. 'path.to.view_function' or
        'path.to.ClassBasedView').
        r"r#r$)r�r?r@rAr%r2r"r4r3r#rD)r7r�rrr�
lookup_str�s

zURLPattern.lookup_str)NN)r#r4rDr9rCr�r�r�r�r
r�rrrrr�ws
r�c@s�eZdZ	d$dd�Zdd�Zdd�Zdd	�Zd
d�Zedd
��Z	edd��Z
edd��Zed%dd��Z
edd��Zdd�Zdd�Zedd��Zedd��Zdd�Zd d!�Zd"d#�ZdS)&rONcCsT||_||_d|_|pi|_||_||_i|_i|_i|_t	�|_
d|_t�|_
dSr�)rV�urlconf_namer��default_kwargsr1r/�
_reverse_dict�_namespace_dict�	_app_dictr��_callback_strs�
_populatedr�_local)r7rVr�r�r/r1rrrr9�s
zURLResolver.__init__cCsPt|jt�r|jrd|jdjj}nt|j�}d|jj||j|j|j�	�fS)Nz	<%s list>rz<%s %s (%s:%s) %s>)
r?r��listr3r#rBr/r1rVrk)r7�urlconf_reprrrrrC�s
�zURLResolver.__repr__cCs:g}|jD]	}|�t|��q|�|���|p|j��Sr:)rSr�r	�_check_custom_error_handlersrVr�)r7�messagesrVrrrr��s

zURLResolver.checkc
Cs�g}dD]r\}}z|�|�}Wn/ttfy>}z!t|jd|�}dj||d�}|�t|t|�dd��WYd}~qd}~wwt	�
|�}dg|}	z|j|	�Wqtyvdj||j
d|j|d	krgd
ndd�}|�t|d
d��Yqw|S)N))i��)i�r�)i�r�)i�r�	handler%szDThe custom handler{status_code} view '{path}' could not be imported.)�status_coder�z	urls.E008)�hintrnzeThe custom handler{status_code} view '{path}' does not take the correct number of arguments ({args}).r$r�zrequest, exception�request)r�r�r&z	urls.E007rm)�resolve_error_handler�ImportErrorrr]�urlconf_modulerhr�rr^r��	signature�bind�	TypeErrorr4rD)
r7r�r��num_parameters�handlerr�r��msgr�r&rrrr��s6���

��
z(URLResolver._check_custom_error_handlerscCst|jdd�r	dSz�d|j_t�}i}i}t�}t|j�D]�}|jjj}|�	d�r/|dd�}t
|t�rd|j�
|j�t|jjj�}|�|j|||j|jjf�|jdurc|�|j|||j|jjf�q|��|jr~|�|jg��|j�||f||j<nf|jD]0}|j�|�D]'\}	}
}}t||
�}
|�||
||
i|�|j�i|jj�|jj�|�f�q�q�|j��D]\}\}}|jj}|jj�|�|||f||<q�|j ��D]
\}}|�|g��!|�q�|j�|j�q||j"|<||j#|<||j$|<d|_%Wd|j_dSd|j_w)N�
populatingFTr�r)&r]r�r�rr�reversedrSrVr\rpr?r�r��addr�r�
appendlistr�r�rRri�	_populater/�
setdefaultr�r1�reverse_dict�getlistr��namespace_dictr��update�app_dictr�r�r�r�r�)r7�lookupsr0�appsrd�url_pattern�	p_pattern�bitsri�matches�pat�defaultsrR�new_matchesr1�prefix�sub_pattern�current_convertersr/�namespace_listrrrr�s�


��
	���
�

�������
�


zURLResolver._populatecC�"t�}||jvr|��|j|Sr:)rr�r�r�rrrr�g�

zURLResolver.reverse_dictcCr�r:)rr�r�r�rrrr�nr�zURLResolver.namespace_dictcCr�r:)rr�r�r�rrrr�ur�zURLResolver.app_dictcs4|dur|��g�dS|��fdd�|D��dS)Nc3s�|]}�g|�VqdSr:r)r�t�rVrr�	<genexpr>�s�z,URLResolver._extend_tried.<locals>.<genexpr>)r�r�)r*rV�	sub_triedrr�r�
_extend_tried|szURLResolver._extend_triedcCs&|s|S|�d�r|dd�}||S)z<Join two routes, without the starting ^ in the second route.r�rN)rp)�route1�route2rrr�_join_route�s

zURLResolver._join_routecCs|js|��||jvSr:)r�r�r�)r7rirrr�_is_callback�s
zURLResolver._is_callbackc

CsPt|�}g}|j�|�}|r�|\}}}|jD]�}z|�|�}Wnty>}	z|�|||	jd�d��WYd}	~	qd}	~	ww|r�i|�|j	�}
|
�
|j�|j}|
sX||j}t|t
�r_dnt|j�}|�|||j�t|j||
|j|jg|j|jg|j|�||j�||ji|j	�|j�d�
S|�|g�qt||d���td|i��)Nrr*r>)r+r,)r*r�r�)r^rVr�rSr�rr�r&�getr�r�r'r?r�r*rr%r(r/r-r1r0r�r)r+r,r�)
r7r�r*r�r�r&r'rV�	sub_matchr��sub_match_dict�sub_match_args�
current_routerrrr��sT

&��
����
�zURLResolver.resolvecCst|jt�rt|j�S|jSr:)r?r�r^rr�rrrr��s
zURLResolver.urlconf_modulec
CsPt|jd|j�}zt|�W|Sty'}zd}t|j|jd��|�d}~ww)N�urlpatternsz�The included URLconf '{name}' does not appear to have any patterns in it. If you see the 'urlpatterns' variable with valid patterns in the file then the issue is probably caused by a circular import.)ri)r]r��iterr�r
rhr�)r7�patternsr�r�rrrrS�s
	����zURLResolver.url_patternscCs8t|jd|d�}|sddlm}t|d|�}t|�S)Nr�r)�urls)r]r��django.confrr)r7�	view_typer�rrrrr��s
z!URLResolver.resolve_error_handlercOs|j|dg|�Ri|��S)Nr>)�_reverse_with_prefix)r7�lookup_viewr&r'rrr�reverse�szURLResolver.reversecOs|r|rtd��|js|��|j�|�}|D]�\}}}}	|D]�\}
}|r6t|�t|�kr.qtt||��}n,t|��	|��
|�rAqd}
|��D]\}}||vrPqG|�||�|kr\d}
nqG|
s`q|}i}d}|��D]&\}}||	vr�z|	|�
|�||<Wqjty�d}Ynwt|�||<qj|s�q|�dd�|
}t�dt�|�|f||�r�t||tdd�}t|�Sqqt|d	d�}t|d
d�}|dur�|dur�d||f}n|}dd
�|D�}|�r|r�d|f}n	|r�d|}nd}d||t|�|f}t|��dd|i}t|��)Nz2Don't mix *args and **kwargs in call to reverse()!TF�%z%%z^%s%sz/~:@)�safer4r#z%s.%scSsg|]\}}}}|�qSrr)r�_rVrrrr)sz4URLResolver._reverse_with_prefix.<locals>.<listcomp>zarguments '%s'zkeyword arguments '%s'zno argumentsz;Reverse for '%s' with %s not found. %d pattern(s) tried: %szZReverse for '%(view)s' not found. '%(view)s' is not a valid view function or pattern name.r�)r�r�r�r�r�r�rQ�zipr��symmetric_difference�
differencer�r�to_urlr^�replacer�r}r�rrrr]r)r7r�_prefixr&r'�
possibilities�possibilityrVr�rR�result�params�candidate_subsr�ryrz�text_candidate_subsr��
candidate_pat�url�m�n�
lookup_view_sr�arg_msgr�rrrr�s�������3
����z URLResolver._reverse_with_prefix)NNNr:)r#r4rDr9rCr�r�r�r�r�r�r��staticmethodr�r�r�r�r
r�rSr�r
rrrrrrO�s4
�U



0


rOr:)F)8�__doc__r@r�r�r��	importlibr�pickler�urllib.parser�
asgiref.localrr	r�django.core.checksrr�django.core.checks.urlsr	�django.core.exceptionsr
r�django.utils.datastructuresr�django.utils.functionalr
�django.utils.httprr�django.utils.regex_helperrr�django.utils.translationrrRr�
exceptionsrr�utilsrrrK�	lru_cacherHrXrYrfrPr�r�r�r�r�rOrrrr�<module>sL
H



#<�
.-"Q