U
    tb                     @  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	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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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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    