
    af                          d dl mZ d dlmZ ddlmZmZmZmZ  eej	                  d             Z
d Z eej	                  d             Zdd	Zd
 Z eej	                  d             Zd ZdS )    )Counter)settings   )ErrorTagsWarningregisterc                 p    t          t          dd           rddlm}  |            }t	          |          S g S )NROOT_URLCONFr   get_resolver)getattrr   django.urlsr   check_resolver)app_configskwargsr   resolvers       I/var/www/html/env/lib/python3.11/site-packages/django/core/checks/urls.pycheck_url_configr      sF    x.. (,,,,,,<>>h'''I    c                 ~    t          | dd          }|
 |            S t          | d          st          |           S g S )z)
    Recursively check the resolver.
    checkNresolve)r   hasattrget_warning_for_invalid_pattern)r   check_methods     r   r   r      sL     8Wd33L|~~Xy)) .x888	r   c                 J   t          t          dd          sg S ddlm}  |            }t	          |          }t          |          }d |                                D             }g }|D ]9}|                    t          d	                    |          d                     :|S )	zD
    Warn if URL namespaces used in applications aren't unique.
    r   Nr   r   c                 $    g | ]\  }}|d k    |S )r    ).0ncounts      r   
<listcomp>z/check_url_namespaces_unique.<locals>.<listcomp>,   s!    LLL81e%!))Q)))r   zZURL namespace '{}' isn't unique. You may not be able to reverse all URLs in this namespacez	urls.W005id)
r   r   r   r   _load_all_namespacesr   itemsappendr   format)	r   r   r   r   all_namespacescounternon_unique_namespaceserrors	namespaces	            r   check_url_namespaces_uniquer/      s    
 8^T22 	((((((|~~H)(33Nn%%GLLw}}LLLF* 
 
	--3VI->->  	
 	
 	
 	
 Mr   r   c                     t          | dg           }fd|D             }|D ]@}t          |dd          }}|||fz  }|                    t          ||                     A|S )z<
    Recursively load all namespaces from URL patterns.
    url_patternsc                 n    g | ]1}t          |d d          d                    |j        fz             2S )r.   N:)r   joinr.   )r    urlparentss     r   r#   z(_load_all_namespaces.<locals>.<listcomp>>   sK       3T**6 	CM++,,666r   r.   N)r   extendr&   )r   r6   r1   
namespacespatternr.   currents    `     r   r&   r&   9   s     8^R88L     J
   B BG[$77	 	|#G.w@@AAAAr   c                     t          | t                    rd                    |           }nt          | t                    rd}nd}t	          d                    |           |d          gS )z
    Return a list containing a warning that the pattern is invalid.

    describe_pattern() cannot be used here, because we cannot rely on the
    urlpattern having regex or name attributes.
    zkTry removing the string '{}'. The list of urlpatterns should not have a prefix string as the first element.z$Try using path() instead of a tuple.NziYour URL pattern {!r} is invalid. Ensure that urlpatterns is a list of path() and/or re_path() instances.z	urls.E004)hintr%   )
isinstancestrr)   tupler   )r9   r<   s     r   r   r   L   s     '3 99? 	 
GU	#	# 5 	44:F7OO		
 	
 	
 r   c                     g }dD ]P}t          t          |          }|r7|                    d          s"|                    t	          |                     Q|S )N)
STATIC_URL	MEDIA_URL/)r   r   endswithr(   E006)r   r   r-   namevalues        r   check_url_settingsrH   g   s^    F+ & &$'' 	&,, 	&MM$t**%%%Mr   c                 J    t          d                    |           d          S )Nz%The {} setting must end with a slash.z	urls.E006r$   )r   r)   )rF   s    r   rE   rE   q   s-    /66t<<   r   N)r   )collectionsr   django.confr    r   r   r   r	   urlsr   r   r/   r&   r   rH   rE   r   r   r   <module>rN      s                     , , , , , , , , , , , , 
$)  
 
 
 
$)  2   &  6 
$)      r   