U
    ¨t‡b   ã                   @  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d„Zddddœdd„ZdS )é    )ÚannotationsN)ÚSequence)ÚAny)Úurlparse)Ú	AppConfig)Úsettings)ÚError)ÚconfÚ zlist[AppConfig]r   zlist[Error])Úapp_configsÚkwargsÚreturnc           
   
   K  s\  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ƒrttj
dk r†| td	d
d�¡ ttjt	ƒs¾ttdƒr¢d}nd}| t|› d�dd�¡ ttdƒrÎd}nd}t tjtƒsø| t|› d�dd�¡ nžd}tjD ]’}||k�r�qt|ƒ}|jdk�s4|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ƒ�r¨d}	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jt	ƒ�s:| td$d%d�¡ ttd&ƒ�rX| 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.E003r   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ÚparamsÚ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_REPLACE_HTTPS_REFERER should be a bool.zcorsheaders.E011Z
CORS_MODELzKThe CORS_MODEL setting has been removed - see django-cors-headers' HISTORY.zcorsheaders.E012)Úis_sequencer	   ZCORS_ALLOW_HEADERSÚstrÚappendr   ZCORS_ALLOW_METHODSÚ
isinstanceZCORS_ALLOW_CREDENTIALSÚboolZCORS_PREFLIGHT_MAX_AGEÚintr   Úhasattrr   r   r   ÚschemeÚnetlocÚformatÚreprÚgetattrr   Úre_typeZCORS_EXPOSE_HEADERSZCORS_URLS_REGEXZCORS_REPLACE_HTTPS_REFERER)
r   r   ÚerrorsZallow_all_aliasZallowed_origins_aliasZspecial_origin_valuesÚoriginÚparsedÚpartZallowed_regexes_alias© r)   ú6/tmp/pip-unpacked-wheel-h03uz43q/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)   r0   r*   r   ¡   s    ÿr   )Ú
__future__r   ÚreÚcollections.abcr   Útypingr   Úurllib.parser   Zdjango.appsr   Zdjango.confr   Zdjango.core.checksr   Zcorsheaders.confr	   ÚtypeÚcompiler$   r+   r   r)   r)   r)   r*   Ú<module>   s    