U
    ڲg                      @  s   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d d	lmZ eed
ZdddddZddddddZdS )    )annotationsN)Sequence)Any)urlsplit)settings)CheckMessage)Error)conf r   zlist[CheckMessage])kwargsreturnc            	   
   K  sz  g }t tjts"|tddd t tjts@|tddd ttjt	s^|tddd ttj
t	s||tdd	d ttjtrtjd
k r|tddd ttjt	sttdrd}nd}|t| ddd ttdrd}nd}t tjts|t| ddd nd}tjD ]}||kr4q"t|}|jdksT|jdkrv|tdt||ddd n<dD ]6}t||dkrz|tdt|||dd qzq"ttdrd}nd}t tjttfs|td |d!d t tjts|td"d#d ttjttfs:|td$d%d ttd&rX|td'd(d ttd)rv|td*dd |S )+Nz3CORS_ALLOW_HEADERS should be a sequence of strings.zcorsheaders.E001)idz3CORS_ALLOW_METHODS should be a sequence of strings.zcorsheaders.E002z(CORS_ALLOW_CREDENTIALS should be a bool.zcorsheaders.E003z,CORS_ALLOW_PRIVATE_NETWORK should be a bool.zcorsheaders.E015r   zJCORS_PREFLIGHT_MAX_AGE should be an integer greater than or equal to zero.zcorsheaders.E004CORS_ALLOW_ALL_ORIGINSZCORS_ORIGIN_ALLOW_ALLz should be a bool.zcorsheaders.E005CORS_ALLOWED_ORIGINSZCORS_ORIGIN_WHITELISTz! should be a sequence of strings.zcorsheaders.E006)nullzfile://r
   z+Origin {} in {} is missing scheme or netloczcorsheaders.E013z:Add a scheme (e.g. https://) or netloc (e.g. example.com).)r   hint)pathqueryfragmentz"Origin {} in {} should not have {}zcorsheaders.E014CORS_ALLOWED_ORIGIN_REGEXESZCORS_ORIGIN_REGEX_WHITELISTz;{} should be a sequence of strings and/or compiled regexes.zcorsheaders.E007z)CORS_EXPOSE_HEADERS should be a sequence.zcorsheaders.E008z,CORS_URLS_REGEX should be a string or regex.zcorsheaders.E009Z
CORS_MODELzKThe CORS_MODEL setting has been removed - see django-cors-headers' HISTORY.zcorsheaders.E012ZCORS_REPLACE_HTTPS_REFERERz]The CORS_REPLACE_HTTPS_REFERER setting has been removed - see django-cors-headers' CHANGELOG.)is_sequencer	   ZCORS_ALLOW_HEADERSstrappendr   ZCORS_ALLOW_METHODS
isinstanceZCORS_ALLOW_CREDENTIALSboolZCORS_ALLOW_PRIVATE_NETWORKZCORS_PREFLIGHT_MAX_AGEintr   hasattrr   r   r   schemenetlocformatreprgetattrr   re_typeZCORS_EXPOSE_HEADERSZCORS_URLS_REGEX)	r   errorsZallow_all_aliasZallowed_origins_aliasZspecial_origin_valuesoriginparsedpartZallowed_regexes_alias r'   6/tmp/pip-unpacked-wheel-lqlwanta/corsheaders/checks.pycheck_settings   s    






   		



r)   z!type[Any] | tuple[type[Any], ...]r   )thingtype_or_typesr   c                   s    t | tot fdd| D S )Nc                 3  s   | ]}t | V  qd S )N)r   ).0xr+   r'   r(   	<genexpr>   s    zis_sequence.<locals>.<genexpr>)r   r   all)r*   r+   r'   r.   r(   r      s    r   )
__future__r   recollections.abcr   typingr   urllib.parser   Zdjango.confr   Zdjango.core.checksr   r   Zcorsheaders.confr	   typecompiler"   r)   r   r'   r'   r'   r(   <module>   s    