
    Evg5                     ,   d dl Z d dlmZ 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 ee	j                  d             ZdS )    N)Counter)settings)ViewDoesNotExist   )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       T/var/www/pixelcanvas.ch/venv/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_uniquer0   !   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   r7   r2   
namespacespatternr/   currents    `     r   r'   r'   ;   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   )r:   r>   s     r   r   r   N   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_settingsrJ   i   s^    F+ & &$'' 	&,, 	&MM$t**%%%Mr   c                 J    t          d                    |           d          S )Nz%The {} setting must end with a slash.z	urls.E006r%   )r   r*   )rH   s    r   rG   rG   s   s-    /66t<<   r   c           
         t          t          dd           sg S ddlm}  |            }g }dD ]%\  }}	 |                    |          }n# t
          t          f$ rk}t          |j        d|z            }	d                    ||	          }
|	                    t          |
t          |          d	                     Y d }~d }~ww xY wt          j        |          }d g|z  }	  |j        |  # t          $ rX d
                    ||j        dz   |j        z   |dk    rdnd          }
|	                    t          |
d                     Y #w xY w|S )Nr   r   r   ))i     )i  rM   )i  rM   )i  r   z	handler%szDThe custom handler{status_code} view '{path}' could not be imported.)status_codepathz	urls.E008r=   zeThe custom handler{status_code} view '{path}' does not take the correct number of arguments ({args})..rM   zrequest, exceptionrequest)rN   rO   argsz	urls.E007r%   )r   r   r   r   resolve_error_handlerImportErrorr   urlconf_moduler*   r)   r   r@   inspect	signaturebind	TypeError
__module____qualname__)r   r   r   r   r.   rN   num_parametershandlererO   msgrW   rR   s                r   check_custom_error_handlersr`   z   s   8^T22 	((((((|~~HF (P 6 6#^		44[AAGG-. 	 	 	82K+4MNNDf4f88  MM%#a&&[AAABBBHHHH	 %g..	v&	6IND!!! 		6 		6 		6Af''#-0DD-;q-@-@))i     MM%44455555		6 Ms+   A

CA!CC$
C//AEE)r    )rV   collectionsr   django.confr   django.core.exceptionsr    r   r   r	   r
   urlsr   r   r0   r'   r   rJ   rG   r`   r    r   r   <module>rf      sS                      3 3 3 3 3 3 , , , , , , , , , , , , 
$)  
 
 
 
$)  2   &  6 
$)     
$)$ $ $ $ $r   